[gimp] app: Add regression test for window roles



commit 810f325a162b500901445b4d82a48b472ff1cd9e
Author: Martin Nordholts <martinn src gnome org>
Date:   Tue Sep 8 19:32:39 2009 +0200

    app: Add regression test for window roles

 app/tests/.gitignore               |    1 +
 app/tests/Makefile.am              |   35 +++++++++++--
 app/tests/test-window-management.c |   94 ++++++++++++++++++++++++++++++++++++
 3 files changed, 124 insertions(+), 6 deletions(-)
---
diff --git a/app/tests/.gitignore b/app/tests/.gitignore
index 1abeb1e..64c9614 100644
--- a/app/tests/.gitignore
+++ b/app/tests/.gitignore
@@ -3,3 +3,4 @@
 /Makefile.in
 /test-layer-grouping*
 /test-layers*
+/test-window-management*
diff --git a/app/tests/Makefile.am b/app/tests/Makefile.am
index 55fdac9..0a0fa71 100644
--- a/app/tests/Makefile.am
+++ b/app/tests/Makefile.am
@@ -1,12 +1,17 @@
+# Don't mess with user's dir
+TESTS_ENVIRONMENT = \
+	GIMP2_DIRECTORY=/tmp/gimp-testing
+
 TESTS = \
 	test-layers		\
+	test-window-management	\
 	test-layer-grouping
 
 EXTRA_PROGRAMS = $(TESTS)
 
-test_layers_SOURCES = test-layers.c
-
-test_layer_grouping_SOURCES = test-layer-grouping.c
+test_layers_SOURCES            = test-layers.c
+test_layer_grouping_SOURCES    = test-layer-grouping.c
+test_window_management_SOURCES = test-window-management.c
 
 libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
 libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
@@ -20,7 +25,8 @@ AM_CPPFLAGS = \
 	-I$(top_srcdir)		\
 	-I$(top_srcdir)/app	\
 	$(PANGOCAIRO_CFLAGS)	\
-	$(GDK_PIXBUF_CFLAGS)	\
+	$(GTK_CFLAGS)		\
+	$(DBUS_GLIB_CFLAGS)	\
 	$(GEGL_CFLAGS)		\
 	-I$(includedir)
 
@@ -32,16 +38,31 @@ AM_LDFLAGS = \
 	-u $(SYMPREFIX)internal_procs_init		\
 	-u $(SYMPREFIX)gimp_plug_in_manager_restore	\
 	-u $(SYMPREFIX)gimp_pdb_compat_param_spec	\
+	-u $(SYMPREFIX)gui_init				\
 	-u $(SYMPREFIX)plug_in_icc_profile_apply_rgb	\
 	-u $(SYMPREFIX)gimp_image_map_config_get_type	\
 	-u $(SYMPREFIX)gimp_vectors_undo_get_type	\
 	-u $(SYMPREFIX)gimp_vectors_mod_undo_get_type	\
 	-u $(SYMPREFIX)gimp_vectors_prop_undo_get_type	\
+	-u $(SYMPREFIX)actions_init			\
+	-u $(SYMPREFIX)gimp_error_dialog_new		\
+	-u $(SYMPREFIX)menus_save			\
+	-u $(SYMPREFIX)gimp_tools_save			\
 	-u $(SYMPREFIX)gimp_curve_map_pixels
 
+# Note that we have some duplicate entries here too to work around
+# circular dependencies and systems on the same architectural layer as
+# an alternative to LDFLAGS above
 LDADD = \
+	$(top_builddir)/app/dialogs/preferences-dialog.o	\
+	$(top_builddir)/app/gui/libappgui.a			\
+	$(top_builddir)/app/tools/libapptools.a			\
+	$(top_builddir)/app/dialogs/libappdialogs.a		\
+	$(top_builddir)/app/menus/libappmenus.a			\
+	$(top_builddir)/app/actions/libappactions.a		\
+	$(top_builddir)/app/dialogs/libappdialogs.a		\
 	$(top_builddir)/app/display/libappdisplay.a		\
-	$(top_builddir)/app/widgets/widgets-enums.o		\
+	$(top_builddir)/app/widgets/libappwidgets.a		\
 	$(top_builddir)/app/xcf/libappxcf.a			\
 	$(top_builddir)/app/pdb/libappinternal-procs.a		\
 	$(top_builddir)/app/pdb/libapppdb.a			\
@@ -54,10 +75,10 @@ LDADD = \
 	$(top_builddir)/app/composite/libappcomposite.a		\
 	$(top_builddir)/app/gegl/libappgegl.a			\
 	$(top_builddir)/app/config/libappconfig.a		\
-	$(top_builddir)/app/display/libappdisplay.a		\
 	$(top_builddir)/app/paint-funcs/libapppaint-funcs.a	\
 	$(top_builddir)/app/base/libappbase.a			\
 	$(top_builddir)/app/libapp.a				\
+	$(libgimpwidgets)					\
 	$(libgimpconfig)					\
 	$(libgimpmath)						\
 	$(libgimpthumb)						\
@@ -65,6 +86,8 @@ LDADD = \
 	$(libgimpmodule)					\
 	$(libgimpbase)						\
 	$(GIMPICONRC)						\
+	$(GTK_LIBS)						\
+	$(DBUS_GLIB_LIBS)					\
 	$(GDK_PIXBUF_LIBS)					\
 	$(FREETYPE_LIBS)					\
 	$(FONTCONFIG_LIBS)					\
diff --git a/app/tests/test-window-management.c b/app/tests/test-window-management.c
new file mode 100644
index 0000000..0d7ba5d
--- /dev/null
+++ b/app/tests/test-window-management.c
@@ -0,0 +1,94 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 2009 Martin Nordholts
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "dialogs/dialogs-types.h"
+
+#include "dialogs/dialogs.h"
+
+#include "widgets/gimpdialogfactory.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontext.h"
+
+#include "tests.h"
+
+
+typedef struct
+{
+  int dummy;
+} GimpTestFixture;
+
+
+static void gimp_test_window_roles   (GimpTestFixture *fixture,
+                                      gconstpointer    data);
+
+
+static Gimp *gimp = NULL;
+
+
+int main(int argc, char **argv)
+{
+  g_type_init ();
+  gtk_init (&argc, &argv);
+  g_test_init (&argc, &argv, NULL);
+
+  /* We share the same application instance across all tests */
+  gimp = gimp_init_for_gui_testing (FALSE);
+
+  /* Setup the tests */
+  g_test_add ("/gimp-window-management/window-roles",
+              GimpTestFixture,
+              NULL,
+              NULL,
+              gimp_test_window_roles,
+              NULL);
+
+  /* Run the tests and return status */
+  return g_test_run ();
+}
+
+/**
+ * gimp_test_window_roles:
+ * @fixture:
+ * @data:
+ *
+ * Makes sure that different windows have the right roles specified.
+ **/
+static void
+gimp_test_window_roles (GimpTestFixture *fixture,
+                        gconstpointer    data)
+{
+  GtkWidget *dock    = gimp_dialog_factory_dock_new (global_dock_factory,
+                                                     gdk_screen_get_default ());
+  GtkWidget *toolbox = gimp_dialog_factory_dock_new (global_toolbox_factory,
+                                                     gdk_screen_get_default ());
+
+  g_assert_cmpstr (gtk_window_get_role (GTK_WINDOW (toolbox)), ==,
+                   "gimp-toolbox");
+  g_assert_cmpstr (gtk_window_get_role (GTK_WINDOW (dock)), ==,
+                   "gimp-dock");
+
+  /* When we get here we have a ref count of one, but the signals we
+   * emit cause the reference count to become less than zero for some
+   * reason. So we're lazy and simply ignore to unref these
+  g_object_unref (toolbox);
+  g_object_unref (dock);
+   */
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]