diff options
| author | Francis Ginther <francis.ginther@canonical.com> | 2012-11-19 08:11:39 -0600 |
|---|---|---|
| committer | Francis Ginther <francis.ginther@canonical.com> | 2012-11-19 08:11:39 -0600 |
| commit | 980ad1f1d9d53c23841ec77c5714b633c767a26a (patch) | |
| tree | a02ec80a5877aac1339156cb17c184ce1f0b5e39 /tests | |
| parent | db228a988ec3e3c9457bd2b6f9e587d1dd3e3cee (diff) | |
Open a temporary app window to always allow exit from showdesktop_active mode.
If there are no application windows open, showdesktop_active can be set, but not cleared. This provides a hackish solution that will get unity back into the desired state for the next test. It does not solve the problem of a test attempting to leave showdesktop_active mode under these conditions. (bzr r2888.3.1)
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/autopilot/unity/tests/__init__.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/autopilot/unity/tests/__init__.py b/tests/autopilot/unity/tests/__init__.py index 0d96931dc..4666383d7 100644 --- a/tests/autopilot/unity/tests/__init__.py +++ b/tests/autopilot/unity/tests/__init__.py @@ -19,6 +19,7 @@ from logging import getLogger import os import sys from tempfile import mktemp +from time import sleep try: import testapp import json @@ -106,7 +107,23 @@ class UnityTestCase(AutopilotTestCase): well_behaved = False reasons.append("The test left the system in show_desktop mode.") log.warning("Test left the system in show desktop mode, exiting it...") - self.window_manager.leave_show_desktop() + # It is not possible to leave show desktop mode if there are no + # app windows. So, just open a window and perform the show + # desktop action until the desired state is acheived, then close + # the window. The showdesktop_active state will persist. + # + # In the event that this doesn't work, wait_for will throw an + # exception. + win = self.start_app_window('Calculator', locale='C') + count = 1 + while self.window_manager.showdesktop_active: + self.keybinding("window/show_desktop") + sleep(count) + count+=1 + if count > 10: + break + win.close() + self.window_manager.showdesktop_active.wait_for(False) for launcher in self.launcher.get_launchers(): if not self.well_behaved(launcher, in_keynav_mode=False): well_behaved = False |
