summaryrefslogtreecommitdiff
path: root/test/test-page-manager.c
diff options
context:
space:
mode:
authormatt <mattdangerw@gmail.com>2013-05-14 17:22:00 -0700
committerMatt Watson <mattdangerw@gmail.com>2013-05-29 14:38:07 -0700
commit3ea04fe6d3253f1ca698a313e24eb3d5aeac3948 (patch)
tree0532b9072832cbb922643fbb68a0dcbc9e700140 /test/test-page-manager.c
parentc013139ca14f93b420dbc819103367e1596c0c0e (diff)
Added transition type and duration props to page manager.
These just wrap the functionality of GtkStack. Added some dropdowns in the app-window.js to try the different transition options and some simple c tests. [endlessm/eos-sdk#61]
Diffstat (limited to 'test/test-page-manager.c')
-rw-r--r--test/test-page-manager.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/test-page-manager.c b/test/test-page-manager.c
index 46ac768..4122d7e 100644
--- a/test/test-page-manager.c
+++ b/test/test-page-manager.c
@@ -23,6 +23,9 @@
#define ADD_EMPTY_PAGE_MANAGER_TEST(path, test_func) \
g_test_add ((path), PageManagerFixture, NULL, \
empty_pm_fixture_setup, (test_func), pm_fixture_teardown);
+#define DURATION_DEFAULT 200
+#define DURATION_1 1
+#define DURATION_2 9999
typedef struct
{
@@ -458,6 +461,50 @@ test_pm_duplicate_page_name (PageManagerFixture *fixture,
}
static void
+test_pm_prop_transition_duration (PageManagerFixture *fixture,
+ gconstpointer unused)
+{
+ guint duration;
+ g_object_get (fixture->pm, "transition-duration", &duration, NULL);
+ g_assert (duration == DURATION_DEFAULT);
+ g_object_set (fixture->pm, "transition-duration", DURATION_2, NULL);
+ g_object_get (fixture->pm, "transition-duration", &duration, NULL);
+ g_assert (duration == DURATION_2);
+}
+
+static void
+test_pm_get_set_transition_duration (PageManagerFixture *fixture,
+ gconstpointer unused)
+{
+ g_assert (DURATION_DEFAULT == eos_page_manager_get_transition_duration (EOS_PAGE_MANAGER (fixture->pm)));
+ eos_page_manager_set_transition_duration (EOS_PAGE_MANAGER (fixture->pm), DURATION_1);
+ g_assert (DURATION_1 == eos_page_manager_get_transition_duration (EOS_PAGE_MANAGER (fixture->pm)));
+ eos_page_manager_set_transition_duration (EOS_PAGE_MANAGER (fixture->pm), DURATION_2);
+ g_assert (DURATION_2 == eos_page_manager_get_transition_duration (EOS_PAGE_MANAGER (fixture->pm)));
+}
+
+static void
+test_pm_prop_transition_type (PageManagerFixture *fixture,
+ gconstpointer unused)
+{
+ EosPageManagerTransitionType type;
+ g_object_get (fixture->pm, "transition-type", &type, NULL);
+ g_assert (type == EOS_PAGE_MANAGER_TRANSITION_TYPE_NONE);
+ g_object_set (fixture->pm, "transition-type", EOS_PAGE_MANAGER_TRANSITION_TYPE_CROSSFADE, NULL);
+ g_object_get (fixture->pm, "transition-type", &type, NULL);
+ g_assert (type == EOS_PAGE_MANAGER_TRANSITION_TYPE_CROSSFADE);
+}
+
+static void
+test_pm_get_set_transition_type (PageManagerFixture *fixture,
+ gconstpointer unused)
+{
+ g_assert (EOS_PAGE_MANAGER_TRANSITION_TYPE_NONE == eos_page_manager_get_transition_type (EOS_PAGE_MANAGER (fixture->pm)));
+ eos_page_manager_set_transition_type (EOS_PAGE_MANAGER (fixture->pm), EOS_PAGE_MANAGER_TRANSITION_TYPE_CROSSFADE);
+ g_assert (EOS_PAGE_MANAGER_TRANSITION_TYPE_CROSSFADE == eos_page_manager_get_transition_type (EOS_PAGE_MANAGER (fixture->pm)));
+}
+
+static void
test_empty_pm_visible_page (PageManagerFixture *fixture,
gconstpointer unused)
{
@@ -531,6 +578,14 @@ add_page_manager_tests (void)
test_pm_remove_page_by_name);
ADD_PAGE_MANAGER_TEST ("/page-manager/duplicate-page-name",
test_pm_duplicate_page_name);
+ ADD_PAGE_MANAGER_TEST ("/page-manager/prop-transition-duration",
+ test_pm_prop_transition_duration);
+ ADD_PAGE_MANAGER_TEST ("/page-manager/get-set-transition-duration",
+ test_pm_get_set_transition_duration);
+ ADD_PAGE_MANAGER_TEST ("/page-manager/prop-transition-type",
+ test_pm_prop_transition_type);
+ ADD_PAGE_MANAGER_TEST ("/page-manager/get-set-transition-type",
+ test_pm_get_set_transition_type);
ADD_EMPTY_PAGE_MANAGER_TEST ("/page-manager/empty-visible-page",
test_empty_pm_visible_page);
ADD_EMPTY_PAGE_MANAGER_TEST ("/page-manager/empty-visible-page-name",