75
72
Then we activate the Calculator quicklist item.
76
73
Then we actiavte the Mahjongg launcher icon.
78
mahj = self.start_app("Mahjongg")
79
[mah_win1] = mahj.get_windows()
80
self.assertTrue(mah_win1.is_focused)
82
calc = self.start_app("Calculator")
83
[calc_win] = calc.get_windows()
84
self.assertTrue(calc_win.is_focused)
86
self.start_app("Mahjongg")
87
# Sleeping due to the start_app only waiting for the bamf model to be
88
# updated with the application. Since the app has already started,
89
# and we are just waiting on a second window, however a defined sleep
90
# here is likely to be problematic.
91
# TODO: fix bamf emulator to enable waiting for new windows.
93
[mah_win2] = [w for w in mahj.get_windows() if w.x_id != mah_win1.x_id]
94
self.assertTrue(mah_win2.is_focused)
75
mah_win1 = self.start_app_window("Mahjongg")
76
calc_win = self.start_app_window("Calculator")
77
mah_win2 = self.start_app_window("Mahjongg")
96
79
self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1])
98
mahj_icon = self.launcher.model.get_icon_by_desktop_id(mahj.desktop_file)
99
calc_icon = self.launcher.model.get_icon_by_desktop_id(calc.desktop_file)
81
mahj_icon = self.launcher.model.get_icon(
82
desktop_id=mah_win1.application.desktop_file)
83
calc_icon = self.launcher.model.get_icon(
84
desktop_id=calc_win.application.desktop_file)
101
86
calc_ql = self.open_quicklist_for_icon(calc_icon)
102
calc_ql.get_quicklist_application_item(calc.name).mouse_click()
104
self.assertTrue(calc_win.is_focused)
87
calc_ql.get_quicklist_application_item(calc_win.application.name).mouse_click()
89
self.assertProperty(calc_win, is_focused=True)
105
90
self.assertVisibleWindowStack([calc_win, mah_win2, mah_win1])
107
92
mahj_ql = self.open_quicklist_for_icon(mahj_icon)
108
mahj_ql.get_quicklist_application_item(mahj.name).mouse_click()
110
self.assertTrue(mah_win2.is_focused)
93
mahj_ql.get_quicklist_application_item(mah_win1.application.name).mouse_click()
95
self.assertProperty(mah_win2, is_focused=True)
111
96
self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1])
113
98
def test_quicklist_application_item_initiate_spread(self):
114
99
"""This tests shows that when you activate a quicklist application item
115
100
when an application window is focused, the spread is initiated.
117
calc = self.start_app("Calculator")
118
[calc_win1] = calc.get_windows()
119
self.assertTrue(calc_win1.is_focused)
121
self.start_app("Calculator")
122
# Sleeping due to the start_app only waiting for the bamf model to be
123
# updated with the application. Since the app has already started,
124
# and we are just waiting on a second window, however a defined sleep
125
# here is likely to be problematic.
126
# TODO: fix bamf emulator to enable waiting for new windows.
128
[calc_win2] = [w for w in calc.get_windows() if w.x_id != calc_win1.x_id]
102
calc_win1 = self.start_app_window("Calculator")
103
calc_win2 = self.start_app_window("Calculator")
104
calc_app = calc_win1.application
130
106
self.assertVisibleWindowStack([calc_win2, calc_win1])
131
self.assertTrue(calc_win2.is_focused)
107
self.assertProperty(calc_win2, is_focused=True)
133
calc_icon = self.launcher.model.get_icon_by_desktop_id(calc.desktop_file)
109
calc_icon = self.launcher.model.get_icon(desktop_id=calc_app.desktop_file)
135
111
calc_ql = self.open_quicklist_for_icon(calc_icon)
136
app_item = calc_ql.get_quicklist_application_item(calc.name)
112
app_item = calc_ql.get_quicklist_application_item(calc_app.name)
138
114
self.addCleanup(self.keybinding, "spread/cancel")
139
115
app_item.mouse_click()
140
116
self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
141
117
self.assertThat(self.window_manager.scale_active_for_group, Eventually(Equals(True)))
119
def test_quicklist_item_triggered_closes_dash(self):
120
"""When any quicklist item is triggered it must close the dash."""
122
calc_win = self.start_app_window("Calculator")
123
self.assertProperty(calc_win, is_focused=True)
125
self.dash.ensure_visible()
126
self.addCleanup(self.dash.ensure_hidden)
128
calc_icon = self.launcher.model.get_icon(
129
desktop_id=calc_win.application.desktop_file)
130
self.open_quicklist_for_icon(calc_icon)
132
self.keyboard.press_and_release("Down")
133
self.keyboard.press_and_release("Enter")
134
self.assertThat(self.dash.visible, Eventually(Equals(False)))
136
def test_quicklist_closes_when_hud_opens(self):
137
"""When a quicklist is open you must still be able to open the Hud."""
138
calc = self.start_app("Calculator")
140
calc_icon = self.launcher.model.get_icon(desktop_id=calc.desktop_file)
141
calc_ql = self.open_quicklist_for_icon(calc_icon)
143
self.hud.ensure_visible()
144
self.addCleanup(self.hud.ensure_hidden)
145
self.assertThat(self.hud.visible, Eventually(Equals(True)))
147
def test_quicklist_closes_when_dash_opens(self):
148
"""When the quicklist is open you must still be able to open the dash."""
149
calc = self.start_app("Calculator")
151
calc_icon = self.launcher.model.get_icon(desktop_id=calc.desktop_file)
152
calc_ql = self.open_quicklist_for_icon(calc_icon)
154
self.dash.ensure_visible()
155
self.addCleanup(self.dash.ensure_hidden)
156
self.assertThat(self.dash.visible, Eventually(Equals(True)))
144
159
class QuicklistKeyNavigationTests(UnityTestCase):
145
160
"""Tests for the quicklist key navigation."""