~sil2100/unity/ubuntu_quantal_fixes

« back to all changes in this revision

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

  • Committer: Daniel van Vugt
  • Date: 2012-06-19 03:34:06 UTC
  • mfrom: (55.1863.73 unity)
  • mto: (55.1863.122 unity)
  • mto: This revision was merged to the branch mainline in revision 729.
  • Revision ID: daniel.van.vugt@canonical.com-20120619033406-37aqyx2lmp1nzfuk
Rebase on latest upstream lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
183
183
 
184
184
    def test_launcher_switcher_activate_keep_focus(self):
185
185
        """Activating a running launcher icon should focus the application."""
 
186
        self.launcher_instance.switcher_cancel()
186
187
        calc = self.start_app("Calculator")
187
188
        mahjongg = self.start_app("Mahjongg")
188
189
        self.assertTrue(mahjongg.is_active)
194
195
        for icon in self.launcher.model.get_launcher_icons_for_monitor(self.launcher_monitor):
195
196
            if (icon.tooltip_text == calc.name):
196
197
                found = True
197
 
                # FIXME: When releasing the keybinding another "next" is done
198
 
                self.launcher_instance.switcher_prev()
199
198
                self.launcher_instance.switcher_activate()
200
199
                break
201
200
            else:
202
201
                self.launcher_instance.switcher_next()
203
202
 
204
 
        sleep(.5)
205
203
        if not found:
206
204
            self.addCleanup(self.launcher_instance.switcher_cancel)
207
205
 
208
206
        self.assertTrue(found)
 
207
        # TODO - we need to extend the Eventually() matcher to work on regular
 
208
        # attributes too, at which point we can stop writing ugly stuff in our
 
209
        # tests like this:
 
210
        for i in range(10):
 
211
            if calc.is_active and not mahjongg.is_active:
 
212
                break
 
213
            sleep(1)
 
214
 
209
215
        self.assertTrue(calc.is_active)
210
216
        self.assertFalse(mahjongg.is_active)
211
217
 
375
381
    def test_launcher_keynav_alt_tab_quits(self):
376
382
        """Tests that alt+tab exits keynav mode."""
377
383
 
378
 
        self.switcher.initiate()
 
384
        self.keybinding("switcher/reveal_normal")
379
385
        self.addCleanup(self.switcher.terminate)
380
386
        self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False)))
381
387
 
789
795
 
790
796
    def test_shift_click_opens_new_application_instance(self):
791
797
        """Shift+Clicking MUST open a new instance of an already-running application."""
792
 
        app = self.start_app("Text Editor")
 
798
        app = self.start_app("Calculator")
793
799
        desktop_id = app.desktop_file
794
800
        icon = self.launcher.model.get_icon_by_desktop_id(desktop_id)
795
801
        launcher_instance = self.launcher.get_launcher_for_monitor(0)