From b1b7b8a001ab2f50f93c751f025f83ee12fcfac0 Mon Sep 17 00:00:00 2001 From: Matt Watson Date: Mon, 12 May 2014 18:41:55 -0700 Subject: Remove splash page manager Was not getting used in any apps so we are taking it out [endlessm/eos-sdk#985] --- docs/reference/endless/endless-docs.xml | 1 - docs/reference/endless/endless-sections.txt | 23 -- endless/Makefile.am | 2 - endless/endless.h | 1 - endless/eossplashpagemanager.c | 349 ---------------------------- endless/eossplashpagemanager.h | 89 ------- test/endless/Makefile.am.inc | 1 - test/endless/run-tests.c | 1 - test/endless/run-tests.h | 1 - test/endless/test-splash-page-manager.c | 186 --------------- test/smoke-tests/splash-page.js | 55 ----- 11 files changed, 709 deletions(-) delete mode 100644 endless/eossplashpagemanager.c delete mode 100644 endless/eossplashpagemanager.h delete mode 100644 test/endless/test-splash-page-manager.c delete mode 100644 test/smoke-tests/splash-page.js diff --git a/docs/reference/endless/endless-docs.xml b/docs/reference/endless/endless-docs.xml index f946d1f..354bd18 100644 --- a/docs/reference/endless/endless-docs.xml +++ b/docs/reference/endless/endless-docs.xml @@ -20,7 +20,6 @@ - diff --git a/docs/reference/endless/endless-sections.txt b/docs/reference/endless/endless-sections.txt index 0dc0428..7d1baa6 100644 --- a/docs/reference/endless/endless-sections.txt +++ b/docs/reference/endless/endless-sections.txt @@ -84,29 +84,6 @@ eos_page_manager_get_type EosPageManagerPrivate -
-splash-page-manager -EosSplashPageManager -eos_splash_page_manager_new -eos_splash_page_manager_get_splash_page -eos_splash_page_manager_set_splash_page -eos_splash_page_manager_get_main_page -eos_splash_page_manager_set_main_page -eos_splash_page_manager_show_main_page -eos_splash_page_manager_show_splash_page - -EOS_IS_SPLASH_PAGE_MANAGER -EOS_IS_SPLASH_PAGE_MANAGER_CLASS -EOS_SPLASH_PAGE_MANAGER -EOS_SPLASH_PAGE_MANAGER_CLASS -EOS_SPLASH_PAGE_MANAGER_GET_CLASS -EOS_TYPE_SPLASH_PAGE_MANAGER -EosSplashPageManagerClass -eos_splash_page_manager_get_type - -EosSplashPageManagerPrivate -
-
action-button EosActionButton diff --git a/endless/Makefile.am b/endless/Makefile.am index f0a6a6a..d6fe209 100644 --- a/endless/Makefile.am +++ b/endless/Makefile.am @@ -32,7 +32,6 @@ endless_private_installed_headers = \ endless/eosenums.h \ endless/eosmacros.h \ endless/eospagemanager.h \ - endless/eossplashpagemanager.h \ endless/eostypes.h \ endless/eoswindow.h \ endless/eosactionmenu-private.h \ @@ -45,7 +44,6 @@ endless_library_sources = \ endless/eosinit.c endless/eosinit-private.h \ endless/eospagemanager.c \ endless/eosresource.c endless/eosresource-private.h \ - endless/eossplashpagemanager.c \ endless/eostopbar.c endless/eostopbar-private.h \ endless/eosactionbutton.c \ endless/eosactionmenu.c \ diff --git a/endless/endless.h b/endless/endless.h index f3f2061..6404dee 100644 --- a/endless/endless.h +++ b/endless/endless.h @@ -16,7 +16,6 @@ G_BEGIN_DECLS #include "eosapplication.h" #include "eosflexygrid.h" #include "eospagemanager.h" -#include "eossplashpagemanager.h" #include "eoswindow.h" #include "eoscustomcontainer.h" diff --git a/endless/eossplashpagemanager.c b/endless/eossplashpagemanager.c deleted file mode 100644 index 781c9e5..0000000 --- a/endless/eossplashpagemanager.c +++ /dev/null @@ -1,349 +0,0 @@ -/* Copyright 2013 Endless Mobile, Inc. */ - -#include "config.h" -#include "eossplashpagemanager.h" - -#include - -#include - -/** - * SECTION:splash-page-manager - * @short_description: Add splash screen to application - * @title: Splash Page Manager - * - * Builds on the #EosPageManager to provide an application with two pages. - * The first page is called the splash page and is the first page to be - * presented to the user. This is generally a simple page with a minimal - * interface that acts as a gateway to the rest of the application. - * - * The second page, called the main page, is generally where the main work of - * the application will get done. This can be shown instead of the splash page - * at any time by calling eos_splash_page_manager_show_main_page(). - * - * Unlike the generic page manager, the splash page manager can only contain - * two pages. However, the main page can be a second page manager (such as a - * tabbed notebook view), for applications with more complex page flow. - * - * The splash screen and main page can contain any widget. Call - * eos_splash_page_manager_show_main_page() and - * eos_splash_page_manager_show_splash_page() to toggle between the two views. - * The splash screen will be shown by default until a call to - * eos_splash_page_manager_show_main_page() is made. - * - * Javascript example usage: - * |[ - * splash_page_manager = new SplashPageManager({ - * "splash-page": page0, - * "main-page": page1 - * }); - * // After splash page actions completed - * splash_page_manager.show_main_page(); - * ]| - */ - -typedef struct { - GtkWidget *splash_page; - GtkWidget *main_page; - gboolean main_page_shown; -} EosSplashPageManagerPrivate; - -G_DEFINE_TYPE_WITH_PRIVATE (EosSplashPageManager, eos_splash_page_manager, EOS_TYPE_PAGE_MANAGER) - -enum -{ - PROP_0, - PROP_SPLASH_PAGE, - PROP_MAIN_PAGE, - NPROPS -}; - -static GParamSpec *eos_splash_page_manager_props[NPROPS] = { NULL, }; - -static void -eos_splash_page_manager_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - EosSplashPageManager *self = EOS_SPLASH_PAGE_MANAGER (object); - - switch (property_id) - { - case PROP_SPLASH_PAGE: - g_value_set_object (value, eos_splash_page_manager_get_splash_page (self)); - break; - - case PROP_MAIN_PAGE: - g_value_set_object (value, eos_splash_page_manager_get_main_page (self)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -eos_splash_page_manager_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - EosSplashPageManager *self = EOS_SPLASH_PAGE_MANAGER (object); - - switch (property_id) - { - case PROP_SPLASH_PAGE: - eos_splash_page_manager_set_splash_page (self, g_value_get_object (value)); - break; - - case PROP_MAIN_PAGE: - eos_splash_page_manager_set_main_page (self, g_value_get_object (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - } -} - -static void -eos_splash_page_manager_add (GtkContainer *container, - GtkWidget *new_page) -{ - EosSplashPageManager *self = EOS_SPLASH_PAGE_MANAGER (container); - EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self); - if (priv->splash_page != NULL) - { - g_critical ("Not adding page %p to splash page manager. You already added" - "a splash page.", new_page); - } - else - { - eos_splash_page_manager_set_splash_page (self, new_page); - } -} - -static void -eos_splash_page_manager_remove (GtkContainer *container, - GtkWidget *page) -{ - EosSplashPageManager *self = EOS_SPLASH_PAGE_MANAGER (container); - EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self); - if (page == priv->splash_page) - { - eos_splash_page_manager_set_splash_page (self, NULL); - } - if (page == priv->main_page) - { - eos_splash_page_manager_set_main_page (self, NULL); - } -} - -static void -eos_splash_page_manager_class_init (EosSplashPageManagerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); - - object_class->get_property = eos_splash_page_manager_get_property; - object_class->set_property = eos_splash_page_manager_set_property; - - container_class->add = eos_splash_page_manager_add; - container_class->remove = eos_splash_page_manager_remove; - - /** - * EosSplashPageManager:splash-page: - * - * A reference to the splash page widget of the splash page manager. If no - * page has been set, points to null. - */ - eos_splash_page_manager_props[PROP_SPLASH_PAGE] = - g_param_spec_object ("splash-page", "Splash page", - "Splash page of the splash page manager", - GTK_TYPE_WIDGET, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - /** - * EosSplashPageManager:main-page: - * - * A reference to the main page widget of the splash page manager. If no - * page has been set, points to null. - */ - eos_splash_page_manager_props[PROP_MAIN_PAGE] = - g_param_spec_object ("main-page", "Main page", - "Main page of the splash page manager", - GTK_TYPE_WIDGET, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); - - g_object_class_install_properties (object_class, NPROPS, - eos_splash_page_manager_props); -} - -static void -eos_splash_page_manager_init (EosSplashPageManager *self) -{ -} - -/* Public API */ - -/** - * eos_splash_page_manager_new: - * - * Creates a new default splash page manager. - * - * Returns: the new page manager. - */ -GtkWidget * -eos_splash_page_manager_new (void) -{ - return g_object_new (EOS_TYPE_SPLASH_PAGE_MANAGER, NULL); -} - -/** - * eos_splash_page_manager_get_splash_page: - * @self: the splash page manager - * - * Gets a pointer to the splash page widget. See #EosSplashPageManager:splash-page - * for more information. - * - * Returns: (transfer none): the page #GtkWidget, or %NULL if the splash page - * has not been set. - */ -GtkWidget * -eos_splash_page_manager_get_splash_page (EosSplashPageManager *self) -{ - g_return_val_if_fail (EOS_IS_SPLASH_PAGE_MANAGER (self), NULL); - - EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self); - return priv->splash_page; -} - -/** - * eos_splash_page_manager_set_splash_page: - * @self: the splash page manager - * @page: the splash page widget - * - * Sets the widget for the splash page. See #EosSplashPageManager:splash-page - * for more information. Setting this widget will add it to the splash page - * manager as a child, any widget previously set as the splash page will be - * removed. - */ -void -eos_splash_page_manager_set_splash_page (EosSplashPageManager *self, - GtkWidget *page) -{ - g_return_if_fail (EOS_IS_SPLASH_PAGE_MANAGER (self)); - g_return_if_fail (page == NULL || GTK_IS_WIDGET (page)); - g_return_if_fail (page == NULL || gtk_widget_get_parent (page) == NULL); - - EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self); - - if (priv->splash_page != page) - { - if (priv->splash_page != NULL) - GTK_CONTAINER_CLASS (eos_splash_page_manager_parent_class)->remove (GTK_CONTAINER (self), priv->splash_page); - if (page != NULL) - { - GTK_CONTAINER_CLASS (eos_splash_page_manager_parent_class)->add (GTK_CONTAINER (self), page); - if (!priv->main_page_shown) - gtk_stack_set_visible_child (GTK_STACK (self), page); - } - priv->splash_page = page; - g_object_notify( G_OBJECT (self), "splash-page"); - } -} - - -/** - * eos_splash_page_manager_get_main_page: - * @self: the splash page manager - * - * Gets a pointer to the main page widget. See #EosSplashPageManager:main-page - * for more information. - * - * Returns: (transfer none): the page #GtkWidget, or %NULL if the main page - * has not been set. - */ -GtkWidget * -eos_splash_page_manager_get_main_page (EosSplashPageManager *self) -{ - g_return_val_if_fail (EOS_IS_SPLASH_PAGE_MANAGER (self), NULL); - - EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self); - return priv->main_page; -} - -/** - * eos_splash_page_manager_set_main_page: - * @self: the splash page manager - * @page: the main page widget - * - * Sets the widget for the main page. See #EosSplashPageManager:main-page for - * more information. Setting this widget will add it to the splash page - * manager as a child, any widget previously set as the main page will be - * removed. - */ -void -eos_splash_page_manager_set_main_page (EosSplashPageManager *self, - GtkWidget *page) -{ - g_return_if_fail (EOS_IS_SPLASH_PAGE_MANAGER (self)); - g_return_if_fail (page == NULL || GTK_IS_WIDGET (page)); - g_return_if_fail (page == NULL || gtk_widget_get_parent (page) == NULL); - - EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self); - if (priv->main_page != page) - { - if (priv->main_page != NULL) - GTK_CONTAINER_CLASS (eos_splash_page_manager_parent_class)->remove (GTK_CONTAINER (self), priv->main_page); - // Call page manager add not our own. - if (page != NULL) - GTK_CONTAINER_CLASS (eos_splash_page_manager_parent_class)->add (GTK_CONTAINER (self), page); - priv->main_page = page; - g_object_notify( G_OBJECT (self), "main-page"); - } -} - -/** - * eos_splash_page_manager_show_main_page: - * @self: the splash page manager - * - * Shows the main page of the splash page manager. - */ -void -eos_splash_page_manager_show_main_page (EosSplashPageManager *self) -{ - g_return_if_fail (EOS_IS_SPLASH_PAGE_MANAGER (self)); - - EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self); - if (priv->main_page == NULL) - { - g_critical ("Main page is null, have you set it?"); - return; - } - priv->main_page_shown = TRUE; - gtk_stack_set_visible_child (GTK_STACK (self), priv->main_page); -} - -/** - * eos_splash_page_manager_show_splash_page: - * @self: the splash page manager - * - * Shows the splash page. This page is shown first by default, so this only - * has effect if you want to "reshow" the page after calling - * eos_splash_page_manager_show_main_page(). - */ -void -eos_splash_page_manager_show_splash_page (EosSplashPageManager *self) -{ - g_return_if_fail (EOS_IS_SPLASH_PAGE_MANAGER (self)); - - EosSplashPageManagerPrivate *priv = eos_splash_page_manager_get_instance_private (self); - if (priv->splash_page == NULL) - { - g_critical ("Splash page is null, have you set it?"); - return; - } - priv->main_page_shown = FALSE; - gtk_stack_set_visible_child (GTK_STACK (self), priv->splash_page); -} diff --git a/endless/eossplashpagemanager.h b/endless/eossplashpagemanager.h deleted file mode 100644 index 061176e..0000000 --- a/endless/eossplashpagemanager.h +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright 2013 Endless Mobile, Inc. */ - -#ifndef EOS_SPLASH_PAGE_MANAGER_H -#define EOS_SPLASH_PAGE_MANAGER_H - -#if !(defined(_EOS_SDK_INSIDE_ENDLESS_H) || defined(COMPILING_EOS_SDK)) -#error "Please do not include this header file directly." -#endif - -#include "eostypes.h" - -#include "eospagemanager.h" - -#include - -G_BEGIN_DECLS - -#define EOS_TYPE_SPLASH_PAGE_MANAGER eos_splash_page_manager_get_type() - -#define EOS_SPLASH_PAGE_MANAGER(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - EOS_TYPE_SPLASH_PAGE_MANAGER, EosSplashPageManager)) - -#define EOS_SPLASH_PAGE_MANAGER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), \ - EOS_TYPE_SPLASH_PAGE_MANAGER, EosSplashPageManagerClass)) - -#define EOS_IS_SPLASH_PAGE_MANAGER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - EOS_TYPE_SPLASH_PAGE_MANAGER)) - -#define EOS_IS_SPLASH_PAGE_MANAGER_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - EOS_TYPE_SPLASH_PAGE_MANAGER)) - -#define EOS_SPLASH_PAGE_MANAGER_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - EOS_TYPE_SPLASH_PAGE_MANAGER, EosSplashPageManagerClass)) - -typedef struct _EosSplashPageManager EosSplashPageManager; -typedef struct _EosSplashPageManagerClass EosSplashPageManagerClass; - -/** - * EosSplashPageManager: - * - * This structure contains no public members. - */ -struct _EosSplashPageManager -{ - EosPageManager parent; -}; - -struct _EosSplashPageManagerClass -{ - EosPageManagerClass parent_class; - - /* For further expansion */ - gpointer _padding[8]; -}; - -EOS_SDK_ALL_API_VERSIONS -GType eos_splash_page_manager_get_type (void) G_GNUC_CONST; - -EOS_SDK_ALL_API_VERSIONS -GtkWidget *eos_splash_page_manager_new (void); - -EOS_SDK_ALL_API_VERSIONS -GtkWidget *eos_splash_page_manager_get_splash_page (EosSplashPageManager *self); - -EOS_SDK_ALL_API_VERSIONS -void eos_splash_page_manager_set_splash_page (EosSplashPageManager *self, - GtkWidget *page); - -EOS_SDK_ALL_API_VERSIONS -GtkWidget *eos_splash_page_manager_get_main_page (EosSplashPageManager *self); - -EOS_SDK_ALL_API_VERSIONS -void eos_splash_page_manager_set_main_page (EosSplashPageManager *self, - GtkWidget *page); - -EOS_SDK_ALL_API_VERSIONS -void eos_splash_page_manager_show_main_page (EosSplashPageManager *self); - -EOS_SDK_ALL_API_VERSIONS -void eos_splash_page_manager_show_splash_page (EosSplashPageManager *self); - -G_END_DECLS - -#endif /* EOS_SPLASH_PAGE_MANAGER_H */ diff --git a/test/endless/Makefile.am.inc b/test/endless/Makefile.am.inc index ac030a3..76a29ec 100644 --- a/test/endless/Makefile.am.inc +++ b/test/endless/Makefile.am.inc @@ -7,7 +7,6 @@ test_endless_run_tests_SOURCES = \ $(ENDLESS_TESTS_DIRECTORY)/endless/test-hello.c \ $(ENDLESS_TESTS_DIRECTORY)/endless/test-application.c \ $(ENDLESS_TESTS_DIRECTORY)/endless/test-page-manager.c \ - $(ENDLESS_TESTS_DIRECTORY)/endless/test-splash-page-manager.c \ $(ENDLESS_TESTS_DIRECTORY)/endless/test-window.c \ $(ENDLESS_TESTS_DIRECTORY)/endless/test-action-menu.c \ $(ENDLESS_TESTS_DIRECTORY)/endless/test-action-button.c \ diff --git a/test/endless/run-tests.c b/test/endless/run-tests.c index 4bc4006..506224b 100644 --- a/test/endless/run-tests.c +++ b/test/endless/run-tests.c @@ -107,7 +107,6 @@ main (int argc, add_application_tests (); add_window_tests (); add_page_manager_tests (); - add_splash_page_manager_tests (); add_action_menu_tests (); add_action_button_tests (); add_flexy_grid_test (); diff --git a/test/endless/run-tests.h b/test/endless/run-tests.h index cb52ab7..b43ef53 100644 --- a/test/endless/run-tests.h +++ b/test/endless/run-tests.h @@ -37,7 +37,6 @@ void add_hello_tests (void); void add_application_tests (void); void add_window_tests (void); void add_page_manager_tests (void); -void add_splash_page_manager_tests (void); void add_action_menu_tests (void); void add_action_button_tests (void); void add_flexy_grid_test (void); 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 -#include - -#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); - } -} diff --git a/test/smoke-tests/splash-page.js b/test/smoke-tests/splash-page.js deleted file mode 100644 index ff52a9f..0000000 --- a/test/smoke-tests/splash-page.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2013 Endless Mobile, Inc. - -const Lang = imports.lang; -const Endless = imports.gi.Endless; -const Gtk = imports.gi.Gtk; - -const TEST_APPLICATION_ID = 'com.endlessm.example.test'; - -const TestApplication = new Lang.Class ({ - Name: 'TestApplication', - Extends: Endless.Application, - - vfunc_startup: function() { - this.parent(); - - // First page - this._splash_page = new Gtk.Grid({ orientation: Gtk.Orientation.VERTICAL }); - let splash_label = new Gtk.Label({ label: 'The Splash Page' }); - this._splash_page.add(splash_label); - let splash_button = new Gtk.Button({ label: 'Show main page' }); - splash_button.connect('clicked', Lang.bind(this, function () { - this._pm.show_main_page(); - })); - this._splash_page.add(splash_button); - - // Second page - this._main_page = new Gtk.Grid({ orientation: Gtk.Orientation.HORIZONTAL }); - let main_label = new Gtk.Label({ label: 'The Main Page' }); - this._main_page.add(main_label); - let main_button = new Gtk.Button({ label: 'Go back to splash page' }); - main_button.connect('clicked', Lang.bind(this, function () { - this._pm.show_splash_page(); - })); - this._main_page.add(main_button); - - this._pm = new Endless.SplashPageManager(); - this._pm.set_splash_page(this._splash_page); - this._pm.set_main_page(this._main_page); - - this._window = new Endless.Window({ - application: this, - border_width: 16, - page_manager: this._pm - }); - this._window.show_all(); - }, - - _onButtonClicked: function () { - this._window.destroy(); - }, -}); - -let app = new TestApplication({ application_id: TEST_APPLICATION_ID, - flags: 0 }); -app.run(ARGV); -- cgit v1.2.3