From 71eb9d123d753f1bcb1d1e1ad472320f83f28a25 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Fri, 17 Jun 2011 11:33:18 -0400 Subject: [PATCH] tests: import the widget-factory test for theming Courtesy of Andrea Cimitan . --- tests/Makefile.am | 10 +- tests/widget-factory.c | 53 ++ tests/widget-factory.ui | 1717 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 1778 insertions(+), 2 deletions(-) create mode 100644 tests/widget-factory.c create mode 100644 tests/widget-factory.ui diff --git a/tests/Makefile.am b/tests/Makefile.am index aa3754e31..2a74ceb70 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -117,7 +117,8 @@ noinst_PROGRAMS = $(TEST_PROGS) \ testanimation \ testpixbuf-save \ testpixbuf-color \ - testpixbuf-scale + testpixbuf-scale \ + widget-factory if USE_X11 noinst_PROGRAMS += testerrors @@ -224,6 +225,7 @@ testanimation_DEPENDENCIES = $(TEST_DEPS) testpixbuf_save_DEPENDENCIES = $(TEST_DEPS) testpixbuf_color_DEPENDENCIES = $(TEST_DEPS) testpixbuf_scale_DEPENDENCIES = $(TEST_DEPS) +widget_factory_DEPENDENCIES = $(TEST_DEPS) flicker_LDADD = $(LDADDS) simple_LDADD = $(LDADDS) @@ -317,6 +319,7 @@ testanimation_LDADD = $(LDADDS) testpixbuf_save_LDADD = $(LDADDS) testpixbuf_color_LDADD = $(LDADDS) testpixbuf_scale_LDADD = $(LDADDS) +widget_factory_LDADD = $(LDADDS) testboxcss_SOURCES = \ @@ -479,6 +482,8 @@ testpixbuf_color_SOURCES = testpixbuf-color.c testpixbuf_save_SOURCES = testpixbuf-save.c +widget_factory_SOURCES = widget-factory.c + EXTRA_DIST += \ gradient1.png \ @@ -500,7 +505,8 @@ EXTRA_DIST += \ merge-2.ui \ merge-3.ui \ gnome-textfile.png \ - makefile.msc + makefile.msc \ + widget-factory.ui -include $(top_srcdir)/git.mk diff --git a/tests/widget-factory.c b/tests/widget-factory.c new file mode 100644 index 000000000..3235bda99 --- /dev/null +++ b/tests/widget-factory.c @@ -0,0 +1,53 @@ +/* widget-factory: a collection of widgets in a single page, for easy + * theming + * + * Copyright (C) 2011 Canonical Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, + * MA 02110-1301, USA. + * + * Authored by Andrea Cimitan + * + */ + +#include + +int +main (int argc, char *argv[]) +{ + GtkBuilder *builder; + GtkWidget *window; + + gtk_init (&argc, &argv); + + if (argc > 1 && + (g_strcmp0 (argv[1], "--dark") == 0)) + g_object_set (gtk_settings_get_default (), + "gtk-application-prefer-dark-theme", TRUE, + NULL); + + builder = gtk_builder_new (); + gtk_builder_add_from_file (builder, "./widget-factory.ui", NULL); + + window = GTK_WIDGET (gtk_builder_get_object (builder, "window")); + gtk_builder_connect_signals (builder, NULL); + + g_object_unref (G_OBJECT (builder)); + + gtk_widget_show (window); + gtk_main (); + + return 0; +} diff --git a/tests/widget-factory.ui b/tests/widget-factory.ui new file mode 100644 index 000000000..a7cac2c6b --- /dev/null +++ b/tests/widget-factory.ui @@ -0,0 +1,1717 @@ + + + + + 100 + 50 + 1 + 10 + + + + + + + + + + + + + True + Andrea + Cimi + + + False + Otto + chaotic + + + + + Lorem ipsum dolor sit amet, consectetur adipiscing elit. +Nullam fringilla, est ut feugiat ultrices, elit lacus ultricies nibh, id commodo tortor nisi id elit. +Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. +Morbi vel elit erat. Maecenas dignissim, dui et pharetra rutrum, tellus lectus rutrum mi, a convallis libero nisi quis tellus. +Nulla facilisi. Nullam eleifend lobortis nisl, in porttitor tellus malesuada vitae. +Aenean lacus tellus, pellentesque quis molestie quis, fringilla in arcu. +Duis elementum, tellus sed tristique semper, metus metus accumsan augue, et porttitor augue orci a libero. +Ut sed justo ac felis placerat laoreet sed id sem. Proin mattis tincidunt odio vitae tristique. +Morbi massa libero, congue vitae scelerisque vel, ultricies vel nisl. +Vestibulum in tortor diam, quis aliquet quam. Praesent ut justo neque, tempus rutrum est. +Duis eu lectus quam. Vivamus eget metus a mauris molestie venenatis pulvinar eleifend nisi. +Nulla facilisi. Pellentesque at dolor sit amet purus dapibus pulvinar molestie quis neque. +Suspendisse feugiat quam quis dolor accumsan cursus. + + + False + + + True + False + vertical + + + True + False + + + True + False + False + _File + True + + + True + False + + + gtk-new + True + False + False + True + True + + + + + gtk-open + True + False + False + True + True + + + + + gtk-save + True + False + False + True + True + + + + + gtk-save-as + True + False + False + True + True + + + + + True + False + False + + + + + gtk-quit + True + False + False + True + True + + + + + + + + + True + False + False + _Edit + True + + + True + False + + + gtk-cut + True + False + False + True + True + + + + + gtk-copy + True + False + False + True + True + + + + + gtk-paste + True + False + False + True + True + + + + + gtk-delete + True + False + False + True + True + + + + + + + + + True + False + False + _View + True + + + + + True + False + False + _Help + True + + + True + False + + + gtk-about + True + False + False + True + True + + + + + + + + + False + True + 0 + + + + + True + False + + + True + False + False + Save + True + gtk-save + + + False + True + + + + + True + False + False + Open + True + gtk-open + + + False + True + + + + + True + False + False + + + False + True + + + + + True + False + False + Find + True + gtk-find + + + False + True + + + + + True + False + False + + + + + + True + True + + + + + True + False + False + + + True + True + • + search... + + + + + False + + + + + False + True + 1 + + + + + True + False + 6 + + + True + False + vertical + 4 + + + True + False + True + + + False + comboboxentry + + + + + False + False + 0 + + + + + True + False + False + True + + + False + • + comboboxentry + + + + + False + False + 1 + + + + + True + True + • + entry + + + False + False + 2 + + + + + True + False + True + • + entry + + + False + False + 3 + + + + + True + False + 20 + + + True + False + label + + + False + True + 0 + + + + + True + False + False + label + + + False + True + 1 + + + + + True + True + • + + + False + False + 2 + + + + + True + True + • + + + False + False + 3 + + + + + False + False + 4 + + + + + True + False + True + 4 + 2 + + + checkbutton + True + True + False + False + 0 + True + True + + + 0 + 0 + 1 + 1 + + + + + checkbutton + True + True + False + False + 0 + True + + + 0 + 1 + 1 + 1 + + + + + checkbutton + True + False + True + False + False + 0 + True + True + + + 0 + 2 + 1 + 1 + + + + + checkbutton + True + False + True + False + False + 0 + True + + + 0 + 3 + 1 + 1 + + + + + radiobutton + True + True + False + False + 0 + True + True + + + 1 + 0 + 1 + 1 + + + + + radiobutton + True + True + False + False + 0 + True + True + radiobutton1 + + + 1 + 1 + 1 + 1 + + + + + radiobutton + True + False + True + False + False + 0 + True + True + + + 1 + 2 + 1 + 1 + + + + + radiobutton + True + False + True + False + False + 0 + True + True + radiobutton3 + + + 1 + 3 + 1 + 1 + + + + + False + False + 5 + + + + + False + False + 4 + 0 + + + + + True + False + vertical + + + False + True + 1 + + + + + 110 + True + False + vertical + 4 + + + togglebutton + True + True + True + False + + + False + False + 0 + + + + + togglebutton + True + False + True + True + False + + + False + False + 1 + + + + + togglebutton + True + True + True + False + True + + + False + False + 2 + + + + + togglebutton + True + False + True + True + False + True + + + False + False + 3 + + + + + True + False + liststore1 + 0 + + + + 2 + + + + + False + True + 5 + + + + + True + False + False + liststore1 + 1 + + + + 2 + + + + + False + False + 6 + + + + + True + True + True + False + + + False + False + 6 + + + + + True + True + True + False + #31316867a09f + + + False + True + 8 + + + + + True + False + + + False + True + 8 + + + + + False + False + 2 + + + + + True + False + vertical + + + False + True + 3 + + + + + True + False + vertical + 4 + + + True + False + vertical + 8 + True + + + True + False + 0.5 + + + False + False + 0 + + + + + True + False + 0.5 + True + + + False + False + 1 + + + + + False + False + 0 + + + + + True + False + + + True + False + True + vertical + True + + + True + True + adjustment1 + False + 75 + False + + + False + True + 0 + + + + + True + False + True + adjustment1 + False + 75 + False + + + False + True + 1 + + + + + True + True + 0 + + + + + False + False + 1 + + + + + True + False + True + + + True + False + True + 4 + + + True + False + vertical + 0.5 + + + False + True + 0 + + + + + True + False + vertical + 0.5 + True + + + False + True + 1 + + + + + False + False + 0 + + + + + True + False + True + 4 + + + 100 + True + True + vertical + adjustment1 + False + 75 + False + + + False + True + 0 + + + + + 100 + True + False + True + vertical + adjustment1 + False + 75 + False + + + False + True + 1 + + + + + False + False + 1 + + + + + True + True + 2 + + + + + True + False + vertical + + + True + False + + + link button + True + True + True + True + False + none + http://www.ubuntu.com + + + + + False + True + 0 + + + + + True + True + + + True + True + in + + + True + False + + + True + False + Lorem ipsum dolor sit amet, consectetur adipiscing elit. +Nullam fringilla, est ut feugiat ultrices, elit lacus ultricies nibh, id commodo tortor nisi id elit. +Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. +Morbi vel elit erat. Maecenas dignissim, dui et pharetra rutrum, tellus lectus rutrum mi, a convallis libero nisi quis tellus. +Nulla facilisi. Nullam eleifend lobortis nisl, in porttitor tellus malesuada vitae. +Aenean lacus tellus, pellentesque quis molestie quis, fringilla in arcu. +Duis elementum, tellus sed tristique semper, metus metus accumsan augue, et porttitor augue orci a libero. +Ut sed justo ac felis placerat laoreet sed id sem. Proin mattis tincidunt odio vitae tristique. +Morbi massa libero, congue vitae scelerisque vel, ultricies vel nisl. +Vestibulum in tortor diam, quis aliquet quam. Praesent ut justo neque, tempus rutrum est. +Duis eu lectus quam. Vivamus eget metus a mauris molestie venenatis pulvinar eleifend nisi. +Nulla facilisi. Pellentesque at dolor sit amet purus dapibus pulvinar molestie quis neque. +Suspendisse feugiat quam quis dolor accumsan cursus. + + + + + + + + + True + False + expander + + + + + False + True + 1 + + + + + False + True + 3 + + + + + False + False + 4 + + + + + True + False + vertical + + + False + True + 5 + + + + + True + False + vertical + True + + + True + False + 0 + in + + + True + False + 12 + + + + + + + + True + False + <b>In</b> + True + + + + + True + True + 0 + + + + + True + False + 0 + out + + + True + False + 12 + + + + + + + + True + False + <b>Out</b> + True + + + + + True + True + 1 + + + + + True + False + 0 + + + True + False + 12 + + + + + + + + True + False + <b>Etched out</b> + True + + + + + True + True + 2 + + + + + True + False + 0 + etched-out + + + True + False + 12 + + + + + + + + True + False + <b>Etched out</b> + True + + + + + True + True + 3 + + + + + True + True + 6 + + + + + True + False + vertical + + + False + True + 7 + + + + + True + False + vertical + 4 + + + 150 + True + True + always + in + + + True + True + liststore1 + False + 0 + + + + + + Cool + + + + 0 + + + + + + + Name + + + + 1 + + + + + + + Nick + + + + 2 + + + + + + + + + True + True + 0 + + + + + True + True + in + + + True + True + textbuffer1 + + + + + True + True + 1 + + + + + True + True + 6 + 8 + + + + + False + True + 10 + 2 + + + + + True + False + + + False + True + 3 + + + + + True + False + 5 + 5 + 5 + 10 + True + + + True + True + + + True + False + vertical + + + + + + + + True + False + page 1 + + + False + + + + + True + False + vertical + + + + + + 1 + + + + + True + False + page 2 + + + 1 + False + + + + + True + False + vertical + + + + + + 2 + + + + + True + False + page 3 + + + 2 + False + + + + + False + True + 0 + + + + + True + True + right + + + True + False + vertical + + + + + + + + True + False + page 1 + + + False + + + + + True + False + vertical + + + + + + 1 + + + + + True + False + page 2 + + + 1 + False + + + + + True + False + vertical + + + + + + 2 + + + + + True + False + page 3 + + + 2 + False + + + + + False + True + 1 + + + + + True + True + bottom + + + True + False + vertical + + + + + + + + True + False + page 1 + + + False + + + + + True + False + vertical + + + + + + 1 + + + + + True + False + page 2 + + + 1 + False + + + + + True + False + vertical + + + + + + 2 + + + + + True + False + page 3 + + + 2 + False + + + + + False + True + 2 + + + + + True + True + left + + + True + False + vertical + + + + + + + + True + False + page 1 + + + False + + + + + True + False + vertical + + + + + + 1 + + + + + True + False + page 2 + + + 1 + False + + + + + True + False + vertical + + + + + + 2 + + + + + True + False + page 3 + + + 2 + False + + + + + False + True + 3 + + + + + True + True + 4 + + + + + True + False + + + False + True + 5 + + + + + + -- 2.43.2