summaryrefslogtreecommitdiff
path: root/test/endless/test-splash-page-manager.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/endless/test-splash-page-manager.c')
-rw-r--r--test/endless/test-splash-page-manager.c186
1 files changed, 0 insertions, 186 deletions
diff --git a/test/endless/test-splash-page-manager.c b/test/endless/test-splash-page-manager.c
deleted file mode 100644
index 735f872..0000000
--- a/test/endless/test-splash-page-manager.c
+++ /dev/null
@@ -1,186 +0,0 @@
-#include <gtk/gtk.h>
-#include <endless/endless.h>
-
-#include "run-tests.h"
-
-#define ADD_SPLASH_PAGE_MANAGER_TEST(path, test_func) \
- g_test_add ((path), SplashPageManagerFixture, NULL, \
- spm_fixture_setup, (test_func), spm_fixture_teardown)
-#define ADD_EMPTY_SPLASH_PAGE_MANAGER_TEST(path, test_func) \
- g_test_add ((path), SplashPageManagerFixture, NULL, \
- empty_spm_fixture_setup, (test_func), spm_fixture_teardown);
-
-typedef struct
-{
- GtkWidget *spm;
- GtkWidget *first_splash_page;
- GtkWidget *second_splash_page;
- GtkWidget *first_main_page;
- GtkWidget *second_main_page;
-} SplashPageManagerFixture;
-
-static void
-empty_spm_fixture_setup (SplashPageManagerFixture *fixture,
- gconstpointer unused)
-{
- fixture->first_splash_page = gtk_label_new ("splash");
- gtk_widget_show (fixture->first_splash_page);
- fixture->second_splash_page = gtk_label_new ("ham sandwich");
- gtk_widget_show (fixture->second_splash_page);
- fixture->first_main_page = gtk_label_new ("main");
- gtk_widget_show (fixture->first_main_page);
- fixture->second_main_page = gtk_label_new ("pikachu");
- gtk_widget_show (fixture->second_main_page);
- fixture->spm = eos_splash_page_manager_new ();
- gtk_widget_show (fixture->spm);
-}
-
-static void
-spm_fixture_setup (SplashPageManagerFixture *fixture,
- gconstpointer unused)
-{
- empty_spm_fixture_setup (fixture, unused);
- eos_splash_page_manager_set_splash_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm),
- fixture->first_splash_page);
- eos_splash_page_manager_set_main_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm),
- fixture->first_main_page);
-}
-
-static void
-spm_fixture_teardown (SplashPageManagerFixture *fixture,
- gconstpointer unused)
-{
- gtk_widget_destroy (fixture->spm);
-}
-
-static void
-test_spm_get_set_splash_page (SplashPageManagerFixture *fixture,
- gconstpointer unused)
-{
- GtkWidget *splash_page;
- splash_page = eos_splash_page_manager_get_splash_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm));
- g_assert (splash_page != fixture->second_splash_page);
- eos_splash_page_manager_set_splash_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm),
- fixture->second_splash_page);
- splash_page = eos_splash_page_manager_get_splash_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm));
- g_assert (splash_page == fixture->second_splash_page);
-}
-
-static void
-test_spm_prop_splash_page (SplashPageManagerFixture *fixture,
- gconstpointer unused)
-{
- GtkWidget *splash_page;
- g_object_get (fixture->spm, "splash-page", &splash_page, NULL);
- g_assert (splash_page != fixture->second_splash_page);
- g_object_set (fixture->spm, "splash-page", fixture->second_splash_page, NULL);
- g_object_get (fixture->spm, "splash-page", &splash_page, NULL);
- g_assert (splash_page == fixture->second_splash_page);
-}
-
-static void
-test_spm_get_set_main_page (SplashPageManagerFixture *fixture,
- gconstpointer unused)
-{
- GtkWidget *main_page;
- main_page = eos_splash_page_manager_get_main_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm));
- g_assert (main_page != fixture->second_main_page);
- eos_splash_page_manager_set_main_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm),
- fixture->second_main_page);
- main_page = eos_splash_page_manager_get_main_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm));
- g_assert (main_page == fixture->second_main_page);
-}
-
-static void
-test_spm_prop_main_page (SplashPageManagerFixture *fixture,
- gconstpointer unused)
-{
- GtkWidget *main_page;
- g_object_get (fixture->spm, "main-page", &main_page, NULL);
- g_assert (main_page != fixture->second_main_page);
- g_object_set (fixture->spm, "main-page", fixture->second_main_page, NULL);
- g_object_get (fixture->spm, "main-page", &main_page, NULL);
- g_assert (main_page == fixture->second_main_page);
-}
-
-static void
-test_spm_show_main_page (SplashPageManagerFixture *fixture,
- gconstpointer unused)
-{
- GtkWidget *visible_child;
- visible_child = gtk_stack_get_visible_child (GTK_STACK (fixture->spm));
- g_assert (visible_child != fixture->first_main_page);
- eos_splash_page_manager_show_main_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm));
- visible_child = gtk_stack_get_visible_child (GTK_STACK (fixture->spm));
- g_assert (visible_child == fixture->first_main_page);
-}
-
-
-static void
-test_spm_show_splash_page (SplashPageManagerFixture *fixture,
- gconstpointer unused)
-{
- GtkWidget *visible_child;
- visible_child = gtk_stack_get_visible_child (GTK_STACK (fixture->spm));
- g_assert (visible_child == fixture->first_splash_page);
- eos_splash_page_manager_show_main_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm));
- visible_child = gtk_stack_get_visible_child (GTK_STACK (fixture->spm));
- g_assert (visible_child != fixture->first_splash_page);
- eos_splash_page_manager_show_splash_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm));
- visible_child = gtk_stack_get_visible_child (GTK_STACK (fixture->spm));
- g_assert (visible_child == fixture->first_splash_page);
-}
-
-static void
-test_spm_default_visible_splash (SplashPageManagerFixture *fixture,
- gconstpointer unused)
-{
- // Even though main page is added first splash page should be visible after it is added.
- GtkWidget *visible_child;
- eos_splash_page_manager_set_main_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm),
- fixture->first_main_page);
- eos_splash_page_manager_set_splash_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm),
- fixture->first_splash_page);
- visible_child = gtk_stack_get_visible_child (GTK_STACK (fixture->spm));
- g_assert (visible_child == fixture->first_splash_page);
-}
-
-static void
-test_spm_add_to_splash (SplashPageManagerFixture *fixture,
- gconstpointer unused)
-{
- // Right now container add sets the splash page by default. This tests that
- // functionality.
- GtkWidget *splash_page;
- gtk_container_add (GTK_CONTAINER (fixture->spm),
- fixture->first_splash_page);
- splash_page = eos_splash_page_manager_get_splash_page (EOS_SPLASH_PAGE_MANAGER (fixture->spm));
- g_assert (splash_page == fixture->first_splash_page);
-}
-
-void
-add_splash_page_manager_tests (void)
-{
- ADD_SPLASH_PAGE_MANAGER_TEST ("/splash-page-manager/show-main-page",
- test_spm_show_main_page);
- ADD_SPLASH_PAGE_MANAGER_TEST ("/splash-page-manager/show-splash-page",
- test_spm_show_splash_page);
- ADD_EMPTY_SPLASH_PAGE_MANAGER_TEST ("/splash-page-manager/default-visible-splash",
- test_spm_default_visible_splash);
- ADD_EMPTY_SPLASH_PAGE_MANAGER_TEST ("/splash-page-manager/add-to-splash",
- test_spm_add_to_splash);
-
- /* Disabled until https://bugzilla.gnome.org/show_bug.cgi?id=699756 is fixed
- [endlessm/eos-sdk#67] */
- if (FALSE)
- {
- ADD_SPLASH_PAGE_MANAGER_TEST ("/splash-page-manager/get-set-splash-page",
- test_spm_get_set_splash_page);
- ADD_SPLASH_PAGE_MANAGER_TEST ("/splash-page-manager/prop-splash-page",
- test_spm_prop_splash_page);
- ADD_SPLASH_PAGE_MANAGER_TEST ("/splash-page-manager/get-set-main-page",
- test_spm_get_set_main_page);
- ADD_SPLASH_PAGE_MANAGER_TEST ("/splash-page-manager/prop-main-page",
- test_spm_prop_main_page);
- }
-}