diff options
author | Matt Watson <mattdangerw@gmail.com> | 2014-05-12 16:35:18 -0700 |
---|---|---|
committer | Matt Watson <mattdangerw@gmail.com> | 2014-05-13 12:50:02 -0700 |
commit | 396bfe04660e17d02c147488edd0c752682afecf (patch) | |
tree | f3ca112de3b227468b85ecb6cb9fbb3dafff650f /test | |
parent | 7a2edd48f30f1f0bd1496c69c58ca9ac0e791d49 (diff) |
EosPageManager uses GtkStack properties directly
Use the visible-child and visible-child-name properties of GtkStack
in lieu of visible-page and visible-page-name. Use the
transition-duration, transition-type and name properties of GtkStack
instead of proxying in page manager with properties of that same name.
The page manger becomes nothing more than a stack with custom child
properties for use in EosWindow, and becomes a lot simpler.
This breaks the page manager api and will require changes in the
apps as well
[endlessm/eos-sdk#985]
Diffstat (limited to 'test')
-rw-r--r-- | test/endless/test-page-manager.c | 338 | ||||
-rw-r--r-- | test/endless/test-splash-page-manager.c | 35 | ||||
-rw-r--r-- | test/smoke-tests/app-window.js | 72 | ||||
-rw-r--r-- | test/smoke-tests/webhelper/webview.js | 8 |
4 files changed, 35 insertions, 418 deletions
diff --git a/test/endless/test-page-manager.c b/test/endless/test-page-manager.c index 3eadd67..98cdadc 100644 --- a/test/endless/test-page-manager.c +++ b/test/endless/test-page-manager.c @@ -9,12 +9,6 @@ #define PAGE1_PROP_STRING "prop1" #define PAGE2_PROP_STRING "prop2" #define PAGE3_PROP_STRING "prop3" -#define EXPECTED_PAGE_NAME PAGE2_NAME -#define EXPECTED_CHANGED_PAGE_NAME "changed-name" -#define DUPLICATE_PAGE_NAME "duplicate-name" -#define EXPECTED_DUPLICATE_PAGE_NAME_ERRMSG "*Not setting page name to \"" \ - DUPLICATE_PAGE_NAME "\", because page manager already contains a page by " \ - "that name*" #define EXPECTED_PAGE_PROP_STRING PAGE2_PROP_STRING #define EXPECTED_CHANGED_NAME "changed-name" #define ADD_PAGE_MANAGER_TEST(path, test_func) \ @@ -23,12 +17,6 @@ #define ADD_PAGE_MANAGER_TEST_WITH_ARGS(path, test_func, args) \ g_test_add ((path), PageManagerFixture, args, \ pm_fixture_setup, (test_func), pm_fixture_teardown) -#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 #define BACKGROUND_SIZE_DEFAULT "100% 100%" #define BACKGROUND_POSITION_DEFAULT "0% 0%" @@ -73,13 +61,6 @@ pm_fixture_setup (PageManagerFixture *fixture, } static void -empty_pm_fixture_setup (PageManagerFixture *fixture, - gconstpointer unused) -{ - fixture->pm = eos_page_manager_new (); -} - -static void pm_fixture_teardown (PageManagerFixture *fixture, gconstpointer unused) { @@ -87,110 +68,6 @@ pm_fixture_teardown (PageManagerFixture *fixture, } static void -test_pm_get_set_visible_page (PageManagerFixture *fixture, - gconstpointer unused) -{ - GtkWidget *visible_page; - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (visible_page != fixture->page2); - eos_page_manager_set_visible_page (EOS_PAGE_MANAGER (fixture->pm), - fixture->page2); - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (visible_page == fixture->page2); -} - -static void -test_pm_prop_visible_page (PageManagerFixture *fixture, - gconstpointer unused) -{ - GtkWidget *visible_page; - g_object_get (fixture->pm, "visible-page", &visible_page, NULL); - g_assert (visible_page != fixture->page2); - g_object_set (fixture->pm, "visible-page", fixture->page2, NULL); - g_object_get (fixture->pm, "visible-page", &visible_page, NULL); - g_assert (visible_page == fixture->page2); -} - -static void -test_pm_get_set_visible_page_name (PageManagerFixture *fixture, - gconstpointer unused) -{ - const gchar *name; - name = eos_page_manager_get_visible_page_name (EOS_PAGE_MANAGER (fixture->pm)); - g_assert_cmpstr (name, !=, EXPECTED_PAGE_NAME); - eos_page_manager_set_visible_page_name (EOS_PAGE_MANAGER (fixture->pm), - EXPECTED_PAGE_NAME); - name = eos_page_manager_get_visible_page_name (EOS_PAGE_MANAGER (fixture->pm)); - g_assert_cmpstr (name, ==, EXPECTED_PAGE_NAME); -} - -static void -test_pm_prop_visible_page_name (PageManagerFixture *fixture, - gconstpointer unused) -{ - gchar *name; - g_object_get (fixture->pm, "visible-page-name", &name, NULL); - g_assert_cmpstr (name, !=, EXPECTED_PAGE_NAME); - g_free (name); - g_object_set (fixture->pm, "visible-page-name", EXPECTED_PAGE_NAME, NULL); - g_object_get (fixture->pm, "visible-page-name", &name, NULL); - g_assert_cmpstr (name, ==, EXPECTED_PAGE_NAME); - g_free (name); -} - -static void -test_pm_get_set_page_name (PageManagerFixture *fixture, - gconstpointer unused) -{ - const gchar *name; - name = eos_page_manager_get_page_name (EOS_PAGE_MANAGER (fixture->pm), - fixture->page1); - g_assert_cmpstr (name, ==, PAGE1_NAME); - name = eos_page_manager_get_page_name (EOS_PAGE_MANAGER (fixture->pm), - fixture->page2); - g_assert_cmpstr (name, ==, PAGE2_NAME); - name = eos_page_manager_get_page_name (EOS_PAGE_MANAGER (fixture->pm), - fixture->page3); - g_assert_cmpstr (name, ==, PAGE3_NAME); - eos_page_manager_set_page_name (EOS_PAGE_MANAGER (fixture->pm), - fixture->page2, - EXPECTED_CHANGED_NAME); - name = eos_page_manager_get_page_name (EOS_PAGE_MANAGER (fixture->pm), - fixture->page2); - g_assert_cmpstr (name, ==, EXPECTED_CHANGED_NAME); -} - -static void -test_pm_child_prop_name (PageManagerFixture *fixture, - gconstpointer unused) -{ - gchar *name; - gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page1, - "name", &name, - NULL); - g_assert_cmpstr (name, ==, PAGE1_NAME); - g_free (name); - gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page2, - "name", &name, - NULL); - g_assert_cmpstr (name, ==, PAGE2_NAME); - g_free (name); - gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page3, - "name", &name, - NULL); - g_assert_cmpstr (name, ==, PAGE3_NAME); - g_free (name); - gtk_container_child_set (GTK_CONTAINER (fixture->pm), fixture->page2, - "name", EXPECTED_CHANGED_NAME, - NULL); - gtk_container_child_get (GTK_CONTAINER (fixture->pm), fixture->page2, - "name", &name, - NULL); - g_assert_cmpstr (name, ==, EXPECTED_CHANGED_NAME); - g_free (name); -} - -static void test_pm_get_set_background_repeats (PageManagerFixture *fixture, gconstpointer unused) { @@ -263,37 +140,6 @@ test_pm_child_prop_string (PageManagerFixture *fixture, } static void -test_pm_page_no_name (PageManagerFixture *fixture, - gconstpointer unused) -{ - const gchar *name_get; - gchar *name_prop; - GtkWidget *new_page = gtk_label_new("new"); - gtk_container_add (GTK_CONTAINER (fixture->pm), new_page); - name_get = eos_page_manager_get_page_name (EOS_PAGE_MANAGER (fixture->pm), new_page); - g_assert (name_get == NULL); - gtk_container_child_get (GTK_CONTAINER (fixture->pm), new_page, - "name", &name_prop, - NULL); - g_assert (name_prop == NULL); -} - -static void -test_pm_set_page_no_name (PageManagerFixture *fixture, - gconstpointer unused) -{ - const gchar *name; - eos_page_manager_set_page_name (EOS_PAGE_MANAGER (fixture->pm), - fixture->page1, - NULL); - name = eos_page_manager_get_page_name (EOS_PAGE_MANAGER (fixture->pm), - fixture->page1); - g_assert (name == NULL); - name = eos_page_manager_get_visible_page_name (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (name == NULL); -} - -static void test_pm_no_background_uri (PageManagerFixture *fixture, gconstpointer unused) { @@ -420,43 +266,6 @@ test_pm_get_set_background_position (PageManagerFixture *fixture, } static void -test_pm_remove_page_behavior (PageManagerFixture *fixture, - gconstpointer unused) -{ - GtkWidget *visible_page; - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (visible_page == fixture->page1); - gtk_container_remove (GTK_CONTAINER (fixture->pm), fixture->page3); - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (visible_page == fixture->page1); - gtk_container_remove (GTK_CONTAINER (fixture->pm), fixture->page2); - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (visible_page == fixture->page1); - gtk_container_remove (GTK_CONTAINER (fixture->pm), fixture->page1); - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (visible_page == NULL); -} - -static void -test_pm_remove_page_undefined_behavior (PageManagerFixture *fixture, - gconstpointer unused) -{ - GtkWidget *visible_page; - GtkWidget *page1 = gtk_label_new ("page1"); - GtkWidget *page2 = gtk_label_new ("page2"); - gtk_container_add (GTK_CONTAINER (fixture->pm), page1); - gtk_container_add (GTK_CONTAINER (fixture->pm), page2); - eos_page_manager_set_visible_page (EOS_PAGE_MANAGER (fixture->pm), - page1); - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (visible_page == page1); - gtk_container_remove (GTK_CONTAINER (fixture->pm), page1); - // Only one page left, so it should be the visible page. - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (visible_page == page2); -} - -static void test_pm_remove_page_by_name (PageManagerFixture *fixture, gconstpointer unused) { @@ -474,130 +283,9 @@ test_pm_remove_page_by_name (PageManagerFixture *fixture, g_list_free (pages); } -static void -test_pm_duplicate_page_name (PageManagerFixture *fixture, - gconstpointer unused) -{ - eos_page_manager_set_page_name (EOS_PAGE_MANAGER (fixture->pm), - fixture->page1, - DUPLICATE_PAGE_NAME); - /* Should not complain */ - eos_page_manager_set_page_name (EOS_PAGE_MANAGER (fixture->pm), - fixture->page1, - DUPLICATE_PAGE_NAME); - - g_test_expect_message (TEST_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL, - EXPECTED_DUPLICATE_PAGE_NAME_ERRMSG); - eos_page_manager_set_page_name (EOS_PAGE_MANAGER (fixture->pm), - fixture->page2, - DUPLICATE_PAGE_NAME); - g_test_assert_expected_messages (); - - const gchar *name = eos_page_manager_get_page_name (EOS_PAGE_MANAGER (fixture->pm), - fixture->page2); - g_assert_cmpstr (name, !=, DUPLICATE_PAGE_NAME); -} - -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) -{ - GtkWidget *visible_page_get, *visible_page_prop; - visible_page_get = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (visible_page_get == NULL); - g_object_get (fixture->pm, "visible-page", &visible_page_prop, NULL); - g_assert (visible_page_prop == NULL); -} - -static void -test_empty_pm_visible_page_name (PageManagerFixture *fixture, - gconstpointer unused) -{ - const gchar *name_get; - gchar *name_prop; - name_get = eos_page_manager_get_visible_page_name (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (name_get == NULL); - g_object_get (fixture->pm, "visible-page-name", &name_prop, NULL); - g_assert (name_prop == NULL); -} - -static void -test_empty_pm_add_page_behavior (PageManagerFixture *fixture, - gconstpointer unused) -{ - GtkWidget *visible_page; - GtkWidget *page1 = gtk_label_new ("page1"); - GtkWidget *page2 = gtk_label_new ("page2"); - gtk_container_add (GTK_CONTAINER (fixture->pm), page1); - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (visible_page == page1); - gtk_container_add (GTK_CONTAINER (fixture->pm), page2); - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->pm)); - g_assert (visible_page == page1); /* Not page2! */ -} - void add_page_manager_tests (void) { - ADD_PAGE_MANAGER_TEST ("/page-manager/get-set-visible-page", - test_pm_get_set_visible_page); - ADD_PAGE_MANAGER_TEST ("/page-manager/prop-visible-page", - test_pm_prop_visible_page); - ADD_PAGE_MANAGER_TEST ("/page-manager/get-set-visible-page-name", - test_pm_get_set_visible_page_name); - ADD_PAGE_MANAGER_TEST ("/page-manager/prop-visible-page-name", - test_pm_prop_visible_page_name); - ADD_PAGE_MANAGER_TEST ("/page-manager/get-set-page-name", - test_pm_get_set_page_name); - ADD_PAGE_MANAGER_TEST ("/page-manager/child-prop-name", - test_pm_child_prop_name); - ADD_PAGE_MANAGER_TEST ("/page-manager/page-no-name", test_pm_page_no_name); - ADD_PAGE_MANAGER_TEST ("/page-manager/set-page-no-name", - test_pm_set_page_no_name); ADD_PAGE_MANAGER_TEST_WITH_ARGS ("/page-manager/child-prop-background-uri", test_pm_child_prop_string, "background-uri"); @@ -625,30 +313,4 @@ add_page_manager_tests (void) test_pm_child_prop_background_repeats); ADD_PAGE_MANAGER_TEST ("/page-manager/remove-page-by-name", 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", - test_empty_pm_visible_page_name); - ADD_EMPTY_PAGE_MANAGER_TEST ("/page-manager/add-page-behavior", - test_empty_pm_add_page_behavior); - - /* Disabled until https://bugzilla.gnome.org/show_bug.cgi?id=699756 is fixed - [endlessm/eos-sdk#67] */ - if (FALSE) - { - ADD_PAGE_MANAGER_TEST ("/page-manager/remove-page-behavior", - test_pm_remove_page_behavior); - ADD_EMPTY_PAGE_MANAGER_TEST ("/page-manager/remove-page-undefined-behavior", - test_pm_remove_page_undefined_behavior); - } } diff --git a/test/endless/test-splash-page-manager.c b/test/endless/test-splash-page-manager.c index 06105aa..735f872 100644 --- a/test/endless/test-splash-page-manager.c +++ b/test/endless/test-splash-page-manager.c @@ -24,10 +24,15 @@ 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 @@ -102,12 +107,12 @@ static void test_spm_show_main_page (SplashPageManagerFixture *fixture, gconstpointer unused) { - GtkWidget *visible_page; - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->spm)); - g_assert (visible_page != fixture->first_main_page); + 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_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->spm)); - g_assert (visible_page == fixture->first_main_page); + visible_child = gtk_stack_get_visible_child (GTK_STACK (fixture->spm)); + g_assert (visible_child == fixture->first_main_page); } @@ -115,15 +120,15 @@ static void test_spm_show_splash_page (SplashPageManagerFixture *fixture, gconstpointer unused) { - GtkWidget *visible_page; - visible_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->spm)); - g_assert (visible_page == fixture->first_splash_page); + 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_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->spm)); - g_assert (visible_page != fixture->first_splash_page); + 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_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->spm)); - g_assert (visible_page == 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 @@ -131,13 +136,13 @@ 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_page; + 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_page = eos_page_manager_get_visible_page (EOS_PAGE_MANAGER (fixture->spm)); - g_assert (visible_page == 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 diff --git a/test/smoke-tests/app-window.js b/test/smoke-tests/app-window.js index d7554b9..bbfd461 100644 --- a/test/smoke-tests/app-window.js +++ b/test/smoke-tests/app-window.js @@ -32,12 +32,12 @@ const Page0 = new Lang.Class ({ // Combo box for transition type... let typeMenu = new Gtk.ComboBoxText(); let type_options = { - "Transition type: None": Endless.PageManagerTransitionType.NONE, - "Transition type: Fade": Endless.PageManagerTransitionType.CROSSFADE, - "Transition type: Slide Right": Endless.PageManagerTransitionType.SLIDE_RIGHT, - "Transition type: Slide Left": Endless.PageManagerTransitionType.SLIDE_LEFT, - "Transition type: Slide Down": Endless.PageManagerTransitionType.SLIDE_DOWN, - "Transition type: Slide Up": Endless.PageManagerTransitionType.SLIDE_UP + "Transition type: None": Gtk.StackTransitionType.NONE, + "Transition type: Fade": Gtk.StackTransitionType.CROSSFADE, + "Transition type: Slide Right": Gtk.StackTransitionType.SLIDE_RIGHT, + "Transition type: Slide Left": Gtk.StackTransitionType.SLIDE_LEFT, + "Transition type: Slide Down": Gtk.StackTransitionType.SLIDE_DOWN, + "Transition type: Slide Up": Gtk.StackTransitionType.SLIDE_UP } for (let key in type_options) { typeMenu.append_text(key); @@ -90,33 +90,6 @@ const Page1 = new Lang.Class ({ } }); -const Toolbox = new Lang.Class ({ - Name: 'Toolbox', - Extends: Gtk.Grid, - - _init: function(props) { - props = props || {}; - props.orientation = Gtk.Orientation.VERTICAL; - this.parent(props); - - this._label = new Gtk.Label({ label: 'The Toolbox' }); - this._label1 = new Gtk.Label({ label: 'Actions on page 0' }); - this._label2 = new Gtk.Label({ label: 'Actions on page 1' }); - this.switch1 = new Gtk.Switch({ active: false }); - this.switch2 = new Gtk.Switch({ active: true }); - this.button1 = new Gtk.Button({ label: 'Scale font down' }); - this.button2 = new Gtk.Button({ label: 'Scale font up' }); - - this.add(this._label); - this.add(this._label1); - this.add(this.switch1); - this.add(this._label2); - this.add(this.switch2); - this.add(this.button1); - this.add(this.button2); - } -}); - const LeftTopbar = new Lang.Class ({ Name: 'LeftTopBar', Extends: Gtk.Grid, @@ -159,19 +132,19 @@ const TestApplication = new Lang.Class ({ // First page this._page0 = new Page0(this._pm); this._page0.button1.connect('clicked', Lang.bind(this, function () { - this._pm.visible_page = this._page1; + this._pm.visible_child = this._page1; })); this._page0.button2.connect('clicked', Lang.bind(this, function () { - this._pm.visible_page_name = "page1"; + this._pm.visible_child_name = "page1"; })); // Second page this._page1 = new Page1(); this._page1.button1.connect('clicked', Lang.bind(this, function () { - this._pm.visible_page = this._page0; + this._pm.visible_child = this._page0; })); this._page1.button2.connect('clicked', Lang.bind(this, function () { - this._pm.visible_page_name = "page0"; + this._pm.visible_child_name = "page0"; })); this._page1.button3.connect('clicked', Lang.bind(this, function () { this._setupDogBackground(this._page1); @@ -183,17 +156,6 @@ const TestApplication = new Lang.Class ({ this._setupCatBackground(this._page1); })); - - this._toolbox = new Toolbox(); - this._toolbox.switch1.connect('notify::active', Lang.bind(this, function () { - this._pm.set_page_actions(this._page0, - this._toolbox.switch1.active); - })); - this._toolbox.switch2.connect('notify::active', Lang.bind(this, function () { - this._pm.set_page_actions(this._page1, - this._toolbox.switch2.active); - })); - this._left_topbar = new LeftTopbar(); this._center_topbar = new CenterTopbar(); @@ -201,17 +163,14 @@ const TestApplication = new Lang.Class ({ this._pm.add(this._page0, { name: "page0", background_uri: CAT_BACKGROUND_PATH, - custom_toolbox_widget: this._toolbox, left_topbar_widget: this._left_topbar, center_topbar_widget: this._center_topbar }); this._pm.add(this._page1, { name: "page1", - custom_toolbox_widget: this._toolbox, left_topbar_widget: this._left_topbar, - center_topbar_widget: this._center_topbar, - page_actions: true + center_topbar_widget: this._center_topbar }); this._setupDogBackground(this._page0); @@ -224,15 +183,6 @@ const TestApplication = new Lang.Class ({ 'font-scaling-default-size': 16 }); - this._toolbox.button1.connect('clicked', Lang.bind(this, function () { - let current_font_size = this._window.get_font_scaling_default_size(); - this._window.set_font_scaling_default_size(current_font_size - 1); - })); - this._toolbox.button2.connect('clicked', Lang.bind(this, function () { - let current_font_size = this._window.get_font_scaling_default_size(); - this._window.set_font_scaling_default_size(current_font_size + 1); - })); - let provider = new Gtk.CssProvider(); provider.load_from_data("EosWindow { font-size: 1em; }"); Gtk.StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, diff --git a/test/smoke-tests/webhelper/webview.js b/test/smoke-tests/webhelper/webview.js index a3b91e5..a1dba65 100644 --- a/test/smoke-tests/webhelper/webview.js +++ b/test/smoke-tests/webhelper/webview.js @@ -64,7 +64,7 @@ const TestApplication = new Lang.Class({ /* dict['name'] is the name of the page to move to */ moveToPage: function(dict) { - this._pm.visible_page_name = dict['name']; + this._pm.visible_child_name = dict['name']; }, /* dict['msg'] is the message to display */ @@ -134,7 +134,7 @@ const TestApplication = new Lang.Class({ this._page2 = new Gtk.Grid(); let back_button = new Gtk.Button({ label:"Go back to page 1" }); back_button.connect('clicked', Lang.bind(this, function() { - this._pm.visible_page_name = 'page1'; + this._pm.visible_child_name = 'page1'; })); this._page2.add(back_button); @@ -144,10 +144,10 @@ const TestApplication = new Lang.Class({ }); this._pm = this._window.page_manager; - this._pm.set_transition_type(Endless.PageManagerTransitionType.CROSSFADE); + this._pm.set_transition_type(Gtk.StackTransitionType.CROSSFADE); this._pm.add(this._page1, { name: 'page1' }); this._pm.add(this._page2, { name: 'page2' }); - this._pm.visible_page = this._page1; + this._pm.visible_child = this._page1; this._window.show_all(); } |