[gimp] app/tests: Add test for GIMP 2.8 multi window session files



commit 87e69d23122cef7c145a4d2e0bc619034183ca46
Author: Martin Nordholts <martinn src gnome org>
Date:   Wed May 18 21:06:20 2011 +0200

    app/tests: Add test for GIMP 2.8 multi window session files
    
    Move code in test-session-management.c to a common place so we can
    have several variants of session management tests. We can't easily run
    all session management tests in a single process, because some parts
    of Gimp (the GObject) initialization eeks if done twice in the same
    process.
    
    Rename test-session-management.c to test-session-2-6-compatibility.c
    and create a new test for GIMP 2.8 multi-window mode session files,
    namely test-session-2-8-compatibility-multi-window.c. Copy and rename
    sessionrc files accordingly.

 app/tests/.gitignore                               |    3 +-
 app/tests/Makefile.am                              |   20 ++--
 ...sion-management.c => gimp-test-session-utils.c} |   64 ++++++-------
 app/tests/gimp-test-session-utils.h                |   28 ++++++
 app/tests/gimpdir/dockrc                           |    2 +
 app/tests/gimpdir/dockrc-2-6                       |   42 ++++++++
 app/tests/gimpdir/dockrc-2-8                       |   44 +++++++++
 app/tests/gimpdir/sessionrc                        |   39 ++++----
 app/tests/gimpdir/sessionrc-2-6                    |  100 +++++++++++++++++++
 app/tests/gimpdir/sessionrc-2-8                    |  101 ++++++++++++++++++++
 app/tests/test-session-2-6-compatibility.c         |   68 +++++++++++++
 .../test-session-2-8-compatibility-multi-window.c  |   68 +++++++++++++
 12 files changed, 517 insertions(+), 62 deletions(-)
---
diff --git a/app/tests/.gitignore b/app/tests/.gitignore
index 0a4e9b2..0abb305 100644
--- a/app/tests/.gitignore
+++ b/app/tests/.gitignore
@@ -8,7 +8,8 @@ test-core*
 test-gimpidtable*
 test-layer-grouping*
 test-save-and-export*
-test-session-management*
+test-session-2-6-compatibility*
+test-session-2-8-compatibility-multi-window*
 test-tools*
 test-ui*
 test-window-management*
diff --git a/app/tests/Makefile.am b/app/tests/Makefile.am
index 13b49d2..8a97e5b 100644
--- a/app/tests/Makefile.am
+++ b/app/tests/Makefile.am
@@ -19,15 +19,15 @@ endif
 
 
 TESTS = \
-	test-core		\
-	test-gimpidtable	\
-	test-save-and-export	\
-	test-session-management	\
-	test-tools		\
-	test-ui			\
+	test-core					\
+	test-gimpidtable				\
+	test-save-and-export				\
+	test-session-2-6-compatibility			\
+	test-session-2-8-compatibility-multi-window	\
+	test-tools					\
+	test-ui					\
 	test-xcf
 
-
 EXTRA_PROGRAMS = $(TESTS)
 CLEANFILES = $(EXTRA_PROGRAMS)
 
@@ -35,8 +35,10 @@ $(TESTS): gimpdir-output
 
 noinst_LIBRARIES = libgimpapptestutils.a
 libgimpapptestutils_a_SOURCES = \
-	gimp-app-test-utils.c	\
-	gimp-app-test-utils.h
+	gimp-app-test-utils.c		\
+	gimp-app-test-utils.h		\
+	gimp-test-session-utils.c	\
+	gimp-test-session-utils.h
 
 libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
 libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
diff --git a/app/tests/test-session-management.c b/app/tests/gimp-test-session-utils.c
similarity index 81%
rename from app/tests/test-session-management.c
rename to app/tests/gimp-test-session-utils.c
index ec9d04b..1e41023 100644
--- a/app/tests/test-session-management.c
+++ b/app/tests/gimp-test-session-utils.c
@@ -1,5 +1,5 @@
 /* GIMP - The GNU Image Manipulation Program
- * Copyright (C) 2009 Martin Nordholts
+ * Copyright (C) 2011 Martin Nordholts <martinn src gnome org>
  *
  * 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
@@ -15,6 +15,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "config.h"
+
 #include <gegl.h>
 #include <glib/gstdio.h>
 #include <gtk/gtk.h>
@@ -35,24 +37,11 @@
 #include "tests.h"
 
 #include "gimp-app-test-utils.h"
-
-
-#define ADD_TEST(function) \
-  g_test_add ("/gimp-session-management/" #function, \
-              GimpTestFixture, \
-              NULL, \
-              NULL, \
-              function, \
-              NULL);
+#include "gimp-test-session-utils.h"
 
 
 typedef struct
 {
-  int dummy;
-} GimpTestFixture;
-
-typedef struct
-{
   gchar    *filename;
   gchar    *md5;
   GTimeVal  modtime;
@@ -157,12 +146,24 @@ gimp_test_file_state_changes (const gchar       *filename,
 }
 
 /**
- * Tests that a sessionrc from GIMP 2.6 is loaded and written (thus
- * also interpreted) like we expect.
+ * gimp_test_session_load_and_write_session_files:
+ * @loaded_sessionrc:   The name of the file of the sessionrc file to
+ *                      load
+ * @loaded_dockrc:      The name of the file of the dockrc file to load
+ * @expected_sessionrc: The name of the file with the expected
+ *                      sessionrc file content
+ * @expected_dockrc:    The name of the file with the expected dockrc
+ *                      file content
+ *
+ * Utility function for the various session management tests. We can't
+ * easily have all those tests in a single program several Gimp
+ * instance can't easily be initialized in the same process.
  **/
-static void
-session_2_6_compatibility (GimpTestFixture *fixture,
-                           gconstpointer    data)
+void
+gimp_test_session_load_and_write_session_files (const gchar *loaded_sessionrc,
+                                                const gchar *loaded_dockrc,
+                                                const gchar *expected_sessionrc,
+                                                const gchar *expected_dockrc)
 {
   Gimp              *gimp;
   GimpTestFileState  initial_sessionrc_state = { NULL, NULL, { 0, 0 } };
@@ -181,8 +182,8 @@ session_2_6_compatibility (GimpTestFixture *fixture,
    * the read file, which is why we check the MD5 of the -expected
    * variant
    */
-  sessionrc_filename = gimp_personal_rc_file ("sessionrc-expected");
-  dockrc_filename    = gimp_personal_rc_file ("dockrc-expected");
+  sessionrc_filename = gimp_personal_rc_file (expected_sessionrc);
+  dockrc_filename    = gimp_personal_rc_file (expected_dockrc);
 
   /* Remeber the modtimes and MD5s */
   g_assert (gimp_test_get_file_state_verbose (sessionrc_filename,
@@ -190,6 +191,10 @@ session_2_6_compatibility (GimpTestFixture *fixture,
   g_assert (gimp_test_get_file_state_verbose (dockrc_filename,
                                               &initial_dockrc_state));
 
+  /* Use specific input files when restoring the session */
+  g_setenv ("GIMP_TESTING_SESSIONRC_NAME", loaded_sessionrc, TRUE /*overwrite*/);
+  g_setenv ("GIMP_TESTING_DOCKRC_NAME", loaded_dockrc, TRUE /*overwrite*/);
+
   /* Start up GIMP */
   gimp = gimp_init_for_gui_testing (TRUE /*show_gui*/);
 
@@ -205,6 +210,10 @@ session_2_6_compatibility (GimpTestFixture *fixture,
    */
   gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_BUILDDIR",
                                        "app/tests/gimpdir-output");
+  /* Use normal output names */
+  g_unsetenv ("GIMP_TESTING_SESSIONRC_NAME");
+  g_unsetenv ("GIMP_TESTING_DOCKRC_NAME");
+
   g_free (sessionrc_filename);
   g_free (dockrc_filename);
   sessionrc_filename = gimp_personal_rc_file ("sessionrc");
@@ -232,14 +241,3 @@ session_2_6_compatibility (GimpTestFixture *fixture,
                                           &initial_dockrc_state,
                                           &final_dockrc_state));
 }
-
-int main(int argc, char **argv)
-{
-  gimp_test_bail_if_no_display ();
-  gtk_test_init (&argc, &argv, NULL);
-
-  ADD_TEST (session_2_6_compatibility);
-
-  /* Don't bother freeing stuff, the process is short-lived */
-  return g_test_run ();
-}
diff --git a/app/tests/gimp-test-session-utils.h b/app/tests/gimp-test-session-utils.h
new file mode 100644
index 0000000..32b6c21
--- /dev/null
+++ b/app/tests/gimp-test-session-utils.h
@@ -0,0 +1,28 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 2009 Martin Nordholts <martinn src gnome org>
+ *
+ * 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/>.
+ */
+
+#ifndef __GIMP_TEST_SESSION_UTILS_H__
+#define __GIMP_TEST_SESSION_UTILS_H__
+
+
+void gimp_test_session_load_and_write_session_files (const gchar *loaded_sessionrc,
+                                                     const gchar *loaded_dockrc,
+                                                     const gchar *expected_sessionrc,
+                                                     const gchar *expected_dockrc);
+
+
+#endif /* __GIMP_TEST_SESSION_UTILS_H__ */
diff --git a/app/tests/gimpdir/dockrc b/app/tests/gimpdir/dockrc
index 14fbda4..fc7b255 100644
--- a/app/tests/gimpdir/dockrc
+++ b/app/tests/gimpdir/dockrc
@@ -1,6 +1,7 @@
 # recently closed docks
 
 (GimpSessionInfo "Palettes - FG/BG - Images"
+    (factory-entry "gimp-dock-window")
     (position 585 115)
     (size 200 575)
     (open-on-exit)
@@ -25,6 +26,7 @@
             (dockable "gimp-image-list"
                 (tab-style preview)))))
 (GimpSessionInfo "Selection, Fonts"
+    (factory-entry "gimp-dock-window")
     (position 200 180)
     (size 200 300)
     (open-on-exit)
diff --git a/app/tests/gimpdir/dockrc-2-6 b/app/tests/gimpdir/dockrc-2-6
new file mode 100644
index 0000000..14fbda4
--- /dev/null
+++ b/app/tests/gimpdir/dockrc-2-6
@@ -0,0 +1,42 @@
+# recently closed docks
+
+(GimpSessionInfo "Palettes - FG/BG - Images"
+    (position 585 115)
+    (size 200 575)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "false")
+        (follow-active-image "true"))
+    (gimp-dock
+        (book
+            (current-page 0)
+            (dockable "gimp-palette-list"
+                (tab-style preview)))
+        (book
+            (position 140)
+            (current-page 0)
+            (dockable "gimp-color-editor"
+                (tab-style preview)
+                (aux-info
+                    (current-page "GimpColorSelect"))))
+        (book
+            (position 415)
+            (current-page 0)
+            (dockable "gimp-image-list"
+                (tab-style preview)))))
+(GimpSessionInfo "Selection, Fonts"
+    (position 200 180)
+    (size 200 300)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "false")
+        (follow-active-image "true"))
+    (gimp-dock
+        (book
+            (current-page 1)
+            (dockable "gimp-selection-editor"
+                (tab-style icon))
+            (dockable "gimp-font-list"
+                (tab-style preview)))))
+
+# end of recently closed docks
diff --git a/app/tests/gimpdir/dockrc-2-8 b/app/tests/gimpdir/dockrc-2-8
new file mode 100644
index 0000000..fc7b255
--- /dev/null
+++ b/app/tests/gimpdir/dockrc-2-8
@@ -0,0 +1,44 @@
+# recently closed docks
+
+(GimpSessionInfo "Palettes - FG/BG - Images"
+    (factory-entry "gimp-dock-window")
+    (position 585 115)
+    (size 200 575)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "false")
+        (follow-active-image "true"))
+    (gimp-dock
+        (book
+            (current-page 0)
+            (dockable "gimp-palette-list"
+                (tab-style preview)))
+        (book
+            (position 140)
+            (current-page 0)
+            (dockable "gimp-color-editor"
+                (tab-style preview)
+                (aux-info
+                    (current-page "GimpColorSelect"))))
+        (book
+            (position 415)
+            (current-page 0)
+            (dockable "gimp-image-list"
+                (tab-style preview)))))
+(GimpSessionInfo "Selection, Fonts"
+    (factory-entry "gimp-dock-window")
+    (position 200 180)
+    (size 200 300)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "false")
+        (follow-active-image "true"))
+    (gimp-dock
+        (book
+            (current-page 1)
+            (dockable "gimp-selection-editor"
+                (tab-style icon))
+            (dockable "gimp-font-list"
+                (tab-style preview)))))
+
+# end of recently closed docks
diff --git a/app/tests/gimpdir/sessionrc b/app/tests/gimpdir/sessionrc
index 3222cc1..94c4703 100644
--- a/app/tests/gimpdir/sessionrc
+++ b/app/tests/gimpdir/sessionrc
@@ -5,63 +5,67 @@
 # of course you can do.  The sessionrc will be entirely rewritten every time
 # you quit GIMP.  If this file isn't found, defaults are used.
 
-(session-info "dock" "dock"
+(session-info "toplevel"
+    (factory-entry "gimp-dock-window")
     (position 565 170)
     (size 210 535)
     (open-on-exit)
     (aux-info
         (show-image-menu "false")
         (follow-active-image "true"))
-    (dock
+    (gimp-dock
         (book
             (current-page 0)
             (dockable "gimp-layer-list"
                 (tab-style icon)
                 (preview-size 32)))
         (book
-            (position 289)
+            (position 290)
             (current-page 0)
             (dockable "gimp-brush-grid"
                 (tab-style preview)))))
-(session-info "dock" "dock"
+(session-info "toplevel"
+    (factory-entry "gimp-dock-window")
     (position 140 290)
     (size 405 300)
     (open-on-exit)
     (aux-info
         (show-image-menu "false")
         (follow-active-image "true"))
-    (dock
+    (gimp-dock
         (book
             (current-page 0)
             (dockable "gimp-tool-options"
                 (tab-style icon))))
-    (dock
+    (gimp-dock
         (book
             (current-page 0)
             (dockable "gimp-device-status"
                 (tab-style icon)))))
-(session-info "dock" "dock"
+(session-info "toplevel"
+    (factory-entry "gimp-dock-window")
     (position 795 45)
     (size 200 265)
     (open-on-exit)
     (aux-info
         (show-image-menu "true")
         (follow-active-image "true"))
-    (dock
+    (gimp-dock
         (book
             (current-page 1)
             (dockable "gimp-pattern-grid"
                 (tab-style preview))
             (dockable "gimp-gradient-list"
                 (tab-style preview)))))
-(session-info "dock" "dock"
+(session-info "toplevel"
+    (factory-entry "gimp-dock-window")
     (position 805 345)
     (size 200 450)
     (open-on-exit)
     (aux-info
         (show-image-menu "true")
         (follow-active-image "true"))
-    (dock
+    (gimp-dock
         (book
             (current-page 0)
             (dockable "gimp-channel-list"
@@ -76,18 +80,15 @@
                     (edit-active "true")
                     (current-data "Standard")
                     (zoom-factor "2.80"))))))
-# Enable this when we have a way to handle that the toolbox size is
-# likely to change due to the use of GDK_HINT_RESIZE_INC
-# (session-info "toolbox" "dock"
-#     (position 15 35)
-#     (size 95 620)
-#     (open-on-exit))
-(session-info "toplevel" "gimp-file-open-dialog"
+(session-info "toplevel"
+    (factory-entry "gimp-file-open-dialog")
     (position 390 140)
     (size 900 815))
-(session-info "toplevel" "gimp-image-new-dialog"
+(session-info "toplevel"
+    (factory-entry "gimp-image-new-dialog")
     (position 100 100))
-(session-info "display" "gimp-empty-image-window"
+(session-info "toplevel"
+    (factory-entry "gimp-empty-image-window")
     (position 140 30)
     (size 610 190))
 (session-info "toplevel"
diff --git a/app/tests/gimpdir/sessionrc-2-6 b/app/tests/gimpdir/sessionrc-2-6
new file mode 100644
index 0000000..3222cc1
--- /dev/null
+++ b/app/tests/gimpdir/sessionrc-2-6
@@ -0,0 +1,100 @@
+# GIMP sessionrc
+# 
+# This file takes session-specific info (that is info, you want to keep
+# between two GIMP sessions).  You are not supposed to edit it manually, but
+# of course you can do.  The sessionrc will be entirely rewritten every time
+# you quit GIMP.  If this file isn't found, defaults are used.
+
+(session-info "dock" "dock"
+    (position 565 170)
+    (size 210 535)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "false")
+        (follow-active-image "true"))
+    (dock
+        (book
+            (current-page 0)
+            (dockable "gimp-layer-list"
+                (tab-style icon)
+                (preview-size 32)))
+        (book
+            (position 289)
+            (current-page 0)
+            (dockable "gimp-brush-grid"
+                (tab-style preview)))))
+(session-info "dock" "dock"
+    (position 140 290)
+    (size 405 300)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "false")
+        (follow-active-image "true"))
+    (dock
+        (book
+            (current-page 0)
+            (dockable "gimp-tool-options"
+                (tab-style icon))))
+    (dock
+        (book
+            (current-page 0)
+            (dockable "gimp-device-status"
+                (tab-style icon)))))
+(session-info "dock" "dock"
+    (position 795 45)
+    (size 200 265)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "true")
+        (follow-active-image "true"))
+    (dock
+        (book
+            (current-page 1)
+            (dockable "gimp-pattern-grid"
+                (tab-style preview))
+            (dockable "gimp-gradient-list"
+                (tab-style preview)))))
+(session-info "dock" "dock"
+    (position 805 345)
+    (size 200 450)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "true")
+        (follow-active-image "true"))
+    (dock
+        (book
+            (current-page 0)
+            (dockable "gimp-channel-list"
+                (tab-style automatic)
+                (preview-size 32)))
+        (book
+            (position 200)
+            (current-page 0)
+            (dockable "gimp-palette-editor"
+                (tab-style icon)
+                (aux-info
+                    (edit-active "true")
+                    (current-data "Standard")
+                    (zoom-factor "2.80"))))))
+# Enable this when we have a way to handle that the toolbox size is
+# likely to change due to the use of GDK_HINT_RESIZE_INC
+# (session-info "toolbox" "dock"
+#     (position 15 35)
+#     (size 95 620)
+#     (open-on-exit))
+(session-info "toplevel" "gimp-file-open-dialog"
+    (position 390 140)
+    (size 900 815))
+(session-info "toplevel" "gimp-image-new-dialog"
+    (position 100 100))
+(session-info "display" "gimp-empty-image-window"
+    (position 140 30)
+    (size 610 190))
+(session-info "toplevel"
+    (factory-entry "gimp-single-image-window")
+    (position 10 40)
+    (size 900 600))
+
+(last-tip-shown 0)
+
+# end of sessionrc
diff --git a/app/tests/gimpdir/sessionrc-2-8 b/app/tests/gimpdir/sessionrc-2-8
new file mode 100644
index 0000000..94c4703
--- /dev/null
+++ b/app/tests/gimpdir/sessionrc-2-8
@@ -0,0 +1,101 @@
+# GIMP sessionrc
+# 
+# This file takes session-specific info (that is info, you want to keep
+# between two GIMP sessions).  You are not supposed to edit it manually, but
+# of course you can do.  The sessionrc will be entirely rewritten every time
+# you quit GIMP.  If this file isn't found, defaults are used.
+
+(session-info "toplevel"
+    (factory-entry "gimp-dock-window")
+    (position 565 170)
+    (size 210 535)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "false")
+        (follow-active-image "true"))
+    (gimp-dock
+        (book
+            (current-page 0)
+            (dockable "gimp-layer-list"
+                (tab-style icon)
+                (preview-size 32)))
+        (book
+            (position 290)
+            (current-page 0)
+            (dockable "gimp-brush-grid"
+                (tab-style preview)))))
+(session-info "toplevel"
+    (factory-entry "gimp-dock-window")
+    (position 140 290)
+    (size 405 300)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "false")
+        (follow-active-image "true"))
+    (gimp-dock
+        (book
+            (current-page 0)
+            (dockable "gimp-tool-options"
+                (tab-style icon))))
+    (gimp-dock
+        (book
+            (current-page 0)
+            (dockable "gimp-device-status"
+                (tab-style icon)))))
+(session-info "toplevel"
+    (factory-entry "gimp-dock-window")
+    (position 795 45)
+    (size 200 265)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "true")
+        (follow-active-image "true"))
+    (gimp-dock
+        (book
+            (current-page 1)
+            (dockable "gimp-pattern-grid"
+                (tab-style preview))
+            (dockable "gimp-gradient-list"
+                (tab-style preview)))))
+(session-info "toplevel"
+    (factory-entry "gimp-dock-window")
+    (position 805 345)
+    (size 200 450)
+    (open-on-exit)
+    (aux-info
+        (show-image-menu "true")
+        (follow-active-image "true"))
+    (gimp-dock
+        (book
+            (current-page 0)
+            (dockable "gimp-channel-list"
+                (tab-style automatic)
+                (preview-size 32)))
+        (book
+            (position 200)
+            (current-page 0)
+            (dockable "gimp-palette-editor"
+                (tab-style icon)
+                (aux-info
+                    (edit-active "true")
+                    (current-data "Standard")
+                    (zoom-factor "2.80"))))))
+(session-info "toplevel"
+    (factory-entry "gimp-file-open-dialog")
+    (position 390 140)
+    (size 900 815))
+(session-info "toplevel"
+    (factory-entry "gimp-image-new-dialog")
+    (position 100 100))
+(session-info "toplevel"
+    (factory-entry "gimp-empty-image-window")
+    (position 140 30)
+    (size 610 190))
+(session-info "toplevel"
+    (factory-entry "gimp-single-image-window")
+    (position 10 40)
+    (size 900 600))
+
+(last-tip-shown 0)
+
+# end of sessionrc
diff --git a/app/tests/test-session-2-6-compatibility.c b/app/tests/test-session-2-6-compatibility.c
new file mode 100644
index 0000000..607b919
--- /dev/null
+++ b/app/tests/test-session-2-6-compatibility.c
@@ -0,0 +1,68 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 2011 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 "config.h"
+
+#include <gtk/gtk.h>
+
+#include "dialogs/dialogs-types.h"
+
+#include "tests.h"
+
+#include "gimp-test-session-utils.h"
+#include "gimp-app-test-utils.h"
+
+
+#define ADD_TEST(function) \
+  g_test_add ("/gimp-session-2-6-compatibility/" #function, \
+              GimpTestFixture, \
+              NULL, \
+              NULL, \
+              function, \
+              NULL);
+
+
+typedef struct
+{
+  int dummy;
+} GimpTestFixture;
+
+
+/**
+ * Tests that a sessionrc and dockrc from GIMP 2.6 is loaded and
+ * written (thus also interpreted) like we expect.
+ **/
+static void
+read_and_write_session_files (GimpTestFixture *fixture,
+                              gconstpointer    data)
+{
+  gimp_test_session_load_and_write_session_files ("sessionrc-2-6",
+                                                  "dockrc-2-6",
+                                                  "sessionrc-expected",
+                                                  "dockrc-expected");
+}
+
+int main(int argc, char **argv)
+{
+  gimp_test_bail_if_no_display ();
+  gtk_test_init (&argc, &argv, NULL);
+
+  ADD_TEST (read_and_write_session_files);
+
+  /* Don't bother freeing stuff, the process is short-lived */
+  return g_test_run ();
+}
diff --git a/app/tests/test-session-2-8-compatibility-multi-window.c b/app/tests/test-session-2-8-compatibility-multi-window.c
new file mode 100644
index 0000000..e0b02a3
--- /dev/null
+++ b/app/tests/test-session-2-8-compatibility-multi-window.c
@@ -0,0 +1,68 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 2011 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 "config.h"
+
+#include <gtk/gtk.h>
+
+#include "dialogs/dialogs-types.h"
+
+#include "tests.h"
+
+#include "gimp-test-session-utils.h"
+#include "gimp-app-test-utils.h"
+
+
+#define ADD_TEST(function) \
+  g_test_add ("/gimp-session-2-8-compatibility-multi-window/" #function, \
+              GimpTestFixture, \
+              NULL, \
+              NULL, \
+              function, \
+              NULL);
+
+
+typedef struct
+{
+  int dummy;
+} GimpTestFixture;
+
+
+/**
+ * Tests that a multi-window sessionrc in GIMP 2.8 format is loaded
+ * and written (thus also interpreted) like we expect.
+ **/
+static void
+read_and_write_session_files (GimpTestFixture *fixture,
+                          gconstpointer    data)
+{
+  gimp_test_session_load_and_write_session_files ("sessionrc-2-8",
+                                                  "dockrc-2-8",
+                                                  "sessionrc-expected",
+                                                  "dockrc-expected");
+}
+
+int main(int argc, char **argv)
+{
+  gimp_test_bail_if_no_display ();
+  gtk_test_init (&argc, &argv, NULL);
+
+  ADD_TEST (read_and_write_session_files);
+
+  /* Don't bother freeing stuff, the process is short-lived */
+  return g_test_run ();
+}



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