diff options
author | Matt Watson <mattdangerw@gmail.com> | 2014-05-12 18:48:47 -0700 |
---|---|---|
committer | Matt Watson <mattdangerw@gmail.com> | 2014-05-13 12:50:08 -0700 |
commit | 742e9677579996cd4eff0f5c2aae0ab3446b6809 (patch) | |
tree | 4b623da16e97fade4c5a89928736dde7ef35837f /test | |
parent | b1b7b8a001ab2f50f93c751f025f83ee12fcfac0 (diff) |
Remove action menu
Wasn't getting used in any apps so we are taking it out
[endlessm/eos-sdk#985]
Diffstat (limited to 'test')
-rw-r--r-- | test/endless/Makefile.am.inc | 1 | ||||
-rw-r--r-- | test/endless/run-tests.c | 1 | ||||
-rw-r--r-- | test/endless/test-action-menu.c | 217 | ||||
-rw-r--r-- | test/smoke-tests/action-buttons.js | 126 |
4 files changed, 0 insertions, 345 deletions
diff --git a/test/endless/Makefile.am.inc b/test/endless/Makefile.am.inc index 76a29ec..87a1db6 100644 --- a/test/endless/Makefile.am.inc +++ b/test/endless/Makefile.am.inc @@ -8,7 +8,6 @@ test_endless_run_tests_SOURCES = \ $(ENDLESS_TESTS_DIRECTORY)/endless/test-application.c \ $(ENDLESS_TESTS_DIRECTORY)/endless/test-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 \ $(ENDLESS_TESTS_DIRECTORY)/endless/test-flexy-grid.c \ $(ENDLESS_TESTS_DIRECTORY)/endless/test-custom-container.c \ diff --git a/test/endless/run-tests.c b/test/endless/run-tests.c index 506224b..81823ad 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_action_menu_tests (); add_action_button_tests (); add_flexy_grid_test (); add_custom_container_tests (); diff --git a/test/endless/test-action-menu.c b/test/endless/test-action-menu.c deleted file mode 100644 index 0450f6c..0000000 --- a/test/endless/test-action-menu.c +++ /dev/null @@ -1,217 +0,0 @@ -#include <gtk/gtk.h> -#include <endless/endless.h> - -#include <endless/eosactionmenu-private.h> - -#include "run-tests.h" - -#include "endless/eosactionmenu.c" - -#define ADD_ACTION_MENU_TEST(path, test_func) \ - g_test_add ((path), ActionMenuFixture, NULL, \ - am_fixture_setup, (test_func), am_fixture_teardown) - -typedef struct -{ - EosActionMenu *action_menu; - GtkAction *action1; - GtkAction *action2; - GtkAction *action3; -} ActionMenuFixture; - -static void -am_fixture_setup (ActionMenuFixture *fixture, - gconstpointer unused) -{ - fixture->action_menu = EOS_ACTION_MENU (eos_action_menu_new ()); - fixture->action1 = gtk_action_new ("1", "1", "1", "1"); - fixture->action2 = gtk_action_new ("2", "2", "2", "2"); - fixture->action3 = gtk_action_new ("3", "3", "3", "3"); - - g_object_ref (fixture->action1); - g_object_ref (fixture->action2); - g_object_ref (fixture->action3); -} - -static void -am_fixture_teardown (ActionMenuFixture *fixture, - gconstpointer unused) -{ - gtk_widget_destroy (GTK_WIDGET (fixture->action_menu)); - g_object_unref (fixture->action1); - g_object_unref (fixture->action2); - g_object_unref (fixture->action3); -} - -/* TESTS */ - -static void -test_am_add_action (ActionMenuFixture *fixture, - gconstpointer unused) -{ - gint size; - gchar *label, *icon_id; - - gtk_action_set_is_important (fixture->action1, TRUE); - gtk_action_set_icon_name (fixture->action1, "object-select-symbolic"); - - eos_action_menu_add_action (fixture->action_menu, fixture->action1); - - EosActionMenuPrivate *action_menu_priv = eos_action_menu_get_instance_private (fixture->action_menu); - GtkWidget *button = gtk_grid_get_child_at (GTK_GRID (action_menu_priv->center_grid), 0, 0); - - g_assert (EOS_IS_ACTION_BUTTON (button)); - - g_object_get (button, - "size", &size, - "label", &label, - "icon-id", &icon_id, - NULL); - - g_assert ( size == EOS_ACTION_BUTTON_SIZE_PRIMARY); - g_assert ( g_strcmp0 (label, gtk_action_get_label (fixture->action1)) == 0); - g_assert ( g_strcmp0 (icon_id, gtk_action_get_icon_name (fixture->action1)) == 0); - - g_free (label); - g_free (icon_id); -} - -static void -test_am_get_action (ActionMenuFixture *fixture, - gconstpointer unused) -{ - eos_action_menu_add_action (fixture->action_menu, fixture->action1); - - GtkAction *retrieved = eos_action_menu_get_action (fixture->action_menu, "1"); - - g_assert (retrieved == fixture->action1); -} - -static void -test_am_list_actions (ActionMenuFixture *fixture, - gconstpointer unused) -{ - GList *list = eos_action_menu_list_actions (fixture->action_menu); - - g_assert (list == NULL); - - eos_action_menu_add_action (fixture->action_menu, fixture->action1); - eos_action_menu_add_action (fixture->action_menu, fixture->action2); - - list = eos_action_menu_list_actions (fixture->action_menu); - - g_assert (g_list_find (list, fixture->action1) != NULL); - g_assert (g_list_find (list, fixture->action2) != NULL); - - g_assert (g_list_find (list, fixture->action3) == NULL); -} - -static gboolean -menu_contains_button_with_label (EosActionMenu *menu, const gchar* button_label) -{ - GList* children; - gboolean found = FALSE; - - EosActionMenuPrivate *action_menu_priv = eos_action_menu_get_instance_private (menu); - children = gtk_container_get_children (GTK_CONTAINER (action_menu_priv->center_grid)); - - children = g_list_concat (children, - gtk_container_get_children (GTK_CONTAINER (action_menu_priv->bottom_grid))); - - for (GList *i = children; i != NULL ; i = i->next) - { - if (EOS_IS_ACTION_BUTTON (i->data)) - { - if (g_strcmp0 (eos_action_button_get_label (EOS_ACTION_BUTTON (i->data)), - button_label) == 0) - { - found = TRUE; - break; - } - } - } - - g_list_free (children); - - return found; -} - -static void -test_am_remove_action (ActionMenuFixture *fixture, - gconstpointer unused) -{ - GList *list; - - eos_action_menu_add_action (fixture->action_menu, fixture->action1); - eos_action_menu_add_action (fixture->action_menu, fixture->action2); - eos_action_menu_add_action (fixture->action_menu, fixture->action3); - - eos_action_menu_remove_action (fixture->action_menu, fixture->action2); - - list = eos_action_menu_list_actions (fixture->action_menu); - - g_assert (g_list_find (list, fixture->action1) != NULL); - g_assert (g_list_find (list, fixture->action2) == NULL); - g_assert (g_list_find (list, fixture->action3) != NULL); - - // the buttons have been removed as well - g_assert (menu_contains_button_with_label (fixture->action_menu, - gtk_action_get_label (fixture->action1))); - g_assert (!menu_contains_button_with_label (fixture->action_menu, - gtk_action_get_label (fixture->action2))); - g_assert (menu_contains_button_with_label (fixture->action_menu, - gtk_action_get_label (fixture->action3))); - - eos_action_menu_remove_action (fixture->action_menu, fixture->action1); - eos_action_menu_remove_action (fixture->action_menu, fixture->action3); - - list = eos_action_menu_list_actions (fixture->action_menu); - - g_assert (g_list_find (list, fixture->action1) == NULL); - g_assert (g_list_find (list, fixture->action2) == NULL); - g_assert (g_list_find (list, fixture->action3) == NULL); - - // the container is empty - EosActionMenuPrivate *action_menu_priv = eos_action_menu_get_instance_private (fixture->action_menu); - g_assert (gtk_container_get_children (GTK_CONTAINER (action_menu_priv->center_grid)) == NULL); - g_assert (gtk_container_get_children (GTK_CONTAINER (action_menu_priv->bottom_grid)) == NULL); -} - -static void -test_am_remove_action_by_name (ActionMenuFixture *fixture, - gconstpointer unused) -{ - eos_action_menu_add_action (fixture->action_menu, fixture->action1); - eos_action_menu_add_action (fixture->action_menu, fixture->action2); - eos_action_menu_add_action (fixture->action_menu, fixture->action3); - - eos_action_menu_remove_action_by_name (fixture->action_menu, "2"); - - GList *list = eos_action_menu_list_actions (fixture->action_menu); - - g_assert (g_list_find (list, fixture->action1) != NULL); - g_assert (g_list_find (list, fixture->action2) == NULL); - g_assert (g_list_find (list, fixture->action3) != NULL); - - g_assert (menu_contains_button_with_label (fixture->action_menu, - gtk_action_get_label (fixture->action1))); - g_assert (!menu_contains_button_with_label (fixture->action_menu, - gtk_action_get_label (fixture->action2))); - g_assert (menu_contains_button_with_label (fixture->action_menu, - gtk_action_get_label (fixture->action3))); -} - -void -add_action_menu_tests (void) -{ - ADD_ACTION_MENU_TEST ("/action-menu/add-action", - test_am_add_action); - ADD_ACTION_MENU_TEST ("/action-menu/get-action", - test_am_get_action); - ADD_ACTION_MENU_TEST ("/action-menu/list-actions", - test_am_list_actions); - ADD_ACTION_MENU_TEST ("/action-menu/remove-action", - test_am_remove_action); - ADD_ACTION_MENU_TEST ("/action-menu/remove-action-by-name", - test_am_remove_action_by_name); -} diff --git a/test/smoke-tests/action-buttons.js b/test/smoke-tests/action-buttons.js deleted file mode 100644 index 476912a..0000000 --- a/test/smoke-tests/action-buttons.js +++ /dev/null @@ -1,126 +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-action-buttons'; - -const TestApplication = new Lang.Class ({ - Name: 'TestApplication', - Extends: Endless.Application, - - vfunc_startup: function() { - this.parent(); - - this._page = new Gtk.Grid (); - - this._content = new Gtk.Grid ({ - hexpand: true, - halign: Gtk.Align.CENTER, - vexpand: true, - valign: Gtk.Align.CENTER}); - - this._darkSwitch = new Gtk.Switch ({active: false}); - this._darkSwitch.connect ('notify::active', Lang.bind (this, function (active) { - if (this._darkSwitch.get_active()) { - this._menu.get_style_context().add_class('dark'); - } else { - this._menu.get_style_context().remove_class('dark'); - } - })); - this._content.attach(new Gtk.Label ({label: 'Dark action menu'}), 0, 0, 1, 1); - this._content.attach(this._darkSwitch, 1, 0, 1, 1); - - this._content.attach (new Endless.ActionButton({ - name: 'LEFT', - 'icon-id': 'object-select-symbolic', - label: 'LEFT', - 'label-position': Gtk.PositionType.LEFT - }), 0, 1, 1, 1); - this._content.attach (new Endless.ActionButton({ - name: 'TOP', - 'icon-id': 'object-select-symbolic', - label: 'TOP', - 'label-position': Gtk.PositionType.TOP - }), 1, 1, 1, 1); - this._content.attach (new Endless.ActionButton({ - name: 'BOTTOM', - 'icon-id': 'object-select-symbolic', - label: 'BOTTOM', - 'label-position': Gtk.PositionType.BOTTOM - }), 0, 2, 1, 1); - this._content.attach (new Endless.ActionButton({ - name: 'RIGHT', - 'icon-id': 'object-select-symbolic', - label: 'RIGHT', - 'label-position': Gtk.PositionType.RIGHT - }), 1, 2, 1, 1); - - this._menu = new Endless.ActionMenu ({name: 'menu'}); - - // the ActionMenu takes 1/6 of the width - this._page.set_column_homogeneous (true); - this._page.attach (this._content, 0, 0, 5, 1); - this._page.attach (this._menu, 5, 0, 1, 1); - - this._menu.add_action ({ - name: 'select', - 'icon-name': 'object-select-symbolic', - label: 'SELECT', - 'is-important': true }, - Lang.bind(this, function () { - var md = new Gtk.MessageDialog({modal:true, title:"Information", - message_type:Gtk.MessageType.INFO, - buttons:Gtk.ButtonsType.OK, text:"Select button pressed!"}); - md.run(); - md.destroy(); - })); - - this._menu.add_action ({ - name: 'delete', - 'icon-name': 'edit-delete-symbolic', - label: 'DELETE', - 'is-important': false, - 'stock-id': Gtk.STOCK_DELETE }); - - this._menu.add_action ({ - name: 'smile', - 'icon-name': 'face-smile-symbolic', - label: 'SMILE', - 'is-important': false }); - - this._menu.add_action ({ - name: 'sadface', - 'icon-name': 'face-sad-symbolic', - label: 'SAD FACE', - 'is-important': false }); - - this._pm = new Endless.PageManager(); - this._pm.add(this._page, { name: "page" }); - - let provider = new Gtk.CssProvider (); - provider.load_from_path ('./test/smoke-tests/eosactionbutton.css'); - - this._window = new Endless.Window({ - application: this, - border_width: 1, - page_manager: this._pm - }); - - let context = new Gtk.StyleContext(); - context.add_provider_for_screen(this._window.get_screen(), - provider, - Gtk.STYLE_PROVIDER_PRIORITY_USER); - - this._window.show_all(); - }, - - _onButtonClicked: function () { - this._window.destroy(); - }, -}); - -let app = new TestApplication({ application_id: TEST_APPLICATION_ID, - flags: 0 }); -app.run(ARGV); |