diff options
| author | Andrea Azzarone <azzaronea@gmail.com> | 2012-08-13 11:44:44 +0200 |
|---|---|---|
| committer | Andrea Azzarone <azzaronea@gmail.com> | 2012-08-13 11:44:44 +0200 |
| commit | db657a883c16eb84192d344278cde4b91f689346 (patch) | |
| tree | c126f2826b1ebf90ffa7740aa6aff797d8ad32bf /tests | |
| parent | 9de6e1eca64b685b216d3c3470ffe018a6053299 (diff) | |
| parent | 0c9f0ef0dda3d34abf3de49d98a620614b37d8c1 (diff) | |
Merge trunk.
(bzr r2540.4.4)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/autopilot/unity/tests/launcher/test_icon_behavior.py | 58 | ||||
| -rw-r--r-- | tests/autopilot/unity/tests/test_dash.py | 11 | ||||
| -rw-r--r-- | tests/autopilot/unity/tests/test_panel.py | 4 | ||||
| -rw-r--r-- | tests/autopilot/unity/tests/test_quicklist.py | 36 | ||||
| -rw-r--r-- | tests/autopilot/unity/tests/test_switcher.py | 36 | ||||
| -rw-r--r-- | tests/test_favorite_store_gsettings.cpp | 1 | ||||
| -rw-r--r-- | tests/test_launcher.cpp | 13 | ||||
| -rw-r--r-- | tests/test_launcher_controller.cpp | 32 |
8 files changed, 110 insertions, 81 deletions
diff --git a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py index bd6eab38c..798283d21 100644 --- a/tests/autopilot/unity/tests/launcher/test_icon_behavior.py +++ b/tests/autopilot/unity/tests/launcher/test_icon_behavior.py @@ -66,50 +66,50 @@ class LauncherIconsTests(LauncherTestCase): of that application. """ - mah_win1 = self.start_app_window("Mahjongg") + char_win1 = self.start_app_window("Character Map") calc_win = self.start_app_window("Calculator") - mah_win2 = self.start_app_window("Mahjongg") + char_win2 = self.start_app_window("Character Map") - self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1]) + self.assertVisibleWindowStack([char_win2, calc_win, char_win1]) - mahj_icon = self.launcher.model.get_icon( - desktop_id=mah_win2.application.desktop_file) + char_icon = self.launcher.model.get_icon( + desktop_id=char_win2.application.desktop_file) calc_icon = self.launcher.model.get_icon( desktop_id=calc_win.application.desktop_file) self.launcher_instance.click_launcher_icon(calc_icon) self.assertProperty(calc_win, is_focused=True) - self.assertVisibleWindowStack([calc_win, mah_win2, mah_win1]) + self.assertVisibleWindowStack([calc_win, char_win2, char_win1]) - self.launcher_instance.click_launcher_icon(mahj_icon) - self.assertProperty(mah_win2, is_focused=True) - self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1]) + self.launcher_instance.click_launcher_icon(char_icon) + self.assertProperty(char_win2, is_focused=True) + self.assertVisibleWindowStack([char_win2, calc_win, char_win1]) self.keybinding("window/minimize") - self.assertThat(lambda: mah_win2.is_hidden, Eventually(Equals(True))) + self.assertThat(lambda: char_win2.is_hidden, Eventually(Equals(True))) self.assertProperty(calc_win, is_focused=True) - self.assertVisibleWindowStack([calc_win, mah_win1]) + self.assertVisibleWindowStack([calc_win, char_win1]) - self.launcher_instance.click_launcher_icon(mahj_icon) - self.assertProperty(mah_win1, is_focused=True) - self.assertThat(lambda: mah_win2.is_hidden, Eventually(Equals(True))) - self.assertVisibleWindowStack([mah_win1, calc_win]) + self.launcher_instance.click_launcher_icon(char_icon) + self.assertProperty(char_win1, is_focused=True) + self.assertThat(lambda: char_win2.is_hidden, Eventually(Equals(True))) + self.assertVisibleWindowStack([char_win1, calc_win]) def test_clicking_icon_twice_initiates_spread(self): """This tests shows that when you click on a launcher icon twice, when an application window is focused, the spread is initiated. """ - calc_win1 = self.start_app_window("Calculator") - calc_win2 = self.start_app_window("Calculator") - calc_app = calc_win1.application + char_win1 = self.start_app_window("Character Map") + char_win2 = self.start_app_window("Character Map") + char_app = char_win1.application - self.assertVisibleWindowStack([calc_win2, calc_win1]) - self.assertProperty(calc_win2, is_focused=True) + self.assertVisibleWindowStack([char_win2, char_win1]) + self.assertProperty(char_win2, is_focused=True) - calc_icon = self.launcher.model.get_icon(desktop_id=calc_app.desktop_file) + char_icon = self.launcher.model.get_icon(desktop_id=char_app.desktop_file) self.addCleanup(self.keybinding, "spread/cancel") - self.launcher_instance.click_launcher_icon(calc_icon) + self.launcher_instance.click_launcher_icon(char_icon) self.assertThat(self.window_manager.scale_active, Eventually(Equals(True))) self.assertThat(self.window_manager.scale_active_for_group, Eventually(Equals(True))) @@ -118,15 +118,15 @@ class LauncherIconsTests(LauncherTestCase): """If scale is initiated through the laucher pressing super must close scale and open the dash. """ - calc_win1 = self.start_app_window("Calculator") - calc_win2 = self.start_app_window("Calculator") - calc_app = calc_win1.application + char_win1 = self.start_app_window("Character Map") + char_win2 = self.start_app_window("Character Map") + char_app = char_win1.application - self.assertVisibleWindowStack([calc_win2, calc_win1]) - self.assertProperty(calc_win2, is_focused=True) + self.assertVisibleWindowStack([char_win2, char_win1]) + self.assertProperty(char_win2, is_focused=True) - calc_icon = self.launcher.model.get_icon(desktop_id=calc_app.desktop_file) - self.launcher_instance.click_launcher_icon(calc_icon) + char_icon = self.launcher.model.get_icon(desktop_id=char_app.desktop_file) + self.launcher_instance.click_launcher_icon(char_icon) self.assertThat(self.window_manager.scale_active, Eventually(Equals(True))) self.dash.ensure_visible() diff --git a/tests/autopilot/unity/tests/test_dash.py b/tests/autopilot/unity/tests/test_dash.py index 18190cb16..7f932c102 100644 --- a/tests/autopilot/unity/tests/test_dash.py +++ b/tests/autopilot/unity/tests/test_dash.py @@ -8,11 +8,10 @@ from __future__ import absolute_import -from time import sleep - +from autopilot.emulators.clipboard import get_clipboard_contents from autopilot.matchers import Eventually -from gtk import Clipboard from testtools.matchers import Equals, NotEquals +from time import sleep from unity.tests import UnityTestCase @@ -305,8 +304,7 @@ class DashClipboardTests(DashTestCase): self.keyboard.press_and_release("Ctrl+a") self.keyboard.press_and_release("Ctrl+c") - cb = Clipboard(selection="CLIPBOARD") - self.assertThat(self.dash.search_string, Eventually(Equals(cb.wait_for_text()))) + self.assertThat(get_clipboard_contents, Eventually(Equals("Copy"))) def test_ctrl_x(self): """ This test if ctrl+x deletes all text and copys it """ @@ -319,8 +317,7 @@ class DashClipboardTests(DashTestCase): self.keyboard.press_and_release("Ctrl+x") self.assertThat(self.dash.search_string, Eventually(Equals(""))) - cb = Clipboard(selection="CLIPBOARD") - self.assertEqual(cb.wait_for_text(), u'Cut') + self.assertThat(get_clipboard_contents, Eventually(Equals('Cut'))) def test_ctrl_c_v(self): """ This test if ctrl+c and ctrl+v copies and pastes text""" diff --git a/tests/autopilot/unity/tests/test_panel.py b/tests/autopilot/unity/tests/test_panel.py index d17e52f5c..74a9504a0 100644 --- a/tests/autopilot/unity/tests/test_panel.py +++ b/tests/autopilot/unity/tests/test_panel.py @@ -807,10 +807,10 @@ class PanelMenuTests(PanelTestsBase): def test_menus_dont_show_if_a_new_application_window_is_opened(self): """This tests the menu discovery feature on new window for a know application.""" - self.open_new_application_window("Calculator") + self.open_new_application_window("Character Map") self.sleep_menu_settle_period() - self.start_app("Calculator") + self.start_app("Character Map") sleep(self.panel.menus.fadein_duration / 1000.0) # Not using Eventually here since this is time-critical. Need to work # out a better way to do this. diff --git a/tests/autopilot/unity/tests/test_quicklist.py b/tests/autopilot/unity/tests/test_quicklist.py index 03d9747a2..37b354fa2 100644 --- a/tests/autopilot/unity/tests/test_quicklist.py +++ b/tests/autopilot/unity/tests/test_quicklist.py @@ -72,14 +72,14 @@ class QuicklistActionTests(UnityTestCase): Then we activate the Calculator quicklist item. Then we actiavte the Mahjongg launcher icon. """ - mah_win1 = self.start_app_window("Mahjongg") + char_win1 = self.start_app_window("Character Map") calc_win = self.start_app_window("Calculator") - mah_win2 = self.start_app_window("Mahjongg") + char_win2 = self.start_app_window("Character Map") - self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1]) + self.assertVisibleWindowStack([char_win2, calc_win, char_win1]) - mahj_icon = self.launcher.model.get_icon( - desktop_id=mah_win1.application.desktop_file) + char_icon = self.launcher.model.get_icon( + desktop_id=char_win1.application.desktop_file) calc_icon = self.launcher.model.get_icon( desktop_id=calc_win.application.desktop_file) @@ -87,29 +87,29 @@ class QuicklistActionTests(UnityTestCase): calc_ql.get_quicklist_application_item(calc_win.application.name).mouse_click() self.assertProperty(calc_win, is_focused=True) - self.assertVisibleWindowStack([calc_win, mah_win2, mah_win1]) + self.assertVisibleWindowStack([calc_win, char_win2, char_win1]) - mahj_ql = self.open_quicklist_for_icon(mahj_icon) - mahj_ql.get_quicklist_application_item(mah_win1.application.name).mouse_click() + char_ql = self.open_quicklist_for_icon(char_icon) + char_ql.get_quicklist_application_item(char_win1.application.name).mouse_click() - self.assertProperty(mah_win2, is_focused=True) - self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1]) + self.assertProperty(char_win2, is_focused=True) + self.assertVisibleWindowStack([char_win2, calc_win, char_win1]) def test_quicklist_application_item_initiate_spread(self): """This tests shows that when you activate a quicklist application item when an application window is focused, the spread is initiated. """ - calc_win1 = self.start_app_window("Calculator") - calc_win2 = self.start_app_window("Calculator") - calc_app = calc_win1.application + char_win1 = self.start_app_window("Character Map") + char_win2 = self.start_app_window("Character Map") + char_app = char_win1.application - self.assertVisibleWindowStack([calc_win2, calc_win1]) - self.assertProperty(calc_win2, is_focused=True) + self.assertVisibleWindowStack([char_win2, char_win1]) + self.assertProperty(char_win2, is_focused=True) - calc_icon = self.launcher.model.get_icon(desktop_id=calc_app.desktop_file) + char_icon = self.launcher.model.get_icon(desktop_id=char_app.desktop_file) - calc_ql = self.open_quicklist_for_icon(calc_icon) - app_item = calc_ql.get_quicklist_application_item(calc_app.name) + char_ql = self.open_quicklist_for_icon(char_icon) + app_item = char_ql.get_quicklist_application_item(char_app.name) self.addCleanup(self.keybinding, "spread/cancel") app_item.mouse_click() diff --git a/tests/autopilot/unity/tests/test_switcher.py b/tests/autopilot/unity/tests/test_switcher.py index 4b33b4ff4..8e7704e91 100644 --- a/tests/autopilot/unity/tests/test_switcher.py +++ b/tests/autopilot/unity/tests/test_switcher.py @@ -46,9 +46,9 @@ class SwitcherTestCase(UnityTestCase): """Start some applications, returning their windows. If no applications are specified, the following will be started: - * Character Map - * Calculator * Calculator + * Character Map + * Character Map Windows are always started in the order that they are specified (which means the last specified application will *probably* be at the top of the @@ -57,7 +57,7 @@ class SwitcherTestCase(UnityTestCase): """ if len(args) == 0: - args = ('Character Map', 'Calculator', 'Calculator') + args = ('Calculator', 'Character Map', 'Character Map') windows = [] for app in args: windows.append(self.start_app_window(app)) @@ -231,20 +231,20 @@ class SwitcherWindowsManagementTests(SwitcherTestCase): Then we close the currently focused window. """ - mah_win1, calc_win, mah_win2 = self.start_applications("Mahjongg", "Calculator", "Mahjongg") - self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1]) + char_win1, calc_win, char_win2 = self.start_applications("Character Map", "Calculator", "Character Map") + self.assertVisibleWindowStack([char_win2, calc_win, char_win1]) self.keybinding("switcher/reveal_normal") self.assertProperty(calc_win, is_focused=True) - self.assertVisibleWindowStack([calc_win, mah_win2, mah_win1]) + self.assertVisibleWindowStack([calc_win, char_win2, char_win1]) self.keybinding("switcher/reveal_normal") - self.assertProperty(mah_win2, is_focused=True) - self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1]) + self.assertProperty(char_win2, is_focused=True) + self.assertVisibleWindowStack([char_win2, calc_win, char_win1]) self.keybinding("window/close") self.assertProperty(calc_win, is_focused=True) - self.assertVisibleWindowStack([calc_win, mah_win1]) + self.assertVisibleWindowStack([calc_win, char_win1]) class SwitcherDetailsTests(SwitcherTestCase): @@ -338,17 +338,17 @@ class SwitcherDetailsModeTests(SwitcherTestCase): """The active selection in detail mode must be the last focused window. If it was the currently active application type. """ - calc_win1, calc_win2 = self.start_applications("Calculator", "Calculator") - self.assertVisibleWindowStack([calc_win2, calc_win1]) + char_win1, char_win2 = self.start_applications("Character Map", "Character Map") + self.assertVisibleWindowStack([char_win2, char_win1]) self.switcher.initiate() - while self.switcher.current_icon.tooltip_text != calc_win2.application.name: + while self.switcher.current_icon.tooltip_text != char_win2.application.name: self.switcher.next_icon() self.keyboard.press_and_release(self.initiate_keycode) sleep(0.5) self.switcher.select() - self.assertProperty(calc_win1, is_focused=True) + self.assertProperty(char_win1, is_focused=True) class SwitcherWorkspaceTests(SwitcherTestCase): @@ -402,18 +402,18 @@ class SwitcherWorkspaceTests(SwitcherTestCase): self.set_unity_option("alt_tab_timeout", False) self.workspace.switch_to(1) - self.start_app("Mahjongg") + self.start_app("Character Map") self.workspace.switch_to(3) - mah_win2 = self.start_app_window("Mahjongg") + char_win2 = self.start_app_window("Character Map") self.keybinding("window/minimize") - self.assertProperty(mah_win2, is_hidden=True) + self.assertProperty(char_win2, is_hidden=True) self.start_app("Calculator") self.switcher.initiate() - while self.switcher.current_icon.tooltip_text != mah_win2.application.name: + while self.switcher.current_icon.tooltip_text != char_win2.application.name: self.switcher.next_icon() self.switcher.select() - self.assertProperty(mah_win2, is_hidden=False) + self.assertProperty(char_win2, is_hidden=False) diff --git a/tests/test_favorite_store_gsettings.cpp b/tests/test_favorite_store_gsettings.cpp index c491efce3..245fcd001 100644 --- a/tests/test_favorite_store_gsettings.cpp +++ b/tests/test_favorite_store_gsettings.cpp @@ -88,7 +88,6 @@ public: // Setting the test values gsettings_client = g_settings_new(SETTINGS_NAME); - g_settings_set_strv(gsettings_client, SETTINGS_KEY, NULL); g_settings_set_strv(gsettings_client, SETTINGS_KEY, base_store_favs); } diff --git a/tests/test_launcher.cpp b/tests/test_launcher.cpp index 9e2e037f1..d5f0bb318 100644 --- a/tests/test_launcher.cpp +++ b/tests/test_launcher.cpp @@ -104,9 +104,9 @@ TEST_F(TestLauncher, TestQuirksDuringDnd) Utils::WaitForTimeout(1); - EXPECT_FALSE(first->GetQuirk(AbstractLauncherIcon::QUIRK_DESAT)); - EXPECT_FALSE(second->GetQuirk(AbstractLauncherIcon::QUIRK_DESAT)); - EXPECT_TRUE(third->GetQuirk(AbstractLauncherIcon::QUIRK_DESAT)); + EXPECT_FALSE(first->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT)); + EXPECT_FALSE(second->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT)); + EXPECT_TRUE(third->GetQuirk(launcher::AbstractLauncherIcon::Quirk::DESAT)); } @@ -124,9 +124,9 @@ TEST_F(TestLauncher, TestIconBackgroundIntensity) options_->backlight_mode = BACKLIGHT_NORMAL; options_->launch_animation = LAUNCH_ANIMATION_PULSE; - first->SetQuirk(AbstractLauncherIcon::QUIRK_RUNNING, true); - second->SetQuirk(AbstractLauncherIcon::QUIRK_RUNNING, true); - third->SetQuirk(AbstractLauncherIcon::QUIRK_RUNNING, false); + first->SetQuirk(AbstractLauncherIcon::Quirk::RUNNING, true); + second->SetQuirk(AbstractLauncherIcon::Quirk::RUNNING, true); + third->SetQuirk(AbstractLauncherIcon::Quirk::RUNNING, false); Utils::WaitForTimeoutMSec(STARTING_ANIMATION_DURATION); timespec current; @@ -139,3 +139,4 @@ TEST_F(TestLauncher, TestIconBackgroundIntensity) } } + diff --git a/tests/test_launcher_controller.cpp b/tests/test_launcher_controller.cpp index d3908b789..16fbbf5ee 100644 --- a/tests/test_launcher_controller.cpp +++ b/tests/test_launcher_controller.cpp @@ -49,6 +49,17 @@ private: FavoriteList fav_list_; }; +class MockBamfLauncherIcon : public BamfLauncherIcon +{ +public: + //typedef nux::ObjectPtr<MockMockLauncherIcon> Ptr; + MockBamfLauncherIcon(BamfApplication* app) + : BamfLauncherIcon(app) {} + + MOCK_METHOD0(UnStick, void()); + MOCK_METHOD0(Quit, void()); +}; + namespace launcher { class TestLauncherController : public testing::Test @@ -70,6 +81,11 @@ protected: return lc.pimpl->edge_barriers_; } + LauncherModel::Ptr GetLauncherModel() + { + return lc.pimpl->model_; + } + MockUScreen uscreen; Settings settings; panel::Style panel_style; @@ -198,4 +214,20 @@ TEST_F(TestLauncherController, SingleMonitorEdgeBarrierSubscriptionsUpdates) } } +TEST_F(TestLauncherController, OnlyUnstickIconOnFavoriteRemoval) +{ + const std::string USC_DESKTOP = BUILDDIR"/tests/data/ubuntu-software-center.desktop"; + + glib::Object<BamfMatcher> matcher(bamf_matcher_get_default()); + + auto bamf_app = bamf_matcher_get_application_for_desktop_file(matcher, USC_DESKTOP.c_str(), TRUE); + MockBamfLauncherIcon *bamf_icon = new MockBamfLauncherIcon(bamf_app); + GetLauncherModel()->AddIcon(AbstractLauncherIcon::Ptr(bamf_icon)); + + EXPECT_CALL(*bamf_icon, UnStick()); + EXPECT_CALL(*bamf_icon, Quit()).Times(0); + + favorite_store.favorite_removed.emit(USC_DESKTOP); +} + } |
