~marcobiscaro2112/unity/custom-bg

« back to all changes in this revision

Viewing changes to tests/autopilot/unity/tests/test_shortcut_hint.py

  • Committer: Marco Biscaro
  • Date: 2012-07-12 12:05:07 UTC
  • mfrom: (2353.2.144 unity)
  • Revision ID: marcobiscaro2112@gmail.com-20120712120507-7u9sb43bqon88ifl
Merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
 
94
94
        self.assertThat(self.shortcut_hint.get_shortcut_view().bg_texture_is_valid, Eventually(Equals(True)))
95
95
 
 
96
 
96
97
class ShortcutHintInteractionsTests(BaseShortcutHintTests):
97
98
    """Test the shortcuthint interactions with other Unity parts."""
98
99
 
104
105
        self.keybinding_tap("expo/start")
105
106
        self.addCleanup(self.keybinding, "expo/cancel")
106
107
 
 
108
    def test_shortcut_hint_hide_pressing_modifiers(self):
 
109
        """Pressing a modifer key must hide the shortcut hint."""
 
110
        self.shortcut_hint.ensure_visible()
 
111
        self.addCleanup(self.shortcut_hint.ensure_hidden)
 
112
 
 
113
        self.keyboard.press('Control')
 
114
 
107
115
        self.assertThat(self.shortcut_hint.visible, Eventually(Equals(False)))
108
116
 
109
117
    def test_launcher_switcher_next_doesnt_show_shortcut_hint(self):
133
141
 
134
142
        self.assertThat(self.shortcut_hint.visible, Equals(False))
135
143
 
136
 
    def test_launcher_switcher_next_keeps_shortcut_hint(self):
137
 
        """Super+Tab switcher cycling forwards must not dispel an already-showing
138
 
        shortcut hint.
139
 
 
140
 
        """
141
 
        show_timeout = self.shortcut_hint.get_show_timeout()
142
 
        self.shortcut_hint.ensure_visible()
143
 
        self.addCleanup(self.shortcut_hint.ensure_hidden)
144
 
 
145
 
        self.keybinding("launcher/switcher/next")
146
 
        self.addCleanup(self.keyboard.press_and_release, "Escape")
147
 
 
148
 
        self.assertThat(self.launcher.key_nav_is_active, Equals(True))
149
 
 
150
 
        self.keybinding("launcher/switcher/next")
151
 
        sleep(show_timeout * 2)
152
 
        self.assertThat(self.shortcut_hint.visible, Equals(True))
153
 
 
154
 
    def test_launcher_switcher_prev_keeps_shortcut_hint(self):
155
 
        """Super+Tab switcher cycling backwards must not dispel an already-showing
156
 
        shortcut hint.
157
 
 
158
 
        """
159
 
        show_timeout = self.shortcut_hint.get_show_timeout()
160
 
        self.shortcut_hint.ensure_visible()
161
 
        self.addCleanup(self.shortcut_hint.ensure_visible)
162
 
 
163
 
        self.keybinding("launcher/switcher/next")
164
 
        self.addCleanup(self.keyboard.press_and_release, "Escape")
165
 
        self.assertThat(self.launcher.key_nav_is_active, Equals(True))
166
 
 
167
 
        self.keybinding("launcher/switcher/prev")
168
 
        self.keybinding("launcher/switcher/prev")
169
 
        sleep(show_timeout * 2)
170
 
        self.assertThat(self.shortcut_hint.visible, Equals(True))
171
 
 
172
 
    def test_launcher_switcher_cancel_doesnt_hide_shortcut_hint(self):
173
 
        """Cancelling the launcher switcher (by Escape) must not hide the
174
 
        shortcut hint view.
175
 
 
176
 
        """
177
 
        self.shortcut_hint.ensure_visible()
178
 
        self.addCleanup(self.shortcut_hint.ensure_hidden)
179
 
 
180
 
        self.keybinding("launcher/switcher/next")
181
 
        # NOTE: This will generate an extra Escape keypress if the test passes,
182
 
        # but that's better than the alternative...
183
 
        self.addCleanup(self.keybinding, "launcher/switcher/exit")
184
 
 
185
 
        self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(True)))
186
 
        self.assertThat(self.shortcut_hint.visible, Equals(True))
187
 
 
188
 
        self.keyboard.press_and_release("Escape")
189
 
 
190
 
        self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False)))
191
 
        self.assertThat(self.shortcut_hint.visible, Equals(True))
192
 
 
193
 
    def test_launcher_switcher_and_shortcut_hint_escaping(self):
194
 
        """Cancelling the launcher switcher (by Escape) should not hide the
195
 
        shortcut hint view, an extra keypress is needed.
196
 
 
197
 
        """
198
 
        self.shortcut_hint.ensure_visible()
199
 
        self.addCleanup(self.shortcut_hint.ensure_hidden)
200
 
 
201
 
        self.keybinding("launcher/switcher/next")
202
 
 
203
 
        self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(True)))
204
 
        self.assertThat(self.shortcut_hint.visible, Equals(True))
205
 
 
206
 
        self.keyboard.press_and_release("Escape")
207
 
 
208
 
        self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False)))
209
 
        self.assertThat(self.shortcut_hint.visible, Equals(True))
210
 
 
211
 
        self.keyboard.press_and_release("Escape")
212
 
        self.assertThat(self.shortcut_hint.visible, Eventually(Equals(False)))
213
 
 
214
144
    def test_launcher_icons_hints_show_with_shortcut_hint(self):
215
145
        """When the shortcut hint is shown also the launcer's icons hints should
216
146
        be shown.