app/tests: Add single-window mode session files test

Rename and copy some session files and add a single-window mode
session files test.
This commit is contained in:
Martin Nordholts
2011-05-19 07:10:22 +02:00
parent e74d220930
commit f55f26c9b8
13 changed files with 340 additions and 18 deletions

View File

@ -10,6 +10,7 @@ test-layer-grouping*
test-save-and-export*
test-session-2-6-compatibility*
test-session-2-8-compatibility-multi-window*
test-session-2-8-compatibility-single-window*
test-tools*
test-ui*
test-window-management*

View File

@ -24,6 +24,7 @@ TESTS = \
test-save-and-export \
test-session-2-6-compatibility \
test-session-2-8-compatibility-multi-window \
test-session-2-8-compatibility-single-window \
test-tools \
test-ui \
test-xcf

View File

@ -163,7 +163,8 @@ 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)
const gchar *expected_dockrc,
gboolean single_window_mode)
{
Gimp *gimp;
GimpTestFileState initial_sessionrc_state = { NULL, NULL, { 0, 0 } };
@ -172,6 +173,7 @@ gimp_test_session_load_and_write_session_files (const gchar *loaded_sessionrc,
GimpTestFileState final_dockrc_state = { NULL, NULL, { 0, 0 } };
gchar *sessionrc_filename = NULL;
gchar *dockrc_filename = NULL;
gchar *gimprc_filename = NULL;
/* Make sure to run this before we use any GIMP functions */
gimp_test_utils_set_gimp2_directory ("GIMP_TESTING_ABS_TOP_SRCDIR",
@ -196,7 +198,15 @@ gimp_test_session_load_and_write_session_files (const gchar *loaded_sessionrc,
g_setenv ("GIMP_TESTING_DOCKRC_NAME", loaded_dockrc, TRUE /*overwrite*/);
/* Start up GIMP */
gimp = gimp_init_for_gui_testing (TRUE /*show_gui*/);
if (single_window_mode)
{
gimprc_filename =
g_build_filename (g_getenv ("GIMP_TESTING_ABS_TOP_SRCDIR"),
"app/tests/gimpdir/gimprc-single-window",
NULL);
}
gimp = gimp_init_for_gui_testing_with_rc (TRUE /*show_gui*/, gimprc_filename);
g_free (gimprc_filename);
/* Let the main loop run until idle to let things stabilize. This
* includes parsing sessionrc and dockrc

View File

@ -22,7 +22,8 @@
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);
const gchar *expected_dockrc,
gboolean single_window_mode);
#endif /* __GIMP_TEST_SESSION_UTILS_H__ */

View File

@ -8,9 +8,12 @@ EXTRA_DIST = \
dockrc-2-6 \
dockrc-2-8 \
dockrc-expected \
gimprc-single-window \
sessionrc \
sessionrc-2-6 \
sessionrc-2-8 \
sessionrc-expected \
sessionrc-2-8-multi-window \
sessionrc-2-8-single-window \
sessionrc-expected-2-6 \
sessionrc-expected-multi-window \
sessionrc-expected-single-window \
tags.xml

View File

@ -0,0 +1,12 @@
# GIMP gimprc
#
# This is your personal gimprc file. Any variable defined in this file takes
# precedence over the value defined in the system-wide gimprc:
# /home/martin/prefix/dev/etc/gimp/2.0/gimprc
# Most values can be set within GIMP by changing some options in the
# Preferences dialog.
(single-window-mode yes)
# end of gimprc

View File

@ -0,0 +1,60 @@
# 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-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 1285 750))
(session-info "toplevel"
(factory-entry "gimp-single-image-window")
(position 140 30)
(size 1050 770)
(open-on-exit)
(aux-info
(left-docks-width "80")
(right-docks-position "200"))
(gimp-toolbox
(side left))
(gimp-dock
(side right)
(book
(current-page 0)
(dockable "gimp-layer-list"
(tab-style icon)
(preview-size 32)))
(book
(position 380)
(current-page 0)
(dockable "gimp-brush-grid"
(tab-style preview))))
(gimp-dock
(side right)
(position 200)
(book
(current-page 0)
(dockable "gimp-tool-options"
(tab-style icon))))
(gimp-dock
(side right)
(position 550)
(book
(current-page 1)
(dockable "gimp-pattern-grid"
(tab-style preview))
(dockable "gimp-gradient-list"
(tab-style preview)))))
(last-tip-shown 0)
# end of sessionrc

View File

@ -0,0 +1,103 @@
# 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 445 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
(position 230)
(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)
(open-on-exit))
(session-info "toplevel"
(factory-entry "gimp-single-image-window")
(position 10 40)
(size 900 600))
(last-tip-shown 0)
# end of sessionrc

View File

@ -0,0 +1,60 @@
# 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-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 1285 750))
(session-info "toplevel"
(factory-entry "gimp-single-image-window")
(position 140 30)
(size 1050 770)
(open-on-exit)
(aux-info
(left-docks-width "80")
(right-docks-position "200"))
(gimp-toolbox
(side left))
(gimp-dock
(side right)
(book
(current-page 0)
(dockable "gimp-layer-list"
(tab-style icon)
(preview-size 32)))
(book
(position 380)
(current-page 0)
(dockable "gimp-brush-grid"
(tab-style preview))))
(gimp-dock
(side right)
(position 200)
(book
(current-page 0)
(dockable "gimp-tool-options"
(tab-style icon))))
(gimp-dock
(side right)
(position 550)
(book
(current-page 1)
(dockable "gimp-pattern-grid"
(tab-style preview))
(dockable "gimp-gradient-list"
(tab-style preview)))))
(last-tip-shown 0)
# end of sessionrc

View File

@ -53,7 +53,8 @@ read_and_write_session_files (GimpTestFixture *fixture,
gimp_test_session_load_and_write_session_files ("sessionrc-2-6",
"dockrc-2-6",
"sessionrc-expected-2-6",
"dockrc-expected");
"dockrc-expected",
FALSE /*single_window_mode*/);
}
int main(int argc, char **argv)

View File

@ -43,17 +43,18 @@ typedef struct
/**
* Tests that a multi-window sessionrc in GIMP 2.8 format is loaded
* Tests that a single-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",
gimp_test_session_load_and_write_session_files ("sessionrc-2-8-multi-window",
"dockrc-2-8",
"sessionrc-expected",
"dockrc-expected");
"sessionrc-expected-multi-window",
"dockrc-expected",
FALSE /*single_window_mode*/);
}
int main(int argc, char **argv)

View File

@ -0,0 +1,69 @@
/* 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-single-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-single-window",
"dockrc-2-8",
"sessionrc-expected-single-window",
"dockrc-expected",
TRUE /*single_window_mode*/);
}
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 ();
}