Merge lp:~townsend/unity/fix-hud-ap-tests into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3606
Proposed branch: lp:~townsend/unity/fix-hud-ap-tests
Merge into: lp:unity
Prerequisite: lp:~townsend/unity/fix-lp1255241
Diff against target: 138 lines (+40/-15)
3 files modified
launcher/HudLauncherIcon.cpp (+4/-0)
launcher/LauncherIcon.cpp (+24/-3)
tests/autopilot/unity/tests/test_hud.py (+12/-12)
To merge this branch: bzr merge lp:~townsend/unity/fix-hud-ap-tests
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+196980@code.launchpad.net

Commit message

Add some introspection vector variables to account for per-monitor icon quirks to fix some failing Hud AP tests.

Description of the change

= Issue =
Some Hud AP tests are failing due to the fairly recent change of per-monitor icon quirks.

= Fix =
Add new vector introspection variables to account for the per-monitor icon quirks. Also, fix up some of the failing AP tests to use these new introspection variables.

This should fix these tests:
unity.tests.test_hud.HudVisualTests.test_hud_icon_is_shown (except for one test that is unrelated to this)
unity.tests.test_hud.HudLockedLauncherInteractionsTests.test_hud_desaturates_launcher_icons
unity.tests.test_hud.HudLockedLauncherInteractionsTests.test_hud_launcher_icon_hides_bfb

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Christopher Townsend (townsend) wrote :

Merged in lp:unity and resolved a conflict. Re-approving...

Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/HudLauncherIcon.cpp'
2--- launcher/HudLauncherIcon.cpp 2013-11-27 20:26:59 +0000
3+++ launcher/HudLauncherIcon.cpp 2013-12-03 13:05:52 +0000
4@@ -77,7 +77,10 @@
5 launcher_hide_mode_ = hide_mode;
6
7 if (launcher_hide_mode_ == LAUNCHER_HIDE_AUTOHIDE)
8+ {
9+ SetQuirk(Quirk::ACTIVE, false);
10 SetQuirk(Quirk::VISIBLE, false);
11+ }
12 }
13 }
14
15@@ -94,6 +97,7 @@
16 launcher_hide_mode_ == LAUNCHER_HIDE_NEVER)
17 {
18 SetMonitor(visible ? overlay_monitor_ : -1);
19+ SetQuirk(Quirk::ACTIVE, visible, overlay_monitor_);
20 SkipQuirkAnimation(Quirk::VISIBLE, overlay_monitor_);
21 }
22 }
23
24=== modified file 'launcher/LauncherIcon.cpp'
25--- launcher/LauncherIcon.cpp 2013-11-19 18:48:35 +0000
26+++ launcher/LauncherIcon.cpp 2013-12-03 13:05:52 +0000
27@@ -150,9 +150,24 @@
28
29 void LauncherIcon::AddProperties(debug::IntrospectionData& introspection)
30 {
31- std::vector<bool> monitors;
32+ std::vector<bool> monitors_active,
33+ monitors_visible,
34+ monitors_urgent,
35+ monitors_running,
36+ monitors_starting,
37+ monitors_desaturated,
38+ monitors_presented;
39+
40 for (unsigned i = 0; i < monitors::MAX; ++i)
41- monitors.push_back(IsVisibleOnMonitor(i));
42+ {
43+ monitors_active.push_back(GetQuirk(Quirk::ACTIVE, i));
44+ monitors_visible.push_back(IsVisibleOnMonitor(i));
45+ monitors_urgent.push_back(GetQuirk(Quirk::URGENT, i));
46+ monitors_running.push_back(GetQuirk(Quirk::RUNNING, i));
47+ monitors_starting.push_back(GetQuirk(Quirk::STARTING, i));
48+ monitors_desaturated.push_back(GetQuirk(Quirk::DESAT, i));
49+ monitors_presented.push_back(GetQuirk(Quirk::PRESENTED, i));
50+ }
51
52 introspection
53 .add("center", _center[0])
54@@ -161,7 +176,13 @@
55 .add("tooltip_text", tooltip_text())
56 .add("sort_priority", _sort_priority)
57 .add("shortcut", _shortcut)
58- .add("monitors_visibility", static_cast<GVariant*>(glib::Variant::FromVector(monitors)))
59+ .add("monitors_active", static_cast<GVariant*>(glib::Variant::FromVector(monitors_active)))
60+ .add("monitors_visibility", static_cast<GVariant*>(glib::Variant::FromVector(monitors_visible)))
61+ .add("monitors_urgent", static_cast<GVariant*>(glib::Variant::FromVector(monitors_urgent)))
62+ .add("monitors_running", static_cast<GVariant*>(glib::Variant::FromVector(monitors_running)))
63+ .add("monitors_starting", static_cast<GVariant*>(glib::Variant::FromVector(monitors_starting)))
64+ .add("monitors_desaturated", static_cast<GVariant*>(glib::Variant::FromVector(monitors_desaturated)))
65+ .add("monitors_presented", static_cast<GVariant*>(glib::Variant::FromVector(monitors_presented)))
66 .add("active", GetQuirk(Quirk::ACTIVE))
67 .add("visible", GetQuirk(Quirk::VISIBLE))
68 .add("urgent", GetQuirk(Quirk::URGENT))
69
70=== modified file 'tests/autopilot/unity/tests/test_hud.py'
71--- tests/autopilot/unity/tests/test_hud.py 2013-09-16 16:27:45 +0000
72+++ tests/autopilot/unity/tests/test_hud.py 2013-12-03 13:05:52 +0000
73@@ -498,8 +498,8 @@
74
75 class HudLauncherInteractionsTests(HudTestsBase):
76
77- launcher_modes = [('Launcher autohide', {'launcher_autohide': False}),
78- ('Launcher never hide', {'launcher_autohide': True})]
79+ launcher_modes = [('Launcher never hide', {'launcher_autohide': False}),
80+ ('Launcher autohide', {'launcher_autohide': True})]
81
82 scenarios = multiply_scenarios(_make_monitor_scenarios(), launcher_modes)
83
84@@ -578,7 +578,7 @@
85
86 self.unity.hud.ensure_visible()
87
88- self.assertThat(hud_icon.visible, Eventually(Equals(True)))
89+ self.assertTrue(hud_icon.monitors_visibility[self.hud_monitor])
90 self.assertTrue(hud_icon.is_on_monitor(self.hud_monitor))
91 # For some reason the BFB icon is always visible :-/
92 #bfb_icon.visible, Eventually(Equals(False)
93@@ -590,9 +590,9 @@
94
95 for icon in self.unity.launcher.model.get_launcher_icons_for_monitor(self.hud_monitor):
96 if isinstance(icon, HudLauncherIcon):
97- self.assertThat(icon.desaturated, Eventually(Equals(False)))
98+ self.assertFalse(icon.monitors_desaturated[self.hud_monitor])
99 else:
100- self.assertThat(icon.desaturated, Eventually(Equals(True)))
101+ self.assertTrue(icon.monitors_desaturated[self.hud_monitor])
102
103 def test_hud_launcher_icon_click_hides_hud(self):
104 """Clicking the Hud Icon should hide the HUD"""
105@@ -609,11 +609,11 @@
106
107 class HudVisualTests(HudTestsBase):
108
109- launcher_modes = [('Launcher autohide', {'launcher_autohide': False}),
110- ('Launcher never hide', {'launcher_autohide': True})]
111+ launcher_modes = [('Launcher never hide', {'launcher_autohide': False}),
112+ ('Launcher autohide', {'launcher_autohide': True})]
113
114- launcher_screen = [('Launcher on primary monitor', {'launcher_primary_only': False}),
115- ('Launcher on all monitors', {'launcher_primary_only': True})]
116+ launcher_screen = [('Launcher on all monitors', {'launcher_primary_only': False}),
117+ ('Launcher on primary monitor', {'launcher_primary_only': True})]
118
119 scenarios = multiply_scenarios(_make_monitor_scenarios(), launcher_modes, launcher_screen)
120
121@@ -664,15 +664,15 @@
122 hud_embedded_icon = self.unity.hud.get_embedded_icon()
123
124 if self.unity.hud.is_locked_launcher:
125- self.assertThat(hud_launcher_icon.visible, Eventually(Equals(True)))
126+ self.assertTrue(hud_launcher_icon.monitors_visibility[self.hud_monitor])
127 self.assertTrue(hud_launcher_icon.is_on_monitor(self.hud_monitor))
128- self.assertTrue(hud_launcher_icon.active)
129+ self.assertTrue(hud_launcher_icon.monitors_active[self.hud_monitor])
130 self.assertThat(hud_launcher_icon.monitor, Equals(self.hud_monitor))
131 self.assertFalse(hud_launcher_icon.desaturated)
132 self.assertThat(hud_embedded_icon, Equals(None))
133 else:
134 self.assertThat(hud_launcher_icon.visible, Eventually(Equals(False)))
135- self.assertFalse(hud_launcher_icon.active)
136+ self.assertFalse(hud_launcher_icon.monitors_active[self.hud_monitor])
137 # the embedded icon has no visible property.
138 self.assertThat(hud_embedded_icon, NotEquals(None))
139