Merge lp:~3v1n0/unity/unset-bamficon-on-removal-5.0 into lp:unity
- unset-bamficon-on-removal-5.0
- Merge into trunk
Proposed by
Marco Trevisan (Treviño)
Status: | Superseded |
---|---|
Proposed branch: | lp:~3v1n0/unity/unset-bamficon-on-removal-5.0 |
Merge into: | lp:unity |
Diff against target: |
3339 lines (+2740/-1) (has conflicts) 29 files modified
dash/DashController.cpp (+4/-0) launcher/StandaloneLauncher.cpp (+10/-0) launcher/SwitcherView.h (+6/-0) plugins/unityshell/src/ScreenEffectFramebufferObject.cpp (+6/-0) plugins/unityshell/src/unityshell.cpp (+4/-1) standalone-clients/CMakeLists.txt.OTHER (+574/-0) tests/CMakeLists.txt (+54/-0) tests/autopilot/autopilot/emulators/bamf.py.OTHER (+411/-0) tests/autopilot/autopilot/keybindings.py.OTHER (+259/-0) tests/autopilot/autopilot/matchers/__init__.py (+31/-0) tests/autopilot/unity/emulators/__init__.py (+289/-0) tests/autopilot/unity/emulators/dash.py (+4/-0) tests/autopilot/unity/emulators/icons.py (+6/-0) tests/autopilot/unity/emulators/tooltip.py (+23/-0) tests/autopilot/unity/emulators/window_manager.py (+25/-0) tests/autopilot/unity/tests/__init__.py (+315/-0) tests/autopilot/unity/tests/test_command_lens.py (+8/-0) tests/autopilot/unity/tests/test_dash.py (+10/-0) tests/autopilot/unity/tests/test_home_lens.py (+12/-0) tests/autopilot/unity/tests/test_hud.py (+25/-0) tests/autopilot/unity/tests/test_ibus.py (+79/-0) tests/autopilot/unity/tests/test_launcher.py (+152/-0) tests/autopilot/unity/tests/test_panel.py (+1/-0) tests/autopilot/unity/tests/test_quicklist.py (+298/-0) tests/autopilot/unity/tests/test_shortcut_hint.py (+10/-0) tests/test_resultviewgrid.cpp (+103/-0) unity-shared/OverlayRenderer.cpp (+10/-0) unity-shared/UnityWindowView.h (+5/-0) unity-shared/WindowManager.h (+6/-0) Text conflict in dash/DashController.cpp Text conflict in launcher/StandaloneLauncher.cpp Text conflict in launcher/SwitcherView.h Text conflict in plugins/unityshell/src/ScreenEffectFramebufferObject.cpp Conflict adding files to standalone-clients. Created directory. Conflict because standalone-clients is not versioned, but has versioned children. Versioned directory. Contents conflict in standalone-clients/CMakeLists.txt Text conflict in tests/CMakeLists.txt Conflict adding files to tests/autopilot/autopilot. Created directory. Conflict because tests/autopilot/autopilot is not versioned, but has versioned children. Versioned directory. Conflict adding files to tests/autopilot/autopilot/emulators. Created directory. Conflict because tests/autopilot/autopilot/emulators is not versioned, but has versioned children. Versioned directory. Contents conflict in tests/autopilot/autopilot/emulators/bamf.py Contents conflict in tests/autopilot/autopilot/keybindings.py Text conflict in tests/autopilot/unity/emulators/__init__.py Text conflict in tests/autopilot/unity/emulators/dash.py Text conflict in tests/autopilot/unity/emulators/icons.py Text conflict in tests/autopilot/unity/emulators/tooltip.py Text conflict in tests/autopilot/unity/emulators/window_manager.py Text conflict in tests/autopilot/unity/tests/__init__.py Text conflict in tests/autopilot/unity/tests/test_command_lens.py Text conflict in tests/autopilot/unity/tests/test_dash.py Text conflict in tests/autopilot/unity/tests/test_home_lens.py Text conflict in tests/autopilot/unity/tests/test_hud.py Text conflict in tests/autopilot/unity/tests/test_ibus.py Text conflict in tests/autopilot/unity/tests/test_launcher.py Text conflict in tests/autopilot/unity/tests/test_quicklist.py Text conflict in tests/autopilot/unity/tests/test_shortcut_hint.py Conflict adding file tests/test_resultviewgrid.cpp. Moved existing file to tests/test_resultviewgrid.cpp.moved. Text conflict in unity-shared/OverlayRenderer.cpp Text conflict in unity-shared/UnityWindowView.h Text conflict in unity-shared/WindowManager.h |
To merge this branch: | bzr merge lp:~3v1n0/unity/unset-bamficon-on-removal-5.0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity Team | Pending | ||
Review via email: mp+107247@code.launchpad.net |
Commit message
BamfLauncherIcon: Unset the BamfApplication when removing the icon.
Doing this manually, we prevent that a duplicated application can be added between the removal of the BamfLauncherIcon and the effective destruction (that is controlled by a timeout in LauncherModel).
Description of the change
Backporting fix for bug #1003574 to 5.0 branch https:/
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CMakeLists.txt' | |||
2 | === modified file 'dash/DashController.cpp' | |||
3 | --- dash/DashController.cpp 2012-05-22 15:46:04 +0000 | |||
4 | +++ dash/DashController.cpp 2012-05-24 17:16:22 +0000 | |||
5 | @@ -266,6 +266,10 @@ | |||
6 | 266 | need_show_ = true; | 266 | need_show_ = true; |
7 | 267 | return; | 267 | return; |
8 | 268 | } | 268 | } |
9 | 269 | <<<<<<< TREE | ||
10 | 270 | ======= | ||
11 | 271 | |||
12 | 272 | >>>>>>> MERGE-SOURCE | ||
13 | 269 | view_->AboutToShow(); | 273 | view_->AboutToShow(); |
14 | 270 | 274 | ||
15 | 271 | window_->ShowWindow(true); | 275 | window_->ShowWindow(true); |
16 | 272 | 276 | ||
17 | === modified file 'dash/DashView.cpp' | |||
18 | === modified file 'dash/LensBar.cpp' | |||
19 | === modified file 'dash/LensBarIcon.cpp' | |||
20 | === modified file 'dash/PlacesGroup.cpp' | |||
21 | === modified file 'dash/ResultRendererTile.cpp' | |||
22 | === modified file 'dash/ResultView.cpp' | |||
23 | === modified file 'dash/ResultViewGrid.cpp' | |||
24 | === modified file 'dash/ResultViewGrid.h' | |||
25 | === modified file 'hud/HudController.cpp' | |||
26 | === modified file 'hud/HudController.h' | |||
27 | === modified file 'hud/HudIcon.h' | |||
28 | === modified file 'hud/HudView.cpp' | |||
29 | === modified file 'hud/HudView.h' | |||
30 | === modified file 'launcher/AbstractLauncherIcon.h' | |||
31 | === modified file 'launcher/BFBLauncherIcon.cpp' | |||
32 | === modified file 'launcher/BamfLauncherIcon.cpp' | |||
33 | === modified file 'launcher/DesktopLauncherIcon.cpp' | |||
34 | === modified file 'launcher/DeviceLauncherIcon.cpp' | |||
35 | === modified file 'launcher/HudLauncherIcon.cpp' | |||
36 | === modified file 'launcher/Launcher.cpp' | |||
37 | === modified file 'launcher/Launcher.h' | |||
38 | === modified file 'launcher/LauncherController.cpp' | |||
39 | === modified file 'launcher/LauncherIcon.cpp' | |||
40 | === modified file 'launcher/LauncherIcon.h' | |||
41 | === modified file 'launcher/QuicklistMenuItem.cpp' | |||
42 | === modified file 'launcher/QuicklistMenuItem.h' | |||
43 | === modified file 'launcher/QuicklistMenuItemSeparator.cpp' | |||
44 | === modified file 'launcher/QuicklistView.cpp' | |||
45 | === modified file 'launcher/QuicklistView.h' | |||
46 | === modified file 'launcher/StandaloneLauncher.cpp' | |||
47 | --- launcher/StandaloneLauncher.cpp 2012-05-07 19:52:54 +0000 | |||
48 | +++ launcher/StandaloneLauncher.cpp 2012-05-24 17:16:22 +0000 | |||
49 | @@ -31,12 +31,22 @@ | |||
50 | 31 | #include "NuxGraphics/GraphicsEngine.h" | 31 | #include "NuxGraphics/GraphicsEngine.h" |
51 | 32 | #include <gtk/gtk.h> | 32 | #include <gtk/gtk.h> |
52 | 33 | 33 | ||
53 | 34 | <<<<<<< TREE | ||
54 | 34 | #include "unity-shared/BackgroundEffectHelper.h" | 35 | #include "unity-shared/BackgroundEffectHelper.h" |
55 | 35 | #include "FavoriteStoreGSettings.h" | 36 | #include "FavoriteStoreGSettings.h" |
56 | 37 | ======= | ||
57 | 38 | #include "BackgroundEffectHelper.h" | ||
58 | 39 | #include "FavoriteStoreGSettings.h" | ||
59 | 40 | >>>>>>> MERGE-SOURCE | ||
60 | 36 | #include "LauncherController.h" | 41 | #include "LauncherController.h" |
61 | 37 | #include "Launcher.h" | 42 | #include "Launcher.h" |
62 | 43 | <<<<<<< TREE | ||
63 | 38 | #include "unity-shared/PanelStyle.h" | 44 | #include "unity-shared/PanelStyle.h" |
64 | 39 | 45 | ||
65 | 46 | ======= | ||
66 | 47 | #include "PanelStyle.h" | ||
67 | 48 | |||
68 | 49 | >>>>>>> MERGE-SOURCE | ||
69 | 40 | #include <dbus/dbus-glib.h> | 50 | #include <dbus/dbus-glib.h> |
70 | 41 | 51 | ||
71 | 42 | using namespace unity; | 52 | using namespace unity; |
72 | 43 | 53 | ||
73 | === modified file 'launcher/SwitcherController.cpp' | |||
74 | === modified file 'launcher/SwitcherView.h' | |||
75 | --- launcher/SwitcherView.h 2012-05-17 11:52:32 +0000 | |||
76 | +++ launcher/SwitcherView.h 2012-05-24 17:16:22 +0000 | |||
77 | @@ -24,9 +24,15 @@ | |||
78 | 24 | #include "unity-shared/AbstractIconRenderer.h" | 24 | #include "unity-shared/AbstractIconRenderer.h" |
79 | 25 | #include "unity-shared/StaticCairoText.h" | 25 | #include "unity-shared/StaticCairoText.h" |
80 | 26 | #include "LayoutSystem.h" | 26 | #include "LayoutSystem.h" |
81 | 27 | <<<<<<< TREE | ||
82 | 27 | #include "unity-shared/BackgroundEffectHelper.h" | 28 | #include "unity-shared/BackgroundEffectHelper.h" |
83 | 28 | #include "unity-shared/UnityWindowView.h" | 29 | #include "unity-shared/UnityWindowView.h" |
84 | 29 | 30 | ||
85 | 31 | ======= | ||
86 | 32 | #include "BackgroundEffectHelper.h" | ||
87 | 33 | #include "UnityWindowView.h" | ||
88 | 34 | |||
89 | 35 | >>>>>>> MERGE-SOURCE | ||
90 | 30 | #include <boost/shared_ptr.hpp> | 36 | #include <boost/shared_ptr.hpp> |
91 | 31 | #include <sigc++/sigc++.h> | 37 | #include <sigc++/sigc++.h> |
92 | 32 | 38 | ||
93 | 33 | 39 | ||
94 | === modified file 'panel/PanelMenuView.cpp' | |||
95 | === modified file 'panel/PanelView.cpp' | |||
96 | === modified file 'panel/WindowButtons.cpp' | |||
97 | === modified file 'plugins/unityshell/src/ScreenEffectFramebufferObject.cpp' | |||
98 | --- plugins/unityshell/src/ScreenEffectFramebufferObject.cpp 2012-05-24 07:23:12 +0000 | |||
99 | +++ plugins/unityshell/src/ScreenEffectFramebufferObject.cpp 2012-05-24 17:16:22 +0000 | |||
100 | @@ -101,6 +101,7 @@ | |||
101 | 101 | 101 | ||
102 | 102 | void unity::ScreenEffectFramebufferObject::bind (const nux::Geometry &output) | 102 | void unity::ScreenEffectFramebufferObject::bind (const nux::Geometry &output) |
103 | 103 | { | 103 | { |
104 | 104 | <<<<<<< TREE | ||
105 | 104 | /* Very important! | 105 | /* Very important! |
106 | 105 | * Don't bind unless BackgroundEffectHelper says it's necessary. | 106 | * Don't bind unless BackgroundEffectHelper says it's necessary. |
107 | 106 | * Because binding has a severe impact on graphics performance and we | 107 | * Because binding has a severe impact on graphics performance and we |
108 | @@ -109,6 +110,11 @@ | |||
109 | 109 | if (!BackgroundEffectHelper::HasDirtyHelpers()) | 110 | if (!BackgroundEffectHelper::HasDirtyHelpers()) |
110 | 110 | return; | 111 | return; |
111 | 111 | 112 | ||
112 | 113 | ======= | ||
113 | 114 | if (!BackgroundEffectHelper::HasDirtyHelpers()) | ||
114 | 115 | return; | ||
115 | 116 | |||
116 | 117 | >>>>>>> MERGE-SOURCE | ||
117 | 112 | /* Clear the error bit */ | 118 | /* Clear the error bit */ |
118 | 113 | glGetError (); | 119 | glGetError (); |
119 | 114 | 120 | ||
120 | 115 | 121 | ||
121 | === modified file 'plugins/unityshell/src/unitya11y.cpp' | |||
122 | === modified file 'plugins/unityshell/src/unityshell.cpp' | |||
123 | --- plugins/unityshell/src/unityshell.cpp 2012-04-24 21:26:55 +0000 | |||
124 | +++ plugins/unityshell/src/unityshell.cpp 2012-05-24 17:16:22 +0000 | |||
125 | @@ -1449,8 +1449,11 @@ | |||
126 | 1449 | ShowdesktopHandler::InhibitLeaveShowdesktopMode (event->xmaprequest.window); | 1449 | ShowdesktopHandler::InhibitLeaveShowdesktopMode (event->xmaprequest.window); |
127 | 1450 | break; | 1450 | break; |
128 | 1451 | case PropertyNotify: | 1451 | case PropertyNotify: |
130 | 1452 | if (event->xproperty.window == GDK_ROOT_WINDOW()) | 1452 | if (event->xproperty.window == GDK_ROOT_WINDOW() && |
131 | 1453 | event->xproperty.atom == gdk_x11_get_xatom_by_name("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS")) | ||
132 | 1454 | { | ||
133 | 1453 | _bghash.RefreshColor(); | 1455 | _bghash.RefreshColor(); |
134 | 1456 | } | ||
135 | 1454 | break; | 1457 | break; |
136 | 1455 | default: | 1458 | default: |
137 | 1456 | if (screen->shapeEvent () + ShapeNotify == event->type) | 1459 | if (screen->shapeEvent () + ShapeNotify == event->type) |
138 | 1457 | 1460 | ||
139 | === modified file 'plugins/unityshell/src/unityshell.h' | |||
140 | === modified file 'shortcuts/ShortcutController.cpp' | |||
141 | === modified file 'shortcuts/ShortcutView.cpp' | |||
142 | === modified file 'shortcuts/ShortcutView.h' | |||
143 | === added directory 'standalone-clients' | |||
144 | === added file 'standalone-clients/CMakeLists.txt.OTHER' | |||
145 | --- standalone-clients/CMakeLists.txt.OTHER 1970-01-01 00:00:00 +0000 | |||
146 | +++ standalone-clients/CMakeLists.txt.OTHER 2012-05-24 17:16:22 +0000 | |||
147 | @@ -0,0 +1,574 @@ | |||
148 | 1 | set(UNITY_SRC ../plugins/unityshell/src) | ||
149 | 2 | |||
150 | 3 | # | ||
151 | 4 | # Data | ||
152 | 5 | # | ||
153 | 6 | |||
154 | 7 | # | ||
155 | 8 | # Unit tests | ||
156 | 9 | # | ||
157 | 10 | find_package (PkgConfig) | ||
158 | 11 | set (TEST_DEPS "${UNITY_PLUGIN_DEPS};unity>=4.0.0 xtst") | ||
159 | 12 | pkg_check_modules (TEST_UNIT_DEPS REQUIRED ${TEST_DEPS}) | ||
160 | 13 | |||
161 | 14 | set (TESTDATADIR "${CMAKE_CURRENT_SOURCE_DIR}/data") | ||
162 | 15 | |||
163 | 16 | set (CFLAGS | ||
164 | 17 | ${TEST_UNIT_DEPS_CFLAGS} | ||
165 | 18 | ${TEST_UNIT_DEPS_CFLAGS_OTHER} | ||
166 | 19 | ${MAINTAINER_CFLAGS} | ||
167 | 20 | "-g" | ||
168 | 21 | "-DTESTDATADIR=\"${TESTDATADIR}\"" | ||
169 | 22 | "-DGETTEXT_PACKAGE=\"unity\"" | ||
170 | 23 | "-DINDICATORDIR=\"${CMAKE_BINARY_DIR}/tests\"" | ||
171 | 24 | "-DINDICATORICONDIR=\"${CMAKE_BINARY_DIR}/tests\"" | ||
172 | 25 | "-I${CMAKE_CURRENT_BINARY_DIR}" | ||
173 | 26 | ) | ||
174 | 27 | add_definitions (${CFLAGS}) | ||
175 | 28 | |||
176 | 29 | set (LIBS ${TEST_UNIT_DEPS_LIBRARIES} "-lunity-core-${UNITY_API_VERSION} -lm -lGL -lGLU -lXtst") | ||
177 | 30 | link_libraries (${LIBS}) | ||
178 | 31 | |||
179 | 32 | set (LIB_PATHS ${TEST_UNIT_DEPS_LIBRARY_DIRS}) | ||
180 | 33 | link_directories (${CMAKE_BINARY_DIR}/UnityCore ${LIB_PATHS}) | ||
181 | 34 | |||
182 | 35 | include_directories (. .. ../services ../UnityCore ${UNITY_SRC} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) | ||
183 | 36 | |||
184 | 37 | # We can't have convenience libs so we need to rebuild with what we need | ||
185 | 38 | # Please keep actual test files alphabetically at top and then files | ||
186 | 39 | # from ../${UNITY_SRC} or ../../services in alphabetically after that | ||
187 | 40 | |||
188 | 41 | # | ||
189 | 42 | # Standalone tests | ||
190 | 43 | # | ||
191 | 44 | add_executable (dash | ||
192 | 45 | standalone_dash.cpp | ||
193 | 46 | ${UNITY_SRC}/AbstractPlacesGroup.cpp | ||
194 | 47 | ${UNITY_SRC}/AbstractPlacesGroup.h | ||
195 | 48 | ${UNITY_SRC}/AbstractSeparator.h | ||
196 | 49 | ${UNITY_SRC}/AbstractSeparator.cpp | ||
197 | 50 | ${UNITY_SRC}/BackgroundEffectHelper.cpp | ||
198 | 51 | ${UNITY_SRC}/BackgroundEffectHelper.h | ||
199 | 52 | ${UNITY_SRC}/BGHash.cpp | ||
200 | 53 | ${UNITY_SRC}/BGHash.h | ||
201 | 54 | ${UNITY_SRC}/SearchBar.cpp | ||
202 | 55 | ${UNITY_SRC}/SearchBar.h | ||
203 | 56 | ${UNITY_SRC}/SearchBarSpinner.cpp | ||
204 | 57 | ${UNITY_SRC}/SearchBarSpinner.h | ||
205 | 58 | ${UNITY_SRC}/DashView.cpp | ||
206 | 59 | ${UNITY_SRC}/DashView.h | ||
207 | 60 | ${UNITY_SRC}/DashViewPrivate.cpp | ||
208 | 61 | ${UNITY_SRC}/DashViewPrivate.h | ||
209 | 62 | ${UNITY_SRC}/DashSettings.cpp | ||
210 | 63 | ${UNITY_SRC}/DashSettings.h | ||
211 | 64 | ${UNITY_SRC}/FilterAllButton.cpp | ||
212 | 65 | ${UNITY_SRC}/FilterAllButton.h | ||
213 | 66 | ${UNITY_SRC}/FilterExpanderLabel.cpp | ||
214 | 67 | ${UNITY_SRC}/FilterFactory.cpp | ||
215 | 68 | ${UNITY_SRC}/FilterAllButton.cpp | ||
216 | 69 | ${UNITY_SRC}/FilterBasicButton.cpp | ||
217 | 70 | ${UNITY_SRC}/FilterRatingsButton.cpp | ||
218 | 71 | ${UNITY_SRC}/FilterRatingsWidget.cpp | ||
219 | 72 | ${UNITY_SRC}/FilterMultiRangeWidget.cpp | ||
220 | 73 | ${UNITY_SRC}/FilterMultiRangeButton.cpp | ||
221 | 74 | ${UNITY_SRC}/FilterGenreButton.cpp | ||
222 | 75 | ${UNITY_SRC}/FilterGenreWidget.cpp | ||
223 | 76 | ${UNITY_SRC}/FilterBar.cpp | ||
224 | 77 | ${UNITY_SRC}/FontSettings.cpp | ||
225 | 78 | ${UNITY_SRC}/FontSettings.h | ||
226 | 79 | ${UNITY_SRC}/IMTextEntry.cpp | ||
227 | 80 | ${UNITY_SRC}/IMTextEntry.h | ||
228 | 81 | ${UNITY_SRC}/IntrospectableWrappers.cpp | ||
229 | 82 | ${UNITY_SRC}/PlacesGroup.cpp | ||
230 | 83 | ${UNITY_SRC}/PlacesGroup.h | ||
231 | 84 | ${UNITY_SRC}/PlacesTile.cpp | ||
232 | 85 | ${UNITY_SRC}/PlacesTile.h | ||
233 | 86 | ${UNITY_SRC}/PlacesSimpleTile.cpp | ||
234 | 87 | ${UNITY_SRC}/PlacesSimpleTile.h | ||
235 | 88 | ${UNITY_SRC}/PlacesVScrollBar.cpp | ||
236 | 89 | ${UNITY_SRC}/PlacesVScrollBar.h | ||
237 | 90 | ${UNITY_SRC}/DashView.cpp | ||
238 | 91 | ${UNITY_SRC}/DashView.h | ||
239 | 92 | ${UNITY_SRC}/DashViewPrivate.cpp | ||
240 | 93 | ${UNITY_SRC}/DashViewPrivate.h | ||
241 | 94 | ${UNITY_SRC}/DashStyle.cpp | ||
242 | 95 | ${UNITY_SRC}/IconLoader.cpp | ||
243 | 96 | ${UNITY_SRC}/IconLoader.h | ||
244 | 97 | ${UNITY_SRC}/IconTexture.cpp | ||
245 | 98 | ${UNITY_SRC}/IconTexture.h | ||
246 | 99 | ${UNITY_SRC}/Introspectable.cpp | ||
247 | 100 | ${UNITY_SRC}/Introspectable.h | ||
248 | 101 | ${UNITY_SRC}/JSONParser.cpp | ||
249 | 102 | ${UNITY_SRC}/LensBar.cpp | ||
250 | 103 | ${UNITY_SRC}/LensBar.h | ||
251 | 104 | ${UNITY_SRC}/LensBarIcon.cpp | ||
252 | 105 | ${UNITY_SRC}/LensBarIcon.h | ||
253 | 106 | ${UNITY_SRC}/LensView.cpp | ||
254 | 107 | ${UNITY_SRC}/LensView.h | ||
255 | 108 | ${UNITY_SRC}/LensViewPrivate.cpp | ||
256 | 109 | ${UNITY_SRC}/LensViewPrivate.h | ||
257 | 110 | ${UNITY_SRC}/LineSeparator.cpp | ||
258 | 111 | ${UNITY_SRC}/LineSeparator.h | ||
259 | 112 | ${UNITY_SRC}/OverlayRenderer.cpp | ||
260 | 113 | ${UNITY_SRC}/PreviewApplications.cpp | ||
261 | 114 | ${UNITY_SRC}/PreviewBase.cpp | ||
262 | 115 | ${UNITY_SRC}/PreviewBasicButton.cpp | ||
263 | 116 | ${UNITY_SRC}/ResultView.cpp | ||
264 | 117 | ${UNITY_SRC}/ResultViewGrid.cpp | ||
265 | 118 | ${UNITY_SRC}/ResultRenderer.cpp | ||
266 | 119 | ${UNITY_SRC}/ResultRendererTile.cpp | ||
267 | 120 | ${UNITY_SRC}/ResultRendererHorizontalTile.cpp | ||
268 | 121 | ${UNITY_SRC}/TextureCache.h | ||
269 | 122 | ${UNITY_SRC}/TextureCache.cpp | ||
270 | 123 | ${UNITY_SRC}/Timer.cpp | ||
271 | 124 | ${UNITY_SRC}/Timer.h | ||
272 | 125 | ${UNITY_SRC}/StaticCairoText.cpp | ||
273 | 126 | ${UNITY_SRC}/StaticCairoText.h | ||
274 | 127 | ${UNITY_SRC}/UBusMessages.h | ||
275 | 128 | ${UNITY_SRC}/UBusWrapper.cpp | ||
276 | 129 | ${UNITY_SRC}/UBusWrapper.h | ||
277 | 130 | ${UNITY_SRC}/ubus-server.cpp | ||
278 | 131 | ${UNITY_SRC}/ubus-server.h | ||
279 | 132 | ${UNITY_SRC}/UScreen.cpp | ||
280 | 133 | ${UNITY_SRC}/UScreen.h | ||
281 | 134 | ) | ||
282 | 135 | add_dependencies (dash unity-core-${UNITY_API_VERSION}) | ||
283 | 136 | |||
284 | 137 | add_executable (panel | ||
285 | 138 | TestPanel.cpp | ||
286 | 139 | ${UNITY_SRC}/Animator.cpp | ||
287 | 140 | ${UNITY_SRC}/Animator.h | ||
288 | 141 | ${UNITY_SRC}/BackgroundEffectHelper.cpp | ||
289 | 142 | ${UNITY_SRC}/BackgroundEffectHelper.h | ||
290 | 143 | ${UNITY_SRC}/DashSettings.cpp | ||
291 | 144 | ${UNITY_SRC}/DashSettings.h | ||
292 | 145 | ${UNITY_SRC}/PanelStyle.cpp | ||
293 | 146 | ${UNITY_SRC}/PanelStyle.h | ||
294 | 147 | ${UNITY_SRC}/PanelView.cpp | ||
295 | 148 | ${UNITY_SRC}/PanelView.h | ||
296 | 149 | ${UNITY_SRC}/PanelIndicatorsView.cpp | ||
297 | 150 | ${UNITY_SRC}/PanelIndicatorsView.h | ||
298 | 151 | ${UNITY_SRC}/PanelIndicatorEntryView.cpp | ||
299 | 152 | ${UNITY_SRC}/PanelIndicatorEntryView.h | ||
300 | 153 | ${UNITY_SRC}/PanelTitlebarGrabAreaView.h | ||
301 | 154 | ${UNITY_SRC}/PanelTitlebarGrabAreaView.cpp | ||
302 | 155 | ${UNITY_SRC}/PanelTray.cpp | ||
303 | 156 | ${UNITY_SRC}/PanelTray.h | ||
304 | 157 | ${UNITY_SRC}/Introspectable.cpp | ||
305 | 158 | ${UNITY_SRC}/Introspectable.h | ||
306 | 159 | ${UNITY_SRC}/PanelMenuView.cpp | ||
307 | 160 | ${UNITY_SRC}/PanelMenuView.h | ||
308 | 161 | ${UNITY_SRC}/Timer.cpp | ||
309 | 162 | ${UNITY_SRC}/Timer.h | ||
310 | 163 | ${UNITY_SRC}/StaticCairoText.cpp | ||
311 | 164 | ${UNITY_SRC}/StaticCairoText.h | ||
312 | 165 | ${UNITY_SRC}/WindowButtons.cpp | ||
313 | 166 | ${UNITY_SRC}/WindowButtons.h | ||
314 | 167 | ${UNITY_SRC}/WindowManager.cpp | ||
315 | 168 | ${UNITY_SRC}/WindowManager.h | ||
316 | 169 | ${UNITY_SRC}/UScreen.cpp | ||
317 | 170 | ${UNITY_SRC}/UScreen.h | ||
318 | 171 | ${UNITY_SRC}/ubus-server.cpp | ||
319 | 172 | ${UNITY_SRC}/ubus-server.h | ||
320 | 173 | ) | ||
321 | 174 | add_dependencies (panel unity-core-${UNITY_API_VERSION}) | ||
322 | 175 | |||
323 | 176 | add_executable (switcher | ||
324 | 177 | TestSwitcher.cpp | ||
325 | 178 | ${UNITY_SRC}/AbstractLauncherIcon.h | ||
326 | 179 | ${UNITY_SRC}/AbstractIconRenderer.h | ||
327 | 180 | ${UNITY_SRC}/SwitcherController.cpp | ||
328 | 181 | ${UNITY_SRC}/SwitcherController.h | ||
329 | 182 | ${UNITY_SRC}/SwitcherModel.cpp | ||
330 | 183 | ${UNITY_SRC}/SwitcherModel.h | ||
331 | 184 | ${UNITY_SRC}/SwitcherView.cpp | ||
332 | 185 | ${UNITY_SRC}/SwitcherView.h | ||
333 | 186 | ${UNITY_SRC}/LayoutSystem.h | ||
334 | 187 | ${UNITY_SRC}/LayoutSystem.cpp | ||
335 | 188 | ${UNITY_SRC}/WindowManager.h | ||
336 | 189 | ${UNITY_SRC}/WindowManager.cpp | ||
337 | 190 | ${UNITY_SRC}/IconRenderer.cpp | ||
338 | 191 | ${UNITY_SRC}/IconRenderer.h | ||
339 | 192 | ${UNITY_SRC}/Introspectable.cpp | ||
340 | 193 | ${UNITY_SRC}/Introspectable.h | ||
341 | 194 | ${UNITY_SRC}/MockLauncherIcon.h | ||
342 | 195 | ${UNITY_SRC}/BackgroundEffectHelper.h | ||
343 | 196 | ${UNITY_SRC}/BackgroundEffectHelper.cpp | ||
344 | 197 | ${UNITY_SRC}/StaticCairoText.cpp | ||
345 | 198 | ${UNITY_SRC}/StaticCairoText.h | ||
346 | 199 | ${UNITY_SRC}/UBusMessages.h | ||
347 | 200 | ${UNITY_SRC}/ubus-server.cpp | ||
348 | 201 | ${UNITY_SRC}/ubus-server.h | ||
349 | 202 | ) | ||
350 | 203 | add_dependencies (switcher unity-core-${UNITY_API_VERSION}) | ||
351 | 204 | |||
352 | 205 | add_executable (launcher | ||
353 | 206 | TestLauncher.cpp | ||
354 | 207 | ${UNITY_SRC}/CairoBaseWindow.cpp | ||
355 | 208 | ${UNITY_SRC}/AbstractLauncherIcon.h | ||
356 | 209 | ${UNITY_SRC}/AbstractLauncherIcon.cpp | ||
357 | 210 | ${UNITY_SRC}/AbstractIconRenderer.h | ||
358 | 211 | ${UNITY_SRC}/LauncherIcon.cpp | ||
359 | 212 | ${UNITY_SRC}/LauncherIcon.h | ||
360 | 213 | ${UNITY_SRC}/SimpleLauncherIcon.cpp | ||
361 | 214 | ${UNITY_SRC}/SimpleLauncherIcon.h | ||
362 | 215 | ${UNITY_SRC}/BamfLauncherIcon.cpp | ||
363 | 216 | ${UNITY_SRC}/BamfLauncherIcon.h | ||
364 | 217 | ${UNITY_SRC}/BFBLauncherIcon.cpp | ||
365 | 218 | ${UNITY_SRC}/BFBLauncherIcon.h | ||
366 | 219 | ${UNITY_SRC}/SpacerLauncherIcon.cpp | ||
367 | 220 | ${UNITY_SRC}/SpacerLauncherIcon.h | ||
368 | 221 | ${UNITY_SRC}/DndData.cpp | ||
369 | 222 | ${UNITY_SRC}/DndData.h | ||
370 | 223 | ${UNITY_SRC}/TrashLauncherIcon.cpp | ||
371 | 224 | ${UNITY_SRC}/TrashLauncherIcon.h | ||
372 | 225 | ${UNITY_SRC}/Decaymulator.cpp | ||
373 | 226 | ${UNITY_SRC}/Decaymulator.h | ||
374 | 227 | ${UNITY_SRC}/DesktopLauncherIcon.cpp | ||
375 | 228 | ${UNITY_SRC}/DesktopLauncherIcon.h | ||
376 | 229 | ${UNITY_SRC}/DNDCollectionWindow.cpp | ||
377 | 230 | ${UNITY_SRC}/DNDCollectionWindow.h | ||
378 | 231 | ${UNITY_SRC}/DeviceLauncherIcon.cpp | ||
379 | 232 | ${UNITY_SRC}/DeviceLauncherIcon.h | ||
380 | 233 | ${UNITY_SRC}/DeviceLauncherSection.cpp | ||
381 | 234 | ${UNITY_SRC}/DeviceLauncherSection.h | ||
382 | 235 | ${UNITY_SRC}/DevicesSettings.cpp | ||
383 | 236 | ${UNITY_SRC}/DevicesSettings.h | ||
384 | 237 | ${UNITY_SRC}/EdgeBarrierController.h | ||
385 | 238 | ${UNITY_SRC}/EdgeBarrierController.cpp | ||
386 | 239 | ${UNITY_SRC}/FavoriteStore.cpp | ||
387 | 240 | ${UNITY_SRC}/FavoriteStore.h | ||
388 | 241 | ${UNITY_SRC}/FavoriteStoreGSettings.cpp | ||
389 | 242 | ${UNITY_SRC}/FavoriteStoreGSettings.h | ||
390 | 243 | ${UNITY_SRC}/FavoriteStorePrivate.cpp | ||
391 | 244 | ${UNITY_SRC}/FavoriteStorePrivate.h | ||
392 | 245 | ${UNITY_SRC}/HudLauncherIcon.cpp | ||
393 | 246 | ${UNITY_SRC}/HudLauncherIcon.h | ||
394 | 247 | ${UNITY_SRC}/IconLoader.cpp | ||
395 | 248 | ${UNITY_SRC}/IconLoader.h | ||
396 | 249 | ${UNITY_SRC}/IconTextureSource.h | ||
397 | 250 | ${UNITY_SRC}/IconTextureSource.cpp | ||
398 | 251 | ${UNITY_SRC}/LauncherOptions.cpp | ||
399 | 252 | ${UNITY_SRC}/LauncherOptions.h | ||
400 | 253 | ${UNITY_SRC}/LauncherEntryRemoteModel.cpp | ||
401 | 254 | ${UNITY_SRC}/LauncherEntryRemoteModel.h | ||
402 | 255 | ${UNITY_SRC}/LauncherEntryRemote.cpp | ||
403 | 256 | ${UNITY_SRC}/LauncherEntryRemote.h | ||
404 | 257 | ${UNITY_SRC}/LauncherController.cpp | ||
405 | 258 | ${UNITY_SRC}/LauncherController.h | ||
406 | 259 | ${UNITY_SRC}/LauncherModel.cpp | ||
407 | 260 | ${UNITY_SRC}/LauncherModel.h | ||
408 | 261 | ${UNITY_SRC}/Launcher.cpp | ||
409 | 262 | ${UNITY_SRC}/Launcher.h | ||
410 | 263 | ${UNITY_SRC}/LauncherHideMachine.cpp | ||
411 | 264 | ${UNITY_SRC}/LauncherHideMachine.h | ||
412 | 265 | ${UNITY_SRC}/LauncherHoverMachine.cpp | ||
413 | 266 | ${UNITY_SRC}/LauncherHoverMachine.h | ||
414 | 267 | ${UNITY_SRC}/LauncherDragWindow.cpp | ||
415 | 268 | ${UNITY_SRC}/LauncherDragWindow.h | ||
416 | 269 | ${UNITY_SRC}/GeisAdapter.cpp | ||
417 | 270 | ${UNITY_SRC}/GeisAdapter.h | ||
418 | 271 | ${UNITY_SRC}/WindowManager.h | ||
419 | 272 | ${UNITY_SRC}/WindowManager.cpp | ||
420 | 273 | ${UNITY_SRC}/IconRenderer.cpp | ||
421 | 274 | ${UNITY_SRC}/IconRenderer.h | ||
422 | 275 | ${UNITY_SRC}/Tooltip.cpp | ||
423 | 276 | ${UNITY_SRC}/Tooltip.h | ||
424 | 277 | ${UNITY_SRC}/BackgroundEffectHelper.h | ||
425 | 278 | ${UNITY_SRC}/BackgroundEffectHelper.cpp | ||
426 | 279 | ${UNITY_SRC}/StaticCairoText.cpp | ||
427 | 280 | ${UNITY_SRC}/StaticCairoText.h | ||
428 | 281 | ${UNITY_SRC}/SingleMonitorLauncherIcon.cpp | ||
429 | 282 | ${UNITY_SRC}/SingleMonitorLauncherIcon.h | ||
430 | 283 | ${UNITY_SRC}/SoftwareCenterLauncherIcon.cpp | ||
431 | 284 | ${UNITY_SRC}/SoftwareCenterLauncherIcon.h | ||
432 | 285 | ${UNITY_SRC}/Introspectable.cpp | ||
433 | 286 | ${UNITY_SRC}/Introspectable.h | ||
434 | 287 | ${UNITY_SRC}/PanelStyle.cpp | ||
435 | 288 | ${UNITY_SRC}/PanelStyle.h | ||
436 | 289 | ${UNITY_SRC}/PointerBarrier.cpp | ||
437 | 290 | ${UNITY_SRC}/PointerBarrier.h | ||
438 | 291 | ${UNITY_SRC}/QuicklistMenuItem.cpp | ||
439 | 292 | ${UNITY_SRC}/QuicklistMenuItem.h | ||
440 | 293 | ${UNITY_SRC}/QuicklistMenuItemCheckmark.cpp | ||
441 | 294 | ${UNITY_SRC}/QuicklistMenuItemCheckmark.h | ||
442 | 295 | ${UNITY_SRC}/QuicklistMenuItemLabel.cpp | ||
443 | 296 | ${UNITY_SRC}/QuicklistMenuItemLabel.h | ||
444 | 297 | ${UNITY_SRC}/QuicklistMenuItemRadio.cpp | ||
445 | 298 | ${UNITY_SRC}/QuicklistMenuItemRadio.h | ||
446 | 299 | ${UNITY_SRC}/QuicklistMenuItemSeparator.cpp | ||
447 | 300 | ${UNITY_SRC}/QuicklistMenuItemSeparator.h | ||
448 | 301 | ${UNITY_SRC}/QuicklistView.cpp | ||
449 | 302 | ${UNITY_SRC}/QuicklistView.h | ||
450 | 303 | ${UNITY_SRC}/QuicklistManager.cpp | ||
451 | 304 | ${UNITY_SRC}/QuicklistManager.h | ||
452 | 305 | ${UNITY_SRC}/TextureCache.cpp | ||
453 | 306 | ${UNITY_SRC}/TextureCache.h | ||
454 | 307 | ${UNITY_SRC}/Timer.cpp | ||
455 | 308 | ${UNITY_SRC}/Timer.h | ||
456 | 309 | ${UNITY_SRC}/UBusMessages.h | ||
457 | 310 | ${UNITY_SRC}/UBusWrapper.cpp | ||
458 | 311 | ${UNITY_SRC}/UBusWrapper.h | ||
459 | 312 | ${UNITY_SRC}/ubus-server.cpp | ||
460 | 313 | ${UNITY_SRC}/ubus-server.h | ||
461 | 314 | ${UNITY_SRC}/UScreen.cpp | ||
462 | 315 | ${UNITY_SRC}/UScreen.h | ||
463 | 316 | ) | ||
464 | 317 | add_dependencies (launcher unity-core-${UNITY_API_VERSION}) | ||
465 | 318 | |||
466 | 319 | add_executable (keyutil | ||
467 | 320 | TestKeyboardUtil.cpp | ||
468 | 321 | ${UNITY_SRC}/KeyboardUtil.h | ||
469 | 322 | ${UNITY_SRC}/KeyboardUtil.cpp | ||
470 | 323 | ) | ||
471 | 324 | add_dependencies (keyutil unity-core-${UNITY_API_VERSION}) | ||
472 | 325 | |||
473 | 326 | add_executable (quicklist | ||
474 | 327 | ui/TestQuicklist.cpp | ||
475 | 328 | nux_test_framework.cpp | ||
476 | 329 | nux_test_framework.h | ||
477 | 330 | nux_automated_test_framework.cpp | ||
478 | 331 | nux_automated_test_framework.h | ||
479 | 332 | ${UNITY_SRC}/CairoBaseWindow.cpp | ||
480 | 333 | ${UNITY_SRC}/Introspectable.cpp | ||
481 | 334 | ${UNITY_SRC}/QuicklistMenuItem.cpp | ||
482 | 335 | ${UNITY_SRC}/QuicklistMenuItemCheckmark.cpp | ||
483 | 336 | ${UNITY_SRC}/QuicklistMenuItemLabel.cpp | ||
484 | 337 | ${UNITY_SRC}/QuicklistMenuItemRadio.cpp | ||
485 | 338 | ${UNITY_SRC}/QuicklistMenuItemSeparator.cpp | ||
486 | 339 | ${UNITY_SRC}/QuicklistView.cpp | ||
487 | 340 | ${UNITY_SRC}/ubus-server.cpp | ||
488 | 341 | ) | ||
489 | 342 | add_dependencies(quicklist unity-core-${UNITY_API_VERSION}) | ||
490 | 343 | |||
491 | 344 | add_executable (quicklist-visuals | ||
492 | 345 | ui/TestQuicklistVisuals.cpp | ||
493 | 346 | ui/EventFaker.cpp | ||
494 | 347 | ui/EventFaker.h | ||
495 | 348 | ${UNITY_SRC}/CairoBaseWindow.cpp | ||
496 | 349 | ${UNITY_SRC}/Introspectable.cpp | ||
497 | 350 | ${UNITY_SRC}/QuicklistMenuItem.cpp | ||
498 | 351 | ${UNITY_SRC}/QuicklistMenuItemCheckmark.cpp | ||
499 | 352 | ${UNITY_SRC}/QuicklistMenuItemLabel.cpp | ||
500 | 353 | ${UNITY_SRC}/QuicklistMenuItemRadio.cpp | ||
501 | 354 | ${UNITY_SRC}/QuicklistMenuItemSeparator.cpp | ||
502 | 355 | ${UNITY_SRC}/QuicklistView.cpp | ||
503 | 356 | ${UNITY_SRC}/ubus-server.cpp | ||
504 | 357 | ) | ||
505 | 358 | add_dependencies(quicklist-visuals unity-core-${UNITY_API_VERSION}) | ||
506 | 359 | |||
507 | 360 | add_executable (filters | ||
508 | 361 | TestFilters.cpp | ||
509 | 362 | ${UNITY_SRC}/FilterExpanderLabel.cpp | ||
510 | 363 | ${UNITY_SRC}/FilterBasicButton.cpp | ||
511 | 364 | ${UNITY_SRC}/FilterRatingsButton.cpp | ||
512 | 365 | ${UNITY_SRC}/FilterRatingsWidget.cpp | ||
513 | 366 | ${UNITY_SRC}/FilterGenreButton.cpp | ||
514 | 367 | ${UNITY_SRC}/FilterGenreWidget.cpp | ||
515 | 368 | ${UNITY_SRC}/FilterMultiRangeButton.cpp | ||
516 | 369 | ${UNITY_SRC}/FilterMultiRangeWidget.cpp | ||
517 | 370 | ${UNITY_SRC}/DashStyle.cpp | ||
518 | 371 | ${UNITY_SRC}/JSONParser.cpp | ||
519 | 372 | ) | ||
520 | 373 | add_dependencies(filters unity-core-${UNITY_API_VERSION}) | ||
521 | 374 | |||
522 | 375 | add_executable (filter-bar | ||
523 | 376 | TestFilterBar.cpp | ||
524 | 377 | ${UNITY_SRC}/FilterAllButton.cpp | ||
525 | 378 | ${UNITY_SRC}/FilterBar.cpp | ||
526 | 379 | ${UNITY_SRC}/FilterBasicButton.cpp | ||
527 | 380 | ${UNITY_SRC}/FilterExpanderLabel.cpp | ||
528 | 381 | ${UNITY_SRC}/FilterFactory.cpp | ||
529 | 382 | ${UNITY_SRC}/FilterMultiRangeWidget.cpp | ||
530 | 383 | ${UNITY_SRC}/FilterMultiRangeButton.cpp | ||
531 | 384 | ${UNITY_SRC}/FilterGenreButton.cpp | ||
532 | 385 | ${UNITY_SRC}/FilterGenreWidget.cpp | ||
533 | 386 | ${UNITY_SRC}/FilterRatingsButton.cpp | ||
534 | 387 | ${UNITY_SRC}/FilterRatingsWidget.cpp | ||
535 | 388 | ${UNITY_SRC}/DashStyle.cpp | ||
536 | 389 | ${UNITY_SRC}/JSONParser.cpp | ||
537 | 390 | ) | ||
538 | 391 | add_dependencies(filter-bar unity-core-${UNITY_API_VERSION}) | ||
539 | 392 | |||
540 | 393 | add_executable (preview-applicaiton | ||
541 | 394 | TestPreviewApplications.cpp | ||
542 | 395 | ${UNITY_SRC}/PreviewApplications.cpp | ||
543 | 396 | ${UNITY_SRC}/PreviewBase.cpp | ||
544 | 397 | ${UNITY_SRC}/PreviewBasicButton.cpp | ||
545 | 398 | ${UNITY_SRC}/IconTexture.cpp | ||
546 | 399 | ${UNITY_SRC}/IconLoader.cpp | ||
547 | 400 | ${UNITY_SRC}/Introspectable.cpp | ||
548 | 401 | ${UNITY_SRC}/StaticCairoText.cpp | ||
549 | 402 | ${UNITY_SRC}/TextureCache.cpp | ||
550 | 403 | ${UNITY_SRC}/DashStyle.cpp | ||
551 | 404 | ${UNITY_SRC}/JSONParser.cpp | ||
552 | 405 | ${UNITY_SRC}/Timer.cpp | ||
553 | 406 | ) | ||
554 | 407 | add_dependencies(preview-applicaiton unity-core-${UNITY_API_VERSION}) | ||
555 | 408 | |||
556 | 409 | add_executable (preview-generic | ||
557 | 410 | TestPreviewGeneric.cpp | ||
558 | 411 | ${UNITY_SRC}/PreviewGeneric.cpp | ||
559 | 412 | ${UNITY_SRC}/PreviewBase.cpp | ||
560 | 413 | ${UNITY_SRC}/PreviewBasicButton.cpp | ||
561 | 414 | ${UNITY_SRC}/IconTexture.cpp | ||
562 | 415 | ${UNITY_SRC}/IconLoader.cpp | ||
563 | 416 | ${UNITY_SRC}/Introspectable.cpp | ||
564 | 417 | ${UNITY_SRC}/StaticCairoText.cpp | ||
565 | 418 | ${UNITY_SRC}/TextureCache.cpp | ||
566 | 419 | ${UNITY_SRC}/DashStyle.cpp | ||
567 | 420 | ${UNITY_SRC}/JSONParser.cpp | ||
568 | 421 | ${UNITY_SRC}/Timer.cpp | ||
569 | 422 | ) | ||
570 | 423 | add_dependencies(preview-generic unity-core-${UNITY_API_VERSION}) | ||
571 | 424 | |||
572 | 425 | add_executable (preview-music | ||
573 | 426 | TestPreviewMusic.cpp | ||
574 | 427 | ${UNITY_SRC}/PreviewBase.cpp | ||
575 | 428 | ${UNITY_SRC}/PreviewBasicButton.cpp | ||
576 | 429 | ${UNITY_SRC}/PreviewMusic.cpp | ||
577 | 430 | ${UNITY_SRC}/PreviewMusicTrack.cpp | ||
578 | 431 | ${UNITY_SRC}/PreviewMusicTrackWidget.cpp | ||
579 | 432 | ${UNITY_SRC}/IconTexture.cpp | ||
580 | 433 | ${UNITY_SRC}/IconLoader.cpp | ||
581 | 434 | ${UNITY_SRC}/Introspectable.cpp | ||
582 | 435 | ${UNITY_SRC}/StaticCairoText.cpp | ||
583 | 436 | ${UNITY_SRC}/TextureCache.cpp | ||
584 | 437 | ${UNITY_SRC}/DashStyle.cpp | ||
585 | 438 | ${UNITY_SRC}/JSONParser.cpp | ||
586 | 439 | ${UNITY_SRC}/Timer.cpp | ||
587 | 440 | ) | ||
588 | 441 | add_dependencies(preview-music unity-core-${UNITY_API_VERSION}) | ||
589 | 442 | |||
590 | 443 | add_executable (result-view | ||
591 | 444 | TestResultView.cpp | ||
592 | 445 | ${UNITY_SRC}/PreviewApplications.cpp | ||
593 | 446 | ${UNITY_SRC}/PreviewBase.cpp | ||
594 | 447 | ${UNITY_SRC}/PreviewBasicButton.cpp | ||
595 | 448 | ${UNITY_SRC}/ResultView.cpp | ||
596 | 449 | ${UNITY_SRC}/ResultViewGrid.cpp | ||
597 | 450 | ${UNITY_SRC}/ResultRenderer.cpp | ||
598 | 451 | ${UNITY_SRC}/ResultRendererTile.cpp | ||
599 | 452 | ${UNITY_SRC}/ResultRendererHorizontalTile.cpp | ||
600 | 453 | ${UNITY_SRC}/IconTexture.cpp | ||
601 | 454 | ${UNITY_SRC}/IconLoader.cpp | ||
602 | 455 | ${UNITY_SRC}/Introspectable.cpp | ||
603 | 456 | ${UNITY_SRC}/StaticCairoText.cpp | ||
604 | 457 | ${UNITY_SRC}/TextureCache.cpp | ||
605 | 458 | ${UNITY_SRC}/Timer.cpp | ||
606 | 459 | ${UNITY_SRC}/DashStyle.cpp | ||
607 | 460 | ${UNITY_SRC}/JSONParser.cpp | ||
608 | 461 | ${UNITY_SRC}/UBusMessages.h | ||
609 | 462 | ${UNITY_SRC}/UBusWrapper.cpp | ||
610 | 463 | ${UNITY_SRC}/UBusWrapper.h | ||
611 | 464 | ${UNITY_SRC}/ubus-server.cpp | ||
612 | 465 | ${UNITY_SRC}/ubus-server.h | ||
613 | 466 | ) | ||
614 | 467 | add_dependencies(result-view unity-core-${UNITY_API_VERSION}) | ||
615 | 468 | |||
616 | 469 | add_executable (dash-style | ||
617 | 470 | TestDashStyle.cpp | ||
618 | 471 | ${UNITY_SRC}/DashStyle.cpp | ||
619 | 472 | ${UNITY_SRC}/DashStyle.h | ||
620 | 473 | ${UNITY_SRC}/JSONParser.cpp | ||
621 | 474 | ${PLACES_COMMON_SOURCE} | ||
622 | 475 | ) | ||
623 | 476 | add_dependencies(dash-style unity-core-${UNITY_API_VERSION}) | ||
624 | 477 | |||
625 | 478 | add_executable (bg-hash | ||
626 | 479 | TestBGHash.cpp | ||
627 | 480 | ${UNITY_SRC}/BGHash.cpp | ||
628 | 481 | ${UNITY_SRC}/BGHash.h | ||
629 | 482 | ${UNITY_SRC}/ubus-server.cpp | ||
630 | 483 | ${UNITY_SRC}/ubus-server.h | ||
631 | 484 | ) | ||
632 | 485 | add_dependencies (bg-hash unity-core-${UNITY_API_VERSION}) | ||
633 | 486 | |||
634 | 487 | add_executable (hud | ||
635 | 488 | StandaloneHud.cpp | ||
636 | 489 | ${UNITY_SRC}/BackgroundEffectHelper.cpp | ||
637 | 490 | ${UNITY_SRC}/BackgroundEffectHelper.h | ||
638 | 491 | ${UNITY_SRC}/DashSettings.cpp | ||
639 | 492 | ${UNITY_SRC}/DashSettings.h | ||
640 | 493 | ${UNITY_SRC}/DashStyle.cpp | ||
641 | 494 | ${UNITY_SRC}/HudButton.cpp | ||
642 | 495 | ${UNITY_SRC}/HudIcon.cpp | ||
643 | 496 | ${UNITY_SRC}/HudIcon.h | ||
644 | 497 | ${UNITY_SRC}/HudIconTextureSource.cpp | ||
645 | 498 | ${UNITY_SRC}/HudIconTextureSource.h | ||
646 | 499 | ${UNITY_SRC}/HudView.cpp | ||
647 | 500 | ${UNITY_SRC}/IMTextEntry.cpp | ||
648 | 501 | ${UNITY_SRC}/Introspectable.cpp | ||
649 | 502 | ${UNITY_SRC}/IconTexture.cpp | ||
650 | 503 | ${UNITY_SRC}/IconLoader.cpp | ||
651 | 504 | ${UNITY_SRC}/IconRenderer.cpp | ||
652 | 505 | ${UNITY_SRC}/IconTextureSource.cpp | ||
653 | 506 | ${UNITY_SRC}/JSONParser.cpp | ||
654 | 507 | ${UNITY_SRC}/OverlayRenderer.cpp | ||
655 | 508 | ${UNITY_SRC}/SearchBar.cpp | ||
656 | 509 | ${UNITY_SRC}/SearchBarSpinner.cpp | ||
657 | 510 | ${UNITY_SRC}/StaticCairoText.cpp | ||
658 | 511 | ${UNITY_SRC}/TextureCache.cpp | ||
659 | 512 | ${UNITY_SRC}/Timer.cpp | ||
660 | 513 | ${UNITY_SRC}/UBusWrapper.cpp | ||
661 | 514 | ${UNITY_SRC}/ubus-server.cpp | ||
662 | 515 | ${UNITY_SRC}/UScreen.cpp | ||
663 | 516 | ${UNITY_SRC}/UScreen.h | ||
664 | 517 | ) | ||
665 | 518 | add_dependencies (hud unity-core-${UNITY_API_VERSION}) | ||
666 | 519 | |||
667 | 520 | add_executable (test-shortcut | ||
668 | 521 | TestShortcut.cpp | ||
669 | 522 | ${UNITY_SRC}/AbstractSeparator.cpp | ||
670 | 523 | ${UNITY_SRC}/AbstractSeparator.h | ||
671 | 524 | ${UNITY_SRC}/AbstractShortcutHint.h | ||
672 | 525 | ${UNITY_SRC}/Animator.cpp | ||
673 | 526 | ${UNITY_SRC}/Animator.h | ||
674 | 527 | ${UNITY_SRC}/BackgroundEffectHelper.cpp | ||
675 | 528 | ${UNITY_SRC}/BackgroundEffectHelper.h | ||
676 | 529 | ${UNITY_SRC}/LineSeparator.cpp | ||
677 | 530 | ${UNITY_SRC}/LineSeparator.h | ||
678 | 531 | ${UNITY_SRC}/MockShortcutHint.h | ||
679 | 532 | ${UNITY_SRC}/ShortcutController.cpp | ||
680 | 533 | ${UNITY_SRC}/ShortcutController.h | ||
681 | 534 | ${UNITY_SRC}/ShortcutModel.cpp | ||
682 | 535 | ${UNITY_SRC}/ShortcutModel.h | ||
683 | 536 | ${UNITY_SRC}/ShortcutView.cpp | ||
684 | 537 | ${UNITY_SRC}/ShortcutView.h | ||
685 | 538 | ${UNITY_SRC}/StaticCairoText.cpp | ||
686 | 539 | ${UNITY_SRC}/StaticCairoText.h | ||
687 | 540 | ${UNITY_SRC}/UBusMessages.h | ||
688 | 541 | ${UNITY_SRC}/ubus-server.cpp | ||
689 | 542 | ${UNITY_SRC}/ubus-server.h | ||
690 | 543 | ) | ||
691 | 544 | |||
692 | 545 | add_executable (tooltip | ||
693 | 546 | ui/TestTooltip.cpp | ||
694 | 547 | ${UNITY_SRC}/Introspectable.cpp | ||
695 | 548 | ${UNITY_SRC}/CairoBaseWindow.cpp | ||
696 | 549 | ${UNITY_SRC}/StaticCairoText.cpp | ||
697 | 550 | ${UNITY_SRC}/Tooltip.cpp | ||
698 | 551 | ${UNITY_SRC}/ubus-server.cpp | ||
699 | 552 | ) | ||
700 | 553 | add_dependencies(quicklist unity-core-${UNITY_API_VERSION}) | ||
701 | 554 | |||
702 | 555 | find_package (OpenGL) | ||
703 | 556 | include_directories (${OPENGL_gl_INCDIRS}) | ||
704 | 557 | add_library (glfuncloader SHARED | ||
705 | 558 | ${CMAKE_CURRENT_SOURCE_DIR}/GLFuncLoader.cpp) | ||
706 | 559 | add_dependencies (glfuncloader unity-core-${UNITY_API_VERSION}) | ||
707 | 560 | target_link_libraries (glfuncloader dl ${OPENGL_gl_LIBRARY}) | ||
708 | 561 | add_executable (screen-effect-fbo | ||
709 | 562 | TestScreenEffectFramebufferObject.cpp | ||
710 | 563 | ${UNITY_SRC}/ScreenEffectFramebufferObject.cpp | ||
711 | 564 | ${UNITY_SRC}/BackgroundEffectHelper.cpp) | ||
712 | 565 | |||
713 | 566 | target_link_libraries (screen-effect-fbo glfuncloader ${OPENGL_gl_LIBRARY}) | ||
714 | 567 | add_dependencies (screen-effect-fbo ${UNITY_API_VERSION}) | ||
715 | 568 | |||
716 | 569 | # Custom target to make all the other targets here, add your test to this list | ||
717 | 570 | add_custom_target(standalone-clients DEPENDS dash panel launcher switcher keyutil quicklist quicklist-visuals filters filter-bar preview-applicaiton preview-generic preview-music result-view dash-style bg-hash shortcut-view tooltip) | ||
718 | 571 | |||
719 | 572 | |||
720 | 573 | |||
721 | 574 | |||
722 | 0 | 575 | ||
723 | === modified file 'tests/CMakeLists.txt' | |||
724 | --- tests/CMakeLists.txt 2012-05-22 15:48:31 +0000 | |||
725 | +++ tests/CMakeLists.txt 2012-05-24 17:16:22 +0000 | |||
726 | @@ -205,6 +205,7 @@ | |||
727 | 205 | test_single_monitor_launcher_icon.cpp | 205 | test_single_monitor_launcher_icon.cpp |
728 | 206 | test_switcher_controller.cpp | 206 | test_switcher_controller.cpp |
729 | 207 | test_switcher_model.cpp | 207 | test_switcher_model.cpp |
730 | 208 | <<<<<<< TREE | ||
731 | 208 | ${CMAKE_SOURCE_DIR}/dash/AbstractPlacesGroup.cpp | 209 | ${CMAKE_SOURCE_DIR}/dash/AbstractPlacesGroup.cpp |
732 | 209 | ${CMAKE_SOURCE_DIR}/dash/DashViewPrivate.cpp | 210 | ${CMAKE_SOURCE_DIR}/dash/DashViewPrivate.cpp |
733 | 210 | ${CMAKE_SOURCE_DIR}/dash/LensViewPrivate.cpp | 211 | ${CMAKE_SOURCE_DIR}/dash/LensViewPrivate.cpp |
734 | @@ -257,6 +258,59 @@ | |||
735 | 257 | ${CMAKE_SOURCE_DIR}/unity-shared/UnityWindowView.cpp | 258 | ${CMAKE_SOURCE_DIR}/unity-shared/UnityWindowView.cpp |
736 | 258 | ${CMAKE_SOURCE_DIR}/unity-shared/WindowManager.cpp | 259 | ${CMAKE_SOURCE_DIR}/unity-shared/WindowManager.cpp |
737 | 259 | ${CMAKE_SOURCE_DIR}/unity-shared/ubus-server.cpp | 260 | ${CMAKE_SOURCE_DIR}/unity-shared/ubus-server.cpp |
738 | 261 | ======= | ||
739 | 262 | ${UNITY_SRC}/AbstractLauncherIcon.cpp | ||
740 | 263 | ${UNITY_SRC}/AbstractPlacesGroup.cpp | ||
741 | 264 | ${UNITY_SRC}/BackgroundEffectHelper.cpp | ||
742 | 265 | ${UNITY_SRC}/CairoBaseWindow.cpp | ||
743 | 266 | ${UNITY_SRC}/DashViewPrivate.cpp | ||
744 | 267 | ${UNITY_SRC}/Decaymulator.cpp | ||
745 | 268 | ${UNITY_SRC}/DNDCollectionWindow.cpp | ||
746 | 269 | ${UNITY_SRC}/DndData.cpp | ||
747 | 270 | ${UNITY_SRC}/GeisAdapter.cpp | ||
748 | 271 | ${UNITY_SRC}/IconLoader.cpp | ||
749 | 272 | ${UNITY_SRC}/IconRenderer.cpp | ||
750 | 273 | ${UNITY_SRC}/IconTextureSource.cpp | ||
751 | 274 | ${UNITY_SRC}/Introspectable.cpp | ||
752 | 275 | ${UNITY_SRC}/LayoutSystem.cpp | ||
753 | 276 | ${UNITY_SRC}/Launcher.cpp | ||
754 | 277 | ${UNITY_SRC}/LauncherDragWindow.cpp | ||
755 | 278 | ${UNITY_SRC}/LauncherEntryRemote.cpp | ||
756 | 279 | ${UNITY_SRC}/LauncherHideMachine.cpp | ||
757 | 280 | ${UNITY_SRC}/LauncherHoverMachine.cpp | ||
758 | 281 | ${UNITY_SRC}/LauncherIcon.cpp | ||
759 | 282 | ${UNITY_SRC}/LauncherModel.cpp | ||
760 | 283 | ${UNITY_SRC}/SimpleLauncherIcon.cpp | ||
761 | 284 | ${UNITY_SRC}/SingleMonitorLauncherIcon.cpp | ||
762 | 285 | ${UNITY_SRC}/LensViewPrivate.cpp | ||
763 | 286 | ${UNITY_SRC}/StaticCairoText.cpp | ||
764 | 287 | ${UNITY_SRC}/SwitcherController.cpp | ||
765 | 288 | ${UNITY_SRC}/SwitcherModel.cpp | ||
766 | 289 | ${UNITY_SRC}/SwitcherView.cpp | ||
767 | 290 | ${UNITY_SRC}/Timer.cpp | ||
768 | 291 | ${UNITY_SRC}/Tooltip.cpp | ||
769 | 292 | ${UNITY_SRC}/PanelStyle.cpp | ||
770 | 293 | ${UNITY_SRC}/PointerBarrier.cpp | ||
771 | 294 | ${UNITY_SRC}/QuicklistView.cpp | ||
772 | 295 | ${UNITY_SRC}/QuicklistManager.cpp | ||
773 | 296 | ${UNITY_SRC}/QuicklistMenuItem.cpp | ||
774 | 297 | ${UNITY_SRC}/QuicklistMenuItemCheckmark.cpp | ||
775 | 298 | ${UNITY_SRC}/QuicklistMenuItemLabel.cpp | ||
776 | 299 | ${UNITY_SRC}/QuicklistMenuItemRadio.cpp | ||
777 | 300 | ${UNITY_SRC}/QuicklistMenuItemSeparator.cpp | ||
778 | 301 | ${UNITY_SRC}/SpacerLauncherIcon.cpp | ||
779 | 302 | ${UNITY_SRC}/TextureCache.cpp | ||
780 | 303 | ${UNITY_SRC}/UBusWrapper.cpp | ||
781 | 304 | ${UNITY_SRC}/UnityWindowStyle.cpp | ||
782 | 305 | ${UNITY_SRC}/UnityWindowView.cpp | ||
783 | 306 | ${UNITY_SRC}/ubus-server.cpp | ||
784 | 307 | ${UNITY_SRC}/UScreen.cpp | ||
785 | 308 | ${UNITY_SRC}/WindowManager.cpp | ||
786 | 309 | ${UNITY_SRC}/ResultView.cpp | ||
787 | 310 | ${UNITY_SRC}/ResultViewGrid.cpp | ||
788 | 311 | ${UNITY_SRC}/ResultRenderer.cpp | ||
789 | 312 | ${UNITY_SRC}/IntrospectableWrappers.cpp | ||
790 | 313 | >>>>>>> MERGE-SOURCE | ||
791 | 260 | ) | 314 | ) |
792 | 261 | target_link_libraries(test-gtest gtest gmock ${LIBS}) | 315 | target_link_libraries(test-gtest gtest gmock ${LIBS}) |
793 | 262 | add_test(UnityGTest test-gtest) | 316 | add_test(UnityGTest test-gtest) |
794 | 263 | 317 | ||
795 | === added directory 'tests/autopilot/autopilot' | |||
796 | === added directory 'tests/autopilot/autopilot/emulators' | |||
797 | === added file 'tests/autopilot/autopilot/emulators/bamf.py.OTHER' | |||
798 | --- tests/autopilot/autopilot/emulators/bamf.py.OTHER 1970-01-01 00:00:00 +0000 | |||
799 | +++ tests/autopilot/autopilot/emulators/bamf.py.OTHER 2012-05-24 17:16:22 +0000 | |||
800 | @@ -0,0 +1,411 @@ | |||
801 | 1 | # Copyright 2011 Canonical | ||
802 | 2 | # Author: Thomi Richards | ||
803 | 3 | # | ||
804 | 4 | # This program is free software: you can redistribute it and/or modify it | ||
805 | 5 | # under the terms of the GNU General Public License version 3, as published | ||
806 | 6 | # by the Free Software Foundation. | ||
807 | 7 | |||
808 | 8 | "Various classes for interacting with BAMF." | ||
809 | 9 | |||
810 | 10 | import dbus | ||
811 | 11 | import dbus.glib | ||
812 | 12 | import gio | ||
813 | 13 | import gobject | ||
814 | 14 | import os | ||
815 | 15 | from Xlib import display, X, protocol | ||
816 | 16 | from gtk import gdk | ||
817 | 17 | |||
818 | 18 | from autopilot.emulators.dbus_handler import session_bus | ||
819 | 19 | |||
820 | 20 | __all__ = [ | ||
821 | 21 | "Bamf", | ||
822 | 22 | "BamfApplication", | ||
823 | 23 | "BamfWindow", | ||
824 | 24 | ] | ||
825 | 25 | |||
826 | 26 | _BAMF_BUS_NAME = 'org.ayatana.bamf' | ||
827 | 27 | _X_DISPLAY = display.Display() | ||
828 | 28 | |||
829 | 29 | |||
830 | 30 | def _filter_user_visible(win): | ||
831 | 31 | """Filter out non-user-visible objects. | ||
832 | 32 | |||
833 | 33 | In some cases the DBus method we need to call hasn't been registered yet, | ||
834 | 34 | in which case we do the safe thing and return False. | ||
835 | 35 | |||
836 | 36 | """ | ||
837 | 37 | try: | ||
838 | 38 | return win.user_visible | ||
839 | 39 | except dbus.DBusException: | ||
840 | 40 | return False | ||
841 | 41 | |||
842 | 42 | |||
843 | 43 | class Bamf(object): | ||
844 | 44 | """High-level class for interacting with Bamf from within a test. | ||
845 | 45 | |||
846 | 46 | Use this class to inspect the state of running applications and open | ||
847 | 47 | windows. | ||
848 | 48 | |||
849 | 49 | """ | ||
850 | 50 | |||
851 | 51 | def __init__(self): | ||
852 | 52 | matcher_path = '/org/ayatana/bamf/matcher' | ||
853 | 53 | self.matcher_interface_name = 'org.ayatana.bamf.matcher' | ||
854 | 54 | self.matcher_proxy = session_bus.get_object(_BAMF_BUS_NAME, matcher_path) | ||
855 | 55 | self.matcher_interface = dbus.Interface(self.matcher_proxy, self.matcher_interface_name) | ||
856 | 56 | |||
857 | 57 | def get_running_applications(self, user_visible_only=True): | ||
858 | 58 | """Get a list of the currently running applications. | ||
859 | 59 | |||
860 | 60 | If user_visible_only is True (the default), only applications | ||
861 | 61 | visible to the user in the switcher will be returned. | ||
862 | 62 | |||
863 | 63 | """ | ||
864 | 64 | apps = [BamfApplication(p) for p in self.matcher_interface.RunningApplications()] | ||
865 | 65 | if user_visible_only: | ||
866 | 66 | return filter(_filter_user_visible, apps) | ||
867 | 67 | return apps | ||
868 | 68 | |||
869 | 69 | def get_running_applications_by_desktop_file(self, desktop_file): | ||
870 | 70 | """Return a list of applications that have the desktop file 'desktop_file'`. | ||
871 | 71 | |||
872 | 72 | This method may return an empty list, if no applications | ||
873 | 73 | are found with the specified desktop file. | ||
874 | 74 | |||
875 | 75 | """ | ||
876 | 76 | return [a for a in self.get_running_applications() if a.desktop_file == desktop_file] | ||
877 | 77 | |||
878 | 78 | def get_application_by_xid(self, xid): | ||
879 | 79 | """Return the application that has a child with the requested xid or None.""" | ||
880 | 80 | |||
881 | 81 | app_path = self.matcher_interface.ApplicationForXid(xid) | ||
882 | 82 | if len(app_path): | ||
883 | 83 | return BamfApplication(app_path) | ||
884 | 84 | return None | ||
885 | 85 | |||
886 | 86 | def get_open_windows(self, user_visible_only=True): | ||
887 | 87 | """Get a list of currently open windows. | ||
888 | 88 | |||
889 | 89 | If user_visible_only is True (the default), only applications | ||
890 | 90 | visible to the user in the switcher will be returned. | ||
891 | 91 | |||
892 | 92 | The result is sorted to be in stacking order. | ||
893 | 93 | |||
894 | 94 | """ | ||
895 | 95 | |||
896 | 96 | windows = [BamfWindow(w) for w in self.matcher_interface.WindowStackForMonitor(-1)] | ||
897 | 97 | if user_visible_only: | ||
898 | 98 | windows = filter(_filter_user_visible, windows) | ||
899 | 99 | # Now sort on stacking order. | ||
900 | 100 | return reversed(windows) | ||
901 | 101 | |||
902 | 102 | def get_window_by_xid(self, xid): | ||
903 | 103 | """Get the BamfWindow that matches the provided 'xid'.""" | ||
904 | 104 | windows = [BamfWindow(w) for w in self.matcher_interface.WindowPaths() if BamfWindow(w).x_id == xid] | ||
905 | 105 | return windows[0] if windows else None | ||
906 | 106 | |||
907 | 107 | def wait_until_application_is_running(self, desktop_file, timeout): | ||
908 | 108 | """Wait until a given application is running. | ||
909 | 109 | |||
910 | 110 | 'desktop_file' is the name of the application desktop file. | ||
911 | 111 | 'timeout' is the maximum time to wait, in seconds. If set to | ||
912 | 112 | something less than 0, this method will wait forever. | ||
913 | 113 | |||
914 | 114 | This method returns true once the application is found, or false | ||
915 | 115 | if the application was not found until the timeout was reached. | ||
916 | 116 | """ | ||
917 | 117 | desktop_file = os.path.split(desktop_file)[1] | ||
918 | 118 | # python workaround since you can't assign to variables in the enclosing scope: | ||
919 | 119 | # see on_timeout_reached below... | ||
920 | 120 | found_app = [True] | ||
921 | 121 | |||
922 | 122 | # maybe the app is running already? | ||
923 | 123 | if len(self.get_running_applications_by_desktop_file(desktop_file)) == 0: | ||
924 | 124 | wait_forever = timeout < 0 | ||
925 | 125 | gobject_loop = gobject.MainLoop() | ||
926 | 126 | |||
927 | 127 | # No, so define a callback to watch the ViewOpened signal: | ||
928 | 128 | def on_view_added(bamf_path, name): | ||
929 | 129 | if bamf_path.split('/')[-1].startswith('application'): | ||
930 | 130 | app = BamfApplication(bamf_path) | ||
931 | 131 | if desktop_file == os.path.split(app.desktop_file)[1]: | ||
932 | 132 | gobject_loop.quit() | ||
933 | 133 | |||
934 | 134 | # ...and one for when the user-defined timeout has been reached: | ||
935 | 135 | def on_timeout_reached(): | ||
936 | 136 | gobject_loop.quit() | ||
937 | 137 | found_app[0] = False | ||
938 | 138 | return False | ||
939 | 139 | |||
940 | 140 | # need a timeout? if so, connect it: | ||
941 | 141 | if not wait_forever: | ||
942 | 142 | gobject.timeout_add(timeout * 1000, on_timeout_reached) | ||
943 | 143 | # connect signal handler: | ||
944 | 144 | session_bus.add_signal_receiver(on_view_added, 'ViewOpened') | ||
945 | 145 | # pump the gobject main loop until either the correct signal is emitted, or the | ||
946 | 146 | # timeout happens. | ||
947 | 147 | gobject_loop.run() | ||
948 | 148 | |||
949 | 149 | return found_app[0] | ||
950 | 150 | |||
951 | 151 | def launch_application(self, desktop_file, files=[], wait=True): | ||
952 | 152 | """Launch an application by specifying a desktop file. | ||
953 | 153 | |||
954 | 154 | `files` is a list of files to pass to the application. Not all apps support this. | ||
955 | 155 | |||
956 | 156 | If `wait` is True, this method will block until the application has launched. | ||
957 | 157 | |||
958 | 158 | Returns the Gobject process object. if wait is True (the default), | ||
959 | 159 | this method will not return until an instance of this application | ||
960 | 160 | appears in the BAMF application list. | ||
961 | 161 | """ | ||
962 | 162 | if type(files) is not list: | ||
963 | 163 | raise TypeError("files must be a list.") | ||
964 | 164 | proc = gio.unix.DesktopAppInfo(desktop_file) | ||
965 | 165 | proc.launch_uris(files) | ||
966 | 166 | if wait: | ||
967 | 167 | self.wait_until_application_is_running(desktop_file, -1) | ||
968 | 168 | return proc | ||
969 | 169 | |||
970 | 170 | |||
971 | 171 | class BamfApplication(object): | ||
972 | 172 | """Represents an application, with information as returned by Bamf. | ||
973 | 173 | |||
974 | 174 | Don't instantiate this class yourself. instead, use the methods as | ||
975 | 175 | provided by the Bamf class. | ||
976 | 176 | |||
977 | 177 | """ | ||
978 | 178 | def __init__(self, bamf_app_path): | ||
979 | 179 | self.bamf_app_path = bamf_app_path | ||
980 | 180 | try: | ||
981 | 181 | self._app_proxy = session_bus.get_object(_BAMF_BUS_NAME, bamf_app_path) | ||
982 | 182 | self._view_iface = dbus.Interface(self._app_proxy, 'org.ayatana.bamf.view') | ||
983 | 183 | self._app_iface = dbus.Interface(self._app_proxy, 'org.ayatana.bamf.application') | ||
984 | 184 | except dbus.DBusException, e: | ||
985 | 185 | e.message += 'bamf_app_path=%r' % (bamf_app_path) | ||
986 | 186 | raise | ||
987 | 187 | |||
988 | 188 | @property | ||
989 | 189 | def desktop_file(self): | ||
990 | 190 | """Get the application desktop file""" | ||
991 | 191 | return os.path.split(self._app_iface.DesktopFile())[1] | ||
992 | 192 | |||
993 | 193 | @property | ||
994 | 194 | def name(self): | ||
995 | 195 | """Get the application name. | ||
996 | 196 | |||
997 | 197 | Note: This may change according to the current locale. If you want a unique | ||
998 | 198 | string to match applications against, use the desktop_file instead. | ||
999 | 199 | |||
1000 | 200 | """ | ||
1001 | 201 | return self._view_iface.Name() | ||
1002 | 202 | |||
1003 | 203 | @property | ||
1004 | 204 | def icon(self): | ||
1005 | 205 | """Get the application icon.""" | ||
1006 | 206 | return self._view_iface.Icon() | ||
1007 | 207 | |||
1008 | 208 | @property | ||
1009 | 209 | def is_active(self): | ||
1010 | 210 | """Is the application active (i.e.- has keyboard focus)?""" | ||
1011 | 211 | return self._view_iface.IsActive() | ||
1012 | 212 | |||
1013 | 213 | @property | ||
1014 | 214 | def is_urgent(self): | ||
1015 | 215 | """Is the application currently signalling urgency?""" | ||
1016 | 216 | return self._view_iface.IsUrgent() | ||
1017 | 217 | |||
1018 | 218 | @property | ||
1019 | 219 | def user_visible(self): | ||
1020 | 220 | """Is this application visible to the user? | ||
1021 | 221 | |||
1022 | 222 | Some applications (such as the panel) are hidden to the user but will | ||
1023 | 223 | still be returned by bamf. | ||
1024 | 224 | |||
1025 | 225 | """ | ||
1026 | 226 | return self._view_iface.UserVisible() | ||
1027 | 227 | |||
1028 | 228 | def get_windows(self): | ||
1029 | 229 | """Get a list of the application windows.""" | ||
1030 | 230 | return [BamfWindow(w) for w in self._view_iface.Children()] | ||
1031 | 231 | |||
1032 | 232 | def __repr__(self): | ||
1033 | 233 | return "<BamfApplication '%s'>" % (self.name) | ||
1034 | 234 | |||
1035 | 235 | |||
1036 | 236 | class BamfWindow(object): | ||
1037 | 237 | """Represents an application window, as returned by Bamf. | ||
1038 | 238 | |||
1039 | 239 | Don't instantiate this class yourself. Instead, use the appropriate methods | ||
1040 | 240 | in BamfApplication. | ||
1041 | 241 | |||
1042 | 242 | """ | ||
1043 | 243 | def __init__(self, window_path): | ||
1044 | 244 | self._bamf_win_path = window_path | ||
1045 | 245 | self._app_proxy = session_bus.get_object(_BAMF_BUS_NAME, window_path) | ||
1046 | 246 | self._window_iface = dbus.Interface(self._app_proxy, 'org.ayatana.bamf.window') | ||
1047 | 247 | self._view_iface = dbus.Interface(self._app_proxy, 'org.ayatana.bamf.view') | ||
1048 | 248 | |||
1049 | 249 | self._xid = int(self._window_iface.GetXid()) | ||
1050 | 250 | self._x_root_win = _X_DISPLAY.screen().root | ||
1051 | 251 | self._x_win = _X_DISPLAY.create_resource_object('window', self._xid) | ||
1052 | 252 | |||
1053 | 253 | @property | ||
1054 | 254 | def x_id(self): | ||
1055 | 255 | """Get the X11 Window Id.""" | ||
1056 | 256 | return self._xid | ||
1057 | 257 | |||
1058 | 258 | @property | ||
1059 | 259 | def x_win(self): | ||
1060 | 260 | """Get the X11 window object of the underlying window.""" | ||
1061 | 261 | return self._x_win | ||
1062 | 262 | |||
1063 | 263 | @property | ||
1064 | 264 | def name(self): | ||
1065 | 265 | """Get the window name. | ||
1066 | 266 | |||
1067 | 267 | Note: This may change according to the current locale. If you want a unique | ||
1068 | 268 | string to match windows against, use the x_id instead. | ||
1069 | 269 | |||
1070 | 270 | """ | ||
1071 | 271 | return self._view_iface.Name() | ||
1072 | 272 | |||
1073 | 273 | @property | ||
1074 | 274 | def title(self): | ||
1075 | 275 | """Get the window title. | ||
1076 | 276 | |||
1077 | 277 | This may be different from the application name. | ||
1078 | 278 | |||
1079 | 279 | Note that this may change depending on the current locale. | ||
1080 | 280 | |||
1081 | 281 | """ | ||
1082 | 282 | return self._getProperty('_NET_WM_NAME') | ||
1083 | 283 | |||
1084 | 284 | @property | ||
1085 | 285 | def geometry(self): | ||
1086 | 286 | """Get the geometry for this window. | ||
1087 | 287 | |||
1088 | 288 | Returns a tuple containing (x, y, width, height). | ||
1089 | 289 | |||
1090 | 290 | """ | ||
1091 | 291 | # FIXME: We need to use the gdk window here to get the real coordinates | ||
1092 | 292 | geometry = self._x_win.get_geometry() | ||
1093 | 293 | origin = gdk.window_foreign_new(self._xid).get_origin() | ||
1094 | 294 | return (origin[0], origin[1], geometry.width, geometry.height) | ||
1095 | 295 | |||
1096 | 296 | @property | ||
1097 | 297 | def is_maximized(self): | ||
1098 | 298 | """Is the window maximized? | ||
1099 | 299 | |||
1100 | 300 | Maximized in this case means both maximized | ||
1101 | 301 | vertically and horizontally. If a window is only maximized in one | ||
1102 | 302 | direction it is not considered maximized. | ||
1103 | 303 | |||
1104 | 304 | """ | ||
1105 | 305 | win_state = self._get_window_states() | ||
1106 | 306 | return '_NET_WM_STATE_MAXIMIZED_VERT' in win_state and \ | ||
1107 | 307 | '_NET_WM_STATE_MAXIMIZED_HORZ' in win_state | ||
1108 | 308 | |||
1109 | 309 | @property | ||
1110 | 310 | def application(self): | ||
1111 | 311 | """Get the application that owns this window. | ||
1112 | 312 | |||
1113 | 313 | This method may return None if the window does not have an associated | ||
1114 | 314 | application. The 'desktop' window is one such example. | ||
1115 | 315 | |||
1116 | 316 | """ | ||
1117 | 317 | # BAMF returns a list of parents since some windows don't have an | ||
1118 | 318 | # associated application. For these windows we return none. | ||
1119 | 319 | parents = self._view_iface.Parents() | ||
1120 | 320 | if parents: | ||
1121 | 321 | return BamfApplication(parents[0]) | ||
1122 | 322 | else: | ||
1123 | 323 | return None | ||
1124 | 324 | |||
1125 | 325 | @property | ||
1126 | 326 | def user_visible(self): | ||
1127 | 327 | """Is this window visible to the user in the switcher?""" | ||
1128 | 328 | return self._view_iface.UserVisible() | ||
1129 | 329 | |||
1130 | 330 | @property | ||
1131 | 331 | def is_hidden(self): | ||
1132 | 332 | """Is this window hidden? | ||
1133 | 333 | |||
1134 | 334 | Windows are hidden when the 'Show Desktop' mode is activated. | ||
1135 | 335 | |||
1136 | 336 | """ | ||
1137 | 337 | win_state = self._get_window_states() | ||
1138 | 338 | return '_NET_WM_STATE_HIDDEN' in win_state | ||
1139 | 339 | |||
1140 | 340 | @property | ||
1141 | 341 | def is_focused(self): | ||
1142 | 342 | """Is this window focused?""" | ||
1143 | 343 | win_state = self._get_window_states() | ||
1144 | 344 | return '_NET_WM_STATE_FOCUSED' in win_state | ||
1145 | 345 | |||
1146 | 346 | @property | ||
1147 | 347 | def is_valid(self): | ||
1148 | 348 | """Is this window object valid? | ||
1149 | 349 | |||
1150 | 350 | Invalid windows are caused by windows closing during the construction of | ||
1151 | 351 | this object instance. | ||
1152 | 352 | |||
1153 | 353 | """ | ||
1154 | 354 | return not self._x_win is None | ||
1155 | 355 | |||
1156 | 356 | @property | ||
1157 | 357 | def monitor(self): | ||
1158 | 358 | """Returns the monitor to which the windows belongs to""" | ||
1159 | 359 | return self._window_iface.Monitor() | ||
1160 | 360 | |||
1161 | 361 | @property | ||
1162 | 362 | def closed(self): | ||
1163 | 363 | """Returns True if the window has been closed""" | ||
1164 | 364 | # This will return False when the window is closed and then removed from BUS | ||
1165 | 365 | try: | ||
1166 | 366 | return (self._window_iface.GetXid() != self.x_id) | ||
1167 | 367 | except: | ||
1168 | 368 | return True | ||
1169 | 369 | |||
1170 | 370 | def close(self): | ||
1171 | 371 | """Close the window.""" | ||
1172 | 372 | |||
1173 | 373 | self._setProperty('_NET_CLOSE_WINDOW', [0, 0]) | ||
1174 | 374 | |||
1175 | 375 | def set_focus(self): | ||
1176 | 376 | self._x_win.set_input_focus(X.RevertToParent, X.CurrentTime) | ||
1177 | 377 | self._x_win.configure(stack_mode=X.Above) | ||
1178 | 378 | |||
1179 | 379 | def __repr__(self): | ||
1180 | 380 | return "<BamfWindow '%s'>" % (self.title if self._x_win else str(self._xid)) | ||
1181 | 381 | |||
1182 | 382 | def _getProperty(self, _type): | ||
1183 | 383 | """Get an X11 property. | ||
1184 | 384 | |||
1185 | 385 | _type is a string naming the property type. win is the X11 window object. | ||
1186 | 386 | |||
1187 | 387 | """ | ||
1188 | 388 | atom = self._x_win.get_full_property(_X_DISPLAY.get_atom(_type), X.AnyPropertyType) | ||
1189 | 389 | if atom: | ||
1190 | 390 | return atom.value | ||
1191 | 391 | |||
1192 | 392 | def _setProperty(self, _type, data, mask=None): | ||
1193 | 393 | if type(data) is str: | ||
1194 | 394 | dataSize = 8 | ||
1195 | 395 | else: | ||
1196 | 396 | # data length must be 5 - pad with 0's if it's short, truncate otherwise. | ||
1197 | 397 | data = (data + [0] * (5 - len(data)))[:5] | ||
1198 | 398 | dataSize = 32 | ||
1199 | 399 | |||
1200 | 400 | ev = protocol.event.ClientMessage(window=self._x_win, client_type=_X_DISPLAY.get_atom(_type), data=(dataSize, data)) | ||
1201 | 401 | |||
1202 | 402 | if not mask: | ||
1203 | 403 | mask = (X.SubstructureRedirectMask | X.SubstructureNotifyMask) | ||
1204 | 404 | self._x_root_win.send_event(ev, event_mask=mask) | ||
1205 | 405 | _X_DISPLAY.sync() | ||
1206 | 406 | |||
1207 | 407 | def _get_window_states(self): | ||
1208 | 408 | """Return a list of strings representing the current window state.""" | ||
1209 | 409 | |||
1210 | 410 | _X_DISPLAY.sync() | ||
1211 | 411 | return map(_X_DISPLAY.get_atom_name, self._getProperty('_NET_WM_STATE')) | ||
1212 | 0 | 412 | ||
1213 | === added file 'tests/autopilot/autopilot/keybindings.py.OTHER' | |||
1214 | --- tests/autopilot/autopilot/keybindings.py.OTHER 1970-01-01 00:00:00 +0000 | |||
1215 | +++ tests/autopilot/autopilot/keybindings.py.OTHER 2012-05-24 17:16:22 +0000 | |||
1216 | @@ -0,0 +1,259 @@ | |||
1217 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
1218 | 2 | # Copyright 2012 Canonical | ||
1219 | 3 | # Author: Thomi Richards | ||
1220 | 4 | # | ||
1221 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
1222 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
1223 | 7 | # by the Free Software Foundation. | ||
1224 | 8 | |||
1225 | 9 | """Utility functions to get shortcut keybindings for various parts of Unity. | ||
1226 | 10 | |||
1227 | 11 | Inside autopilot we deal with keybindings by naming them with unique names. For | ||
1228 | 12 | example, instead of hard-coding the fact that 'Alt+F2' opens the command lens, we | ||
1229 | 13 | might call: | ||
1230 | 14 | |||
1231 | 15 | >>> keybindings.get('lens_reveal/command') | ||
1232 | 16 | 'Alt+F2' | ||
1233 | 17 | |||
1234 | 18 | Keybindings come from two different places: | ||
1235 | 19 | 1) Keybindings from compiz. We can get these if we have the plugin name and | ||
1236 | 20 | setting name. | ||
1237 | 21 | 2) Elsewhere. Right now we're hard-coding these in a separate dictionary. | ||
1238 | 22 | """ | ||
1239 | 23 | |||
1240 | 24 | from compizconfig import Plugin, Setting | ||
1241 | 25 | import logging | ||
1242 | 26 | from types import NoneType | ||
1243 | 27 | import re | ||
1244 | 28 | |||
1245 | 29 | from autopilot.emulators.X11 import Keyboard | ||
1246 | 30 | from autopilot.globals import global_context | ||
1247 | 31 | |||
1248 | 32 | |||
1249 | 33 | logger = logging.getLogger(__name__) | ||
1250 | 34 | |||
1251 | 35 | |||
1252 | 36 | # | ||
1253 | 37 | # Fill this dictionary with keybindings we want to store. | ||
1254 | 38 | # | ||
1255 | 39 | # If keybindings are from compizconfig, the value should be a 2-value tuple | ||
1256 | 40 | # containging (plugin_name, setting_name). | ||
1257 | 41 | # | ||
1258 | 42 | # If keybindings are elsewhere, just store the keybinding string. | ||
1259 | 43 | _keys = { | ||
1260 | 44 | # Launcher: | ||
1261 | 45 | "launcher/reveal": ('unityshell', 'show_launcher'), | ||
1262 | 46 | "launcher/keynav": ('unityshell', 'keyboard_focus'), | ||
1263 | 47 | "launcher/keynav/next": "Down", | ||
1264 | 48 | "launcher/keynav/prev": "Up", | ||
1265 | 49 | "launcher/keynav/activate": "Enter", | ||
1266 | 50 | "launcher/keynav/exit": "Escape", | ||
1267 | 51 | "launcher/keynav/open-quicklist": "Right", | ||
1268 | 52 | "launcher/keynav/close-quicklist": "Left", | ||
1269 | 53 | "launcher/switcher": ('unityshell', 'launcher_switcher_forward'), | ||
1270 | 54 | "launcher/switcher/exit": "Escape", | ||
1271 | 55 | "launcher/switcher/next": "Tab", | ||
1272 | 56 | "launcher/switcher/prev": "Shift+Tab", | ||
1273 | 57 | "launcher/switcher/down": "Down", | ||
1274 | 58 | "launcher/switcher/up": "Up", | ||
1275 | 59 | # Quicklist: | ||
1276 | 60 | "quicklist/keynav/first": "Home", | ||
1277 | 61 | "quicklist/keynav/last": "End", | ||
1278 | 62 | "quicklist/keynav/next": "Down", | ||
1279 | 63 | "quicklist/keynav/prev": "Up", | ||
1280 | 64 | "quicklist/keynav/activate": "Enter", | ||
1281 | 65 | "quicklist/keynav/exit": "Escape", | ||
1282 | 66 | # Panel: | ||
1283 | 67 | "panel/show_menus": "Alt", | ||
1284 | 68 | "panel/open_first_menu": ('unityshell', 'panel_first_menu'), | ||
1285 | 69 | "panel/next_indicator": "Right", | ||
1286 | 70 | "panel/prev_indicator": "Left", | ||
1287 | 71 | # Dash: | ||
1288 | 72 | "dash/reveal": "Super", | ||
1289 | 73 | "dash/lens/next": "Ctrl+Tab", | ||
1290 | 74 | "dash/lens/prev": "Ctrl+Shift+Tab", | ||
1291 | 75 | # Lenses: | ||
1292 | 76 | "lens_reveal/command": ("unityshell", "execute_command"), | ||
1293 | 77 | "lens_reveal/apps": "Super+a", | ||
1294 | 78 | "lens_reveal/files": "Super+f", | ||
1295 | 79 | "lens_reveal/music": "Super+m", | ||
1296 | 80 | # Hud: | ||
1297 | 81 | "hud/reveal": ("unityshell", "show_hud"), | ||
1298 | 82 | # Switcher: | ||
1299 | 83 | "switcher/reveal_normal": ("unityshell", "alt_tab_forward"), | ||
1300 | 84 | "switcher/reveal_impropper": "Alt+Right", | ||
1301 | 85 | "switcher/reveal_details": "Alt+`", | ||
1302 | 86 | "switcher/reveal_all": ("unityshell", "alt_tab_forward_all"), | ||
1303 | 87 | "switcher/cancel": "Escape", | ||
1304 | 88 | # Shortcut Hint: | ||
1305 | 89 | "shortcuthint/reveal": ('unityshell', 'show_launcher'), | ||
1306 | 90 | "shortcuthint/cancel": "Escape", | ||
1307 | 91 | # These are in compiz as 'Alt+Right' and 'Alt+Left', but the fact that it | ||
1308 | 92 | # lists the Alt key won't work for us, so I'm defining them manually. | ||
1309 | 93 | "switcher/next": "Tab", | ||
1310 | 94 | "switcher/prev": "Shift+Tab", | ||
1311 | 95 | "switcher/right": "Right", | ||
1312 | 96 | "switcher/left": "Left", | ||
1313 | 97 | "switcher/detail_start": "Down", | ||
1314 | 98 | "switcher/detail_stop": "Up", | ||
1315 | 99 | "switcher/detail_next": "`", | ||
1316 | 100 | "switcher/detail_prev": "`", | ||
1317 | 101 | # Workspace switcher (wall): | ||
1318 | 102 | "workspace/move_left": ("wall", "left_key"), | ||
1319 | 103 | "workspace/move_right": ("wall", "right_key"), | ||
1320 | 104 | "workspace/move_up": ("wall", "up_key"), | ||
1321 | 105 | "workspace/move_down": ("wall", "down_key"), | ||
1322 | 106 | # Window management: | ||
1323 | 107 | "window/show_desktop" : ("core", "show_desktop_key"), | ||
1324 | 108 | "window/minimize": ("core", "minimize_window_key"), | ||
1325 | 109 | "window/maximize": ("core", "maximize_window_key"), | ||
1326 | 110 | "window/restore": ("core", "unmaximize_window_key"), | ||
1327 | 111 | "window/close": ("core", "close_window_key"), | ||
1328 | 112 | # expo plugin: | ||
1329 | 113 | "expo/start": ("expo", "expo_key"), | ||
1330 | 114 | "expo/cancel": "Escape", | ||
1331 | 115 | # spread (scale) plugin: | ||
1332 | 116 | "spread/start": ("scale", "initiate_all_key"), | ||
1333 | 117 | "spread/cancel": "Escape", | ||
1334 | 118 | } | ||
1335 | 119 | |||
1336 | 120 | |||
1337 | 121 | |||
1338 | 122 | def get(binding_name): | ||
1339 | 123 | """Get a keybinding, given its well-known name. | ||
1340 | 124 | |||
1341 | 125 | binding_name must be a string, or a TypeError will be raised. | ||
1342 | 126 | |||
1343 | 127 | If binding_name cannot be found in the bindings dictionaries, a ValueError | ||
1344 | 128 | will be raised. | ||
1345 | 129 | |||
1346 | 130 | """ | ||
1347 | 131 | if not isinstance(binding_name, basestring): | ||
1348 | 132 | raise TypeError("binding_name must be a string.") | ||
1349 | 133 | if binding_name not in _keys: | ||
1350 | 134 | raise ValueError("Unknown binding name '%s'." % (binding_name)) | ||
1351 | 135 | v = _keys[binding_name] | ||
1352 | 136 | if isinstance(v, basestring): | ||
1353 | 137 | return v | ||
1354 | 138 | else: | ||
1355 | 139 | return _get_compiz_keybinding(v) | ||
1356 | 140 | |||
1357 | 141 | |||
1358 | 142 | def get_hold_part(binding_name): | ||
1359 | 143 | """Returns the part of a keybinding that must be held permenantly. | ||
1360 | 144 | |||
1361 | 145 | Use this function to split bindings like "Alt+Tab" into the part that must be | ||
1362 | 146 | held down. See get_tap_part for the part that must be tapped. | ||
1363 | 147 | |||
1364 | 148 | Raises a ValueError if the binding specified does not have multiple parts. | ||
1365 | 149 | |||
1366 | 150 | """ | ||
1367 | 151 | binding = get(binding_name) | ||
1368 | 152 | parts = binding.split('+') | ||
1369 | 153 | if len(parts) == 1: | ||
1370 | 154 | logger.warning("Key binding '%s' does not have a hold part.", binding_name) | ||
1371 | 155 | return parts[0] | ||
1372 | 156 | return '+'.join(parts[:-1]) | ||
1373 | 157 | |||
1374 | 158 | |||
1375 | 159 | def get_tap_part(binding_name): | ||
1376 | 160 | """Returns the part of a keybinding that must be tapped. | ||
1377 | 161 | |||
1378 | 162 | Use this function to split bindings like "Alt+Tab" into the part that must be | ||
1379 | 163 | held tapped. See get_hold_part for the part that must be held down. | ||
1380 | 164 | |||
1381 | 165 | Raises a ValueError if the binding specified does not have multiple parts. | ||
1382 | 166 | |||
1383 | 167 | """ | ||
1384 | 168 | binding = get(binding_name) | ||
1385 | 169 | parts = binding.split('+') | ||
1386 | 170 | if len(parts) == 1: | ||
1387 | 171 | logger.warning("Key binding '%s' does not have a tap part.", binding_name) | ||
1388 | 172 | return parts[0] | ||
1389 | 173 | return parts[-1] | ||
1390 | 174 | |||
1391 | 175 | |||
1392 | 176 | def _get_compiz_keybinding(compiz_tuple): | ||
1393 | 177 | """Given a keybinding name, get the keybinding string from the compiz option. | ||
1394 | 178 | |||
1395 | 179 | Raises ValueError if the compiz setting described does not hold a keybinding. | ||
1396 | 180 | Raises RuntimeError if the compiz keybinding has been disabled. | ||
1397 | 181 | |||
1398 | 182 | """ | ||
1399 | 183 | plugin_name, setting_name = compiz_tuple | ||
1400 | 184 | plugin = Plugin(global_context, plugin_name) | ||
1401 | 185 | setting = Setting(plugin, setting_name) | ||
1402 | 186 | if setting.Type != 'Key': | ||
1403 | 187 | raise ValueError("Key binding maps to a compiz option that does not hold a keybinding.") | ||
1404 | 188 | if not plugin.Enabled: | ||
1405 | 189 | logger.warning("Returning keybinding for '%s' which is in un-enabled plugin '%s'", | ||
1406 | 190 | setting.ShortDesc, | ||
1407 | 191 | plugin.ShortDesc) | ||
1408 | 192 | if setting.Value == "Disabled": | ||
1409 | 193 | raise RuntimeError("Keybinding '%s' in compiz plugin '%s' has been disabled." % | ||
1410 | 194 | (setting.ShortDesc, plugin.ShortDesc)) | ||
1411 | 195 | |||
1412 | 196 | return _translate_compiz_keystroke_string(setting.Value) | ||
1413 | 197 | |||
1414 | 198 | |||
1415 | 199 | def _translate_compiz_keystroke_string(keystroke_string): | ||
1416 | 200 | """Get a string representing the keystroke stored in `keystroke_string`. | ||
1417 | 201 | |||
1418 | 202 | `keystroke_string` is a compizconfig-style keystroke string. | ||
1419 | 203 | |||
1420 | 204 | The returned value is suitable for passing into the Keyboard emulator. | ||
1421 | 205 | |||
1422 | 206 | """ | ||
1423 | 207 | if not isinstance(keystroke_string, basestring): | ||
1424 | 208 | raise TypeError("keystroke string must be a string.") | ||
1425 | 209 | |||
1426 | 210 | translations = { | ||
1427 | 211 | 'Control': 'Ctrl', | ||
1428 | 212 | 'Primary': 'Ctrl', | ||
1429 | 213 | } | ||
1430 | 214 | regex = re.compile('[<>]') | ||
1431 | 215 | parts = regex.split(keystroke_string) | ||
1432 | 216 | result = [] | ||
1433 | 217 | for part in parts: | ||
1434 | 218 | part = part.strip() | ||
1435 | 219 | if part != "" and not part.isspace(): | ||
1436 | 220 | translated = translations.get(part, part) | ||
1437 | 221 | if translated not in result: | ||
1438 | 222 | result.append(translated) | ||
1439 | 223 | |||
1440 | 224 | return '+'.join(result) | ||
1441 | 225 | |||
1442 | 226 | |||
1443 | 227 | class KeybindingsHelper(object): | ||
1444 | 228 | """A helper class that makes it easier to use unity keybindings.""" | ||
1445 | 229 | _keyboard = Keyboard() | ||
1446 | 230 | |||
1447 | 231 | def keybinding(self, binding_name, delay=None): | ||
1448 | 232 | """Press and release the keybinding with the given name. | ||
1449 | 233 | |||
1450 | 234 | If set, the delay parameter will override the default delay set by the | ||
1451 | 235 | keyboard emulator. | ||
1452 | 236 | |||
1453 | 237 | """ | ||
1454 | 238 | if type(delay) not in (float, NoneType): | ||
1455 | 239 | raise TypeError("delay parameter must be a float if it is defined.") | ||
1456 | 240 | if delay: | ||
1457 | 241 | self._keyboard.press_and_release(get(binding_name), delay) | ||
1458 | 242 | else: | ||
1459 | 243 | self._keyboard.press_and_release(get(binding_name)) | ||
1460 | 244 | |||
1461 | 245 | def keybinding_hold(self, binding_name): | ||
1462 | 246 | """Hold down the hold-part of a keybinding.""" | ||
1463 | 247 | self._keyboard.press(get_hold_part(binding_name)) | ||
1464 | 248 | |||
1465 | 249 | def keybinding_release(self, binding_name): | ||
1466 | 250 | """Release the hold-part of a keybinding.""" | ||
1467 | 251 | self._keyboard.release(get_hold_part(binding_name)) | ||
1468 | 252 | |||
1469 | 253 | def keybinding_tap(self, binding_name): | ||
1470 | 254 | """Tap the tap-part of a keybinding.""" | ||
1471 | 255 | self._keyboard.press_and_release(get_tap_part(binding_name)) | ||
1472 | 256 | |||
1473 | 257 | def keybinding_hold_part_then_tap(self, binding_name): | ||
1474 | 258 | self.keybinding_hold(binding_name) | ||
1475 | 259 | self.keybinding_tap(binding_name) | ||
1476 | 0 | 260 | ||
1477 | === added directory 'tests/autopilot/autopilot/matchers' | |||
1478 | === added file 'tests/autopilot/autopilot/matchers/__init__.py' | |||
1479 | --- tests/autopilot/autopilot/matchers/__init__.py 1970-01-01 00:00:00 +0000 | |||
1480 | +++ tests/autopilot/autopilot/matchers/__init__.py 2012-05-24 17:16:22 +0000 | |||
1481 | @@ -0,0 +1,31 @@ | |||
1482 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
1483 | 2 | # Copyright 2012 Canonical | ||
1484 | 3 | # Author: Thomi Richards | ||
1485 | 4 | # | ||
1486 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
1487 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
1488 | 7 | # by the Free Software Foundation. | ||
1489 | 8 | |||
1490 | 9 | "Autopilot-specific matchers." | ||
1491 | 10 | |||
1492 | 11 | from testtools.matchers import Matcher | ||
1493 | 12 | |||
1494 | 13 | |||
1495 | 14 | class Eventually(Matcher): | ||
1496 | 15 | """Asserts that a value will eventually equal a given Matcher object.""" | ||
1497 | 16 | |||
1498 | 17 | def __init__(self, matcher): | ||
1499 | 18 | super(Eventually, self).__init__() | ||
1500 | 19 | match_fun = getattr(matcher, 'match', None) | ||
1501 | 20 | if match_fun is None or not callable(match_fun): | ||
1502 | 21 | raise TypeError("Eventually must be called with a testtools matcher argument.") | ||
1503 | 22 | self.matcher = matcher | ||
1504 | 23 | |||
1505 | 24 | def match(self, value): | ||
1506 | 25 | wait_fun = getattr(value, 'wait_for', None) | ||
1507 | 26 | if wait_fun is None or not callable(wait_fun): | ||
1508 | 27 | raise TypeError("Eventually can only be used against autopilot attributes that have a wait_for funtion.") | ||
1509 | 28 | wait_fun(self.matcher) | ||
1510 | 29 | |||
1511 | 30 | def __str__(self): | ||
1512 | 31 | return "Eventually " + str(self.matcher) | ||
1513 | 0 | 32 | ||
1514 | === modified file 'tests/autopilot/unity/emulators/__init__.py' | |||
1515 | --- tests/autopilot/unity/emulators/__init__.py 2012-05-08 16:13:17 +0000 | |||
1516 | +++ tests/autopilot/unity/emulators/__init__.py 2012-05-24 17:16:22 +0000 | |||
1517 | @@ -7,4 +7,293 @@ | |||
1518 | 7 | # by the Free Software Foundation. | 7 | # by the Free Software Foundation. |
1519 | 8 | # | 8 | # |
1520 | 9 | 9 | ||
1521 | 10 | <<<<<<< TREE | ||
1522 | 10 | """A collection of Unity-specific emulators.""" | 11 | """A collection of Unity-specific emulators.""" |
1523 | 12 | ======= | ||
1524 | 13 | from dbus import Interface | ||
1525 | 14 | import logging | ||
1526 | 15 | from testtools.matchers import Equals | ||
1527 | 16 | from time import sleep | ||
1528 | 17 | |||
1529 | 18 | from autopilot.emulators.dbus_handler import session_bus | ||
1530 | 19 | |||
1531 | 20 | _object_registry = {} | ||
1532 | 21 | logger = logging.getLogger(__name__) | ||
1533 | 22 | |||
1534 | 23 | |||
1535 | 24 | class StateNotFoundError(RuntimeError): | ||
1536 | 25 | """Raised when a piece of state information from unity is not found.""" | ||
1537 | 26 | |||
1538 | 27 | message = "State not found for class with name '{}' and id '{}'." | ||
1539 | 28 | |||
1540 | 29 | def __init__(self, class_name, class_id): | ||
1541 | 30 | super(StateNotFoundError, self).__init__(self.message.format(class_name, class_id)) | ||
1542 | 31 | |||
1543 | 32 | |||
1544 | 33 | class IntrospectableObjectMetaclass(type): | ||
1545 | 34 | """Metaclass to insert appropriate classes into the object registry.""" | ||
1546 | 35 | |||
1547 | 36 | def __new__(cls, classname, bases, classdict): | ||
1548 | 37 | """Add class name to type registry.""" | ||
1549 | 38 | class_object = type.__new__(cls, classname, bases, classdict) | ||
1550 | 39 | _object_registry[classname] = class_object | ||
1551 | 40 | return class_object | ||
1552 | 41 | |||
1553 | 42 | |||
1554 | 43 | # acquire the debugging dbus object | ||
1555 | 44 | UNITY_BUS_NAME = 'com.canonical.Unity' | ||
1556 | 45 | DEBUG_PATH = '/com/canonical/Unity/Debug' | ||
1557 | 46 | INTROSPECTION_IFACE = 'com.canonical.Unity.Debug.Introspection' | ||
1558 | 47 | |||
1559 | 48 | |||
1560 | 49 | _debug_proxy_obj = session_bus.get_object(UNITY_BUS_NAME, DEBUG_PATH) | ||
1561 | 50 | _introspection_iface = Interface(_debug_proxy_obj, INTROSPECTION_IFACE) | ||
1562 | 51 | |||
1563 | 52 | |||
1564 | 53 | def get_state_by_path(piece='/Unity'): | ||
1565 | 54 | """Returns a full dump of unity's state.""" | ||
1566 | 55 | return _introspection_iface.GetState(piece) | ||
1567 | 56 | |||
1568 | 57 | |||
1569 | 58 | def get_state_by_name_and_id(class_name, unique_id): | ||
1570 | 59 | """Get a state dictionary from unity given a class name and id. | ||
1571 | 60 | |||
1572 | 61 | raises StateNotFoundError if the state is not found. | ||
1573 | 62 | |||
1574 | 63 | Returns a dictionary of information. Unlike get_state_by_path, this | ||
1575 | 64 | method can never return state for more than one object. | ||
1576 | 65 | """ | ||
1577 | 66 | try: | ||
1578 | 67 | query = "//%(class_name)s[id=%(unique_id)d]" % (dict( | ||
1579 | 68 | class_name=class_name, | ||
1580 | 69 | unique_id=unique_id)) | ||
1581 | 70 | return get_state_by_path(query)[0] | ||
1582 | 71 | except IndexError: | ||
1583 | 72 | raise StateNotFoundError(class_name, unique_id) | ||
1584 | 73 | |||
1585 | 74 | |||
1586 | 75 | def make_introspection_object(dbus_tuple): | ||
1587 | 76 | """Make an introspection object given a DBus tuple of (name, state_dict). | ||
1588 | 77 | |||
1589 | 78 | This only works for classes that derive from UnityIntrospectionObject. | ||
1590 | 79 | """ | ||
1591 | 80 | name, state = dbus_tuple | ||
1592 | 81 | try: | ||
1593 | 82 | class_type = _object_registry[name] | ||
1594 | 83 | except KeyError: | ||
1595 | 84 | print name, "is not a valid introspection type!" | ||
1596 | 85 | return None | ||
1597 | 86 | return class_type(state) | ||
1598 | 87 | |||
1599 | 88 | |||
1600 | 89 | def start_log_to_file(file_path): | ||
1601 | 90 | """Instruct Unity to start logging to the given file.""" | ||
1602 | 91 | _introspection_iface.StartLogToFile(file_path) | ||
1603 | 92 | |||
1604 | 93 | |||
1605 | 94 | def reset_logging(): | ||
1606 | 95 | """Instruct Unity to stop logging to a file.""" | ||
1607 | 96 | _introspection_iface.ResetLogging() | ||
1608 | 97 | |||
1609 | 98 | |||
1610 | 99 | def set_log_severity(component, severity): | ||
1611 | 100 | """Instruct Unity to set a log component's severity. | ||
1612 | 101 | |||
1613 | 102 | 'component' is the unity logging component name. | ||
1614 | 103 | |||
1615 | 104 | 'severity' is the severity name (like 'DEBUG', 'INFO' etc.) | ||
1616 | 105 | |||
1617 | 106 | """ | ||
1618 | 107 | _introspection_iface.SetLogSeverity(component, severity) | ||
1619 | 108 | |||
1620 | 109 | |||
1621 | 110 | def log_unity_message(severity, message): | ||
1622 | 111 | """Instruct unity to log a message for us. | ||
1623 | 112 | |||
1624 | 113 | severity: one of ('TRACE', 'DEBUG', 'INFO', 'WARNING', 'ERROR'). | ||
1625 | 114 | |||
1626 | 115 | message: The message to log. | ||
1627 | 116 | |||
1628 | 117 | For debugging purposes only! If you want to log a message during an autopilot | ||
1629 | 118 | test, use the python logging framework instead. | ||
1630 | 119 | |||
1631 | 120 | """ | ||
1632 | 121 | _introspection_iface.LogMessage(severity, message) | ||
1633 | 122 | |||
1634 | 123 | |||
1635 | 124 | def translate_state_keys(state_dict): | ||
1636 | 125 | """Translates the state_dict passed in so the keys are usable as python attributes.""" | ||
1637 | 126 | return {k.replace('-','_'):v for k,v in state_dict.iteritems() } | ||
1638 | 127 | |||
1639 | 128 | |||
1640 | 129 | class UnityIntrospectionObject(object): | ||
1641 | 130 | """A class that can be created using a dictionary of state from Unity.""" | ||
1642 | 131 | __metaclass__ = IntrospectableObjectMetaclass | ||
1643 | 132 | |||
1644 | 133 | def __init__(self, state_dict): | ||
1645 | 134 | self.__state = {} | ||
1646 | 135 | self.set_properties(state_dict) | ||
1647 | 136 | |||
1648 | 137 | def set_properties(self, state_dict): | ||
1649 | 138 | """Creates and set attributes of `self` based on contents of `state_dict`. | ||
1650 | 139 | |||
1651 | 140 | Translates '-' to '_', so a key of 'icon-type' for example becomes 'icon_type'. | ||
1652 | 141 | |||
1653 | 142 | """ | ||
1654 | 143 | self.__state = {} | ||
1655 | 144 | for key, value in translate_state_keys(state_dict).iteritems(): | ||
1656 | 145 | # don't store id in state dictionary -make it a proper instance attribute | ||
1657 | 146 | if key == 'id': | ||
1658 | 147 | self.id = value | ||
1659 | 148 | self.__state[key] = self._make_attribute(key, value) | ||
1660 | 149 | |||
1661 | 150 | def _make_attribute(self, name, value): | ||
1662 | 151 | """Make an attribute for 'value', patched with the wait_for function.""" | ||
1663 | 152 | |||
1664 | 153 | def wait_for(self, expected_value): | ||
1665 | 154 | """Wait up to 10 seconds for our value to change to 'expected_value'. | ||
1666 | 155 | |||
1667 | 156 | expected_value can be a testtools.matcher.Matcher subclass (like | ||
1668 | 157 | LessThan, for example), or an ordinary value. | ||
1669 | 158 | |||
1670 | 159 | This works by refreshing the value using repeated dbus calls. | ||
1671 | 160 | |||
1672 | 161 | Raises RuntimeError if the attribute was not equal to the expected value | ||
1673 | 162 | after 10 seconds. | ||
1674 | 163 | |||
1675 | 164 | """ | ||
1676 | 165 | # It's guaranteed that our value is up to date, since __getattr__ calls | ||
1677 | 166 | # refresh_state. This if statement stops us waiting if the value is | ||
1678 | 167 | # already what we expect: | ||
1679 | 168 | if self == expected_value: | ||
1680 | 169 | return | ||
1681 | 170 | |||
1682 | 171 | # unfortunately not all testtools matchers derive from the Matcher | ||
1683 | 172 | # class, so we can't use issubclass, isinstance for this: | ||
1684 | 173 | match_fun = getattr(expected_value, 'match', None) | ||
1685 | 174 | is_matcher = match_fun and callable(match_fun) | ||
1686 | 175 | if not is_matcher: | ||
1687 | 176 | expected_value = Equals(expected_value) | ||
1688 | 177 | |||
1689 | 178 | for i in range(11): | ||
1690 | 179 | new_state = translate_state_keys(get_state_by_name_and_id( | ||
1691 | 180 | self.parent.__class__.__name__, | ||
1692 | 181 | self.parent.id) | ||
1693 | 182 | ) | ||
1694 | 183 | new_value = new_state[self.name] | ||
1695 | 184 | # Support for testtools.matcher classes: | ||
1696 | 185 | mismatch = expected_value.match(new_value) | ||
1697 | 186 | if mismatch: | ||
1698 | 187 | failure_msg = mismatch.describe() | ||
1699 | 188 | else: | ||
1700 | 189 | self.parent.set_properties(new_state) | ||
1701 | 190 | return | ||
1702 | 191 | |||
1703 | 192 | sleep(1) | ||
1704 | 193 | |||
1705 | 194 | raise AssertionError("After 10 seconds test on %s.%s failed: %s" | ||
1706 | 195 | % (self.parent.__class__.__name__, self.name, failure_msg)) | ||
1707 | 196 | |||
1708 | 197 | # This looks like magic, but it's really not. We're creating a new type | ||
1709 | 198 | # on the fly that derives from the type of 'value' with a couple of | ||
1710 | 199 | # extra attributes: wait_for is the wait_for method above. 'parent' and | ||
1711 | 200 | # 'name' are needed by the wait_for method. | ||
1712 | 201 | # | ||
1713 | 202 | # We can't use traditional meta-classes here, since the type we're | ||
1714 | 203 | # deriving from is only known at call time, not at parse time (we could | ||
1715 | 204 | # override __call__ in the meta class, but that doesn't buy us anything | ||
1716 | 205 | # extra). | ||
1717 | 206 | # | ||
1718 | 207 | # A better way to do this would be with functools.partial, which I tried | ||
1719 | 208 | # initially, but doesn't work well with bound methods. | ||
1720 | 209 | t = type(value) | ||
1721 | 210 | attrs = {'wait_for': wait_for, 'parent':self, 'name':name} | ||
1722 | 211 | return type(t.__name__, (t,), attrs)(value) | ||
1723 | 212 | |||
1724 | 213 | def _get_child_tuples_by_type(self, desired_type): | ||
1725 | 214 | """Get a list of (name,dict) pairs from children of the specified type. | ||
1726 | 215 | |||
1727 | 216 | desired_type must be a subclass of UnityIntrospectionObject. | ||
1728 | 217 | |||
1729 | 218 | """ | ||
1730 | 219 | if not issubclass(desired_type, UnityIntrospectionObject): | ||
1731 | 220 | raise TypeError("%r must be a subclass of %r" % (desired_type, | ||
1732 | 221 | UnityIntrospectionObject)) | ||
1733 | 222 | |||
1734 | 223 | children = getattr(self, 'Children', []) | ||
1735 | 224 | results = [] | ||
1736 | 225 | # loop through all children, and try find one that matches the type the | ||
1737 | 226 | # user wants. | ||
1738 | 227 | for child_type, child_state in children: | ||
1739 | 228 | try: | ||
1740 | 229 | if issubclass(_object_registry[child_type], desired_type): | ||
1741 | 230 | results.append((child_type, child_state)) | ||
1742 | 231 | except KeyError: | ||
1743 | 232 | pass | ||
1744 | 233 | return results | ||
1745 | 234 | |||
1746 | 235 | def get_children_by_type(self, desired_type, **kwargs): | ||
1747 | 236 | """Get a list of children of the specified type. | ||
1748 | 237 | |||
1749 | 238 | desired_type must be a subclass of UnityIntrospectionObject. | ||
1750 | 239 | |||
1751 | 240 | Keyword arguments can be used to restrict returned instances. For example: | ||
1752 | 241 | |||
1753 | 242 | >>> get_children_by_type(Launcher, monitor=1) | ||
1754 | 243 | |||
1755 | 244 | ... will return only LauncherInstances that have an attribute 'monitor' | ||
1756 | 245 | that is equal to 1. | ||
1757 | 246 | |||
1758 | 247 | """ | ||
1759 | 248 | self.refresh_state() | ||
1760 | 249 | result = [] | ||
1761 | 250 | for child in self._get_child_tuples_by_type(desired_type): | ||
1762 | 251 | instance = make_introspection_object(child) | ||
1763 | 252 | filters_passed = True | ||
1764 | 253 | for attr, val in kwargs.iteritems(): | ||
1765 | 254 | if not hasattr(instance, attr) or getattr(instance, attr) != val: | ||
1766 | 255 | # Either attribute is not present, or is present but with | ||
1767 | 256 | # the wrong value - don't add this instance to the results list. | ||
1768 | 257 | filters_passed = False | ||
1769 | 258 | break | ||
1770 | 259 | if filters_passed: | ||
1771 | 260 | result.append(instance) | ||
1772 | 261 | return result | ||
1773 | 262 | |||
1774 | 263 | def refresh_state(self): | ||
1775 | 264 | """Refreshes the object's state from unity. | ||
1776 | 265 | |||
1777 | 266 | raises StateNotFound if the object in unity has been destroyed. | ||
1778 | 267 | |||
1779 | 268 | """ | ||
1780 | 269 | # need to get name from class object. | ||
1781 | 270 | new_state = get_state_by_name_and_id(self.__class__.__name__, self.id) | ||
1782 | 271 | self.set_properties(new_state) | ||
1783 | 272 | |||
1784 | 273 | @classmethod | ||
1785 | 274 | def get_all_instances(cls): | ||
1786 | 275 | """Get all instances of this class that exist within the Unity state tree. | ||
1787 | 276 | |||
1788 | 277 | For example, to get all the BamfLauncherIcons: | ||
1789 | 278 | |||
1790 | 279 | icons = BamfLauncherIcons.get_all_instances() | ||
1791 | 280 | |||
1792 | 281 | The return value is a list (possibly empty) of class instances. | ||
1793 | 282 | |||
1794 | 283 | """ | ||
1795 | 284 | cls_name = cls.__name__ | ||
1796 | 285 | instances = get_state_by_path("//%s" % (cls_name)) | ||
1797 | 286 | return [make_introspection_object((cls_name,i)) for i in instances] | ||
1798 | 287 | |||
1799 | 288 | def __getattr__(self, name): | ||
1800 | 289 | # avoid recursion if for some reason we have no state set (should never) | ||
1801 | 290 | # happen. | ||
1802 | 291 | if name == '__state': | ||
1803 | 292 | raise AttributeError() | ||
1804 | 293 | |||
1805 | 294 | if name in self.__state: | ||
1806 | 295 | self.refresh_state() | ||
1807 | 296 | return self.__state[name] | ||
1808 | 297 | # attribute not found. | ||
1809 | 298 | raise AttributeError("Attribute '%s' not found." % (name)) | ||
1810 | 299 | >>>>>>> MERGE-SOURCE | ||
1811 | 11 | 300 | ||
1812 | === modified file 'tests/autopilot/unity/emulators/dash.py' | |||
1813 | --- tests/autopilot/unity/emulators/dash.py 2012-05-08 16:13:17 +0000 | |||
1814 | +++ tests/autopilot/unity/emulators/dash.py 2012-05-24 17:16:22 +0000 | |||
1815 | @@ -7,9 +7,13 @@ | |||
1816 | 7 | # by the Free Software Foundation. | 7 | # by the Free Software Foundation. |
1817 | 8 | # | 8 | # |
1818 | 9 | 9 | ||
1819 | 10 | <<<<<<< TREE | ||
1820 | 10 | from __future__ import absolute_import | 11 | from __future__ import absolute_import |
1821 | 11 | 12 | ||
1822 | 12 | from autopilot.introspection.unity import ( | 13 | from autopilot.introspection.unity import ( |
1823 | 14 | ======= | ||
1824 | 15 | from autopilot.emulators.unity import ( | ||
1825 | 16 | >>>>>>> MERGE-SOURCE | ||
1826 | 13 | get_state_by_path, | 17 | get_state_by_path, |
1827 | 14 | make_introspection_object, | 18 | make_introspection_object, |
1828 | 15 | UnityIntrospectionObject, | 19 | UnityIntrospectionObject, |
1829 | 16 | 20 | ||
1830 | === modified file 'tests/autopilot/unity/emulators/hud.py' | |||
1831 | === modified file 'tests/autopilot/unity/emulators/icons.py' | |||
1832 | --- tests/autopilot/unity/emulators/icons.py 2012-05-16 02:57:25 +0000 | |||
1833 | +++ tests/autopilot/unity/emulators/icons.py 2012-05-24 17:16:22 +0000 | |||
1834 | @@ -7,11 +7,17 @@ | |||
1835 | 7 | # by the Free Software Foundation. | 7 | # by the Free Software Foundation. |
1836 | 8 | # | 8 | # |
1837 | 9 | 9 | ||
1838 | 10 | <<<<<<< TREE | ||
1839 | 10 | from __future__ import absolute_import | 11 | from __future__ import absolute_import |
1840 | 11 | 12 | ||
1841 | 12 | from autopilot.introspection.unity import UnityIntrospectionObject | 13 | from autopilot.introspection.unity import UnityIntrospectionObject |
1842 | 13 | from unity.emulators.quicklist import Quicklist | 14 | from unity.emulators.quicklist import Quicklist |
1843 | 14 | from unity.emulators.tooltip import ToolTip | 15 | from unity.emulators.tooltip import ToolTip |
1844 | 16 | ======= | ||
1845 | 17 | from autopilot.emulators.unity import UnityIntrospectionObject | ||
1846 | 18 | from autopilot.emulators.unity.quicklist import Quicklist | ||
1847 | 19 | from autopilot.emulators.unity.tooltip import ToolTip | ||
1848 | 20 | >>>>>>> MERGE-SOURCE | ||
1849 | 15 | 21 | ||
1850 | 16 | class SimpleLauncherIcon(UnityIntrospectionObject): | 22 | class SimpleLauncherIcon(UnityIntrospectionObject): |
1851 | 17 | """Holds information about a simple launcher icon. | 23 | """Holds information about a simple launcher icon. |
1852 | 18 | 24 | ||
1853 | === modified file 'tests/autopilot/unity/emulators/launcher.py' | |||
1854 | === modified file 'tests/autopilot/unity/emulators/quicklist.py' | |||
1855 | === modified file 'tests/autopilot/unity/emulators/shortcut_hint.py' | |||
1856 | === modified file 'tests/autopilot/unity/emulators/tooltip.py' | |||
1857 | --- tests/autopilot/unity/emulators/tooltip.py 2012-05-16 02:57:25 +0000 | |||
1858 | +++ tests/autopilot/unity/emulators/tooltip.py 2012-05-24 17:16:22 +0000 | |||
1859 | @@ -1,3 +1,4 @@ | |||
1860 | 1 | <<<<<<< TREE | ||
1861 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 2 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1862 | 2 | # Copyright 2012 Canonical | 3 | # Copyright 2012 Canonical |
1863 | 3 | # Author: Andrea Azzarone | 4 | # Author: Andrea Azzarone |
1864 | @@ -18,3 +19,25 @@ | |||
1865 | 18 | 19 | ||
1866 | 19 | class ToolTip(UnityIntrospectionObject): | 20 | class ToolTip(UnityIntrospectionObject): |
1867 | 20 | """Represents a tooltip.""" | 21 | """Represents a tooltip.""" |
1868 | 22 | ======= | ||
1869 | 23 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
1870 | 24 | # Copyright 2012 Canonical | ||
1871 | 25 | # Author: Andrea Azzarone | ||
1872 | 26 | # | ||
1873 | 27 | # This program is free software: you can redistribute it and/or modify it | ||
1874 | 28 | # under the terms of the GNU General Public License version 3, as published | ||
1875 | 29 | # by the Free Software Foundation. | ||
1876 | 30 | # | ||
1877 | 31 | |||
1878 | 32 | import logging | ||
1879 | 33 | from time import sleep | ||
1880 | 34 | |||
1881 | 35 | from autopilot.emulators.unity import UnityIntrospectionObject | ||
1882 | 36 | |||
1883 | 37 | |||
1884 | 38 | logger = logging.getLogger(__name__) | ||
1885 | 39 | |||
1886 | 40 | |||
1887 | 41 | class ToolTip(UnityIntrospectionObject): | ||
1888 | 42 | """Represents a tooltip.""" | ||
1889 | 43 | >>>>>>> MERGE-SOURCE | ||
1890 | 21 | 44 | ||
1891 | === modified file 'tests/autopilot/unity/emulators/window_manager.py' | |||
1892 | --- tests/autopilot/unity/emulators/window_manager.py 2012-05-08 16:13:17 +0000 | |||
1893 | +++ tests/autopilot/unity/emulators/window_manager.py 2012-05-24 17:16:22 +0000 | |||
1894 | @@ -1,3 +1,4 @@ | |||
1895 | 1 | <<<<<<< TREE | ||
1896 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 2 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1897 | 2 | # Copyright 2012 Canonical | 3 | # Copyright 2012 Canonical |
1898 | 3 | # Author: Marco Trevisan (Treviño) | 4 | # Author: Marco Trevisan (Treviño) |
1899 | @@ -22,3 +23,27 @@ | |||
1900 | 22 | def screen_geometry(self): | 23 | def screen_geometry(self): |
1901 | 23 | """Returns a tuple of (x,y,w,h) for the screen.""" | 24 | """Returns a tuple of (x,y,w,h) for the screen.""" |
1902 | 24 | return (self.x, self.y, self.width, self.height) | 25 | return (self.x, self.y, self.width, self.height) |
1903 | 26 | ======= | ||
1904 | 27 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
1905 | 28 | # Copyright 2012 Canonical | ||
1906 | 29 | # Author: Marco Trevisan (Treviño) | ||
1907 | 30 | # | ||
1908 | 31 | # This program is free software: you can redistribute it and/or modify it | ||
1909 | 32 | # under the terms of the GNU General Public License version 3, as published | ||
1910 | 33 | # by the Free Software Foundation. | ||
1911 | 34 | # | ||
1912 | 35 | |||
1913 | 36 | import logging | ||
1914 | 37 | from autopilot.emulators.unity import UnityIntrospectionObject | ||
1915 | 38 | |||
1916 | 39 | logger = logging.getLogger(__name__) | ||
1917 | 40 | |||
1918 | 41 | |||
1919 | 42 | class WindowManager(UnityIntrospectionObject): | ||
1920 | 43 | """The WindowManager class.""" | ||
1921 | 44 | |||
1922 | 45 | @property | ||
1923 | 46 | def screen_geometry(self): | ||
1924 | 47 | """Returns a tuple of (x,y,w,h) for the screen.""" | ||
1925 | 48 | return (self.x, self.y, self.width, self.height) | ||
1926 | 49 | >>>>>>> MERGE-SOURCE | ||
1927 | 25 | 50 | ||
1928 | === modified file 'tests/autopilot/unity/tests/__init__.py' | |||
1929 | --- tests/autopilot/unity/tests/__init__.py 2012-05-16 23:02:38 +0000 | |||
1930 | +++ tests/autopilot/unity/tests/__init__.py 2012-05-24 17:16:22 +0000 | |||
1931 | @@ -29,6 +29,7 @@ | |||
1932 | 29 | start_log_to_file, | 29 | start_log_to_file, |
1933 | 30 | reset_logging, | 30 | reset_logging, |
1934 | 31 | ) | 31 | ) |
1935 | 32 | <<<<<<< TREE | ||
1936 | 32 | 33 | ||
1937 | 33 | 34 | ||
1938 | 34 | 35 | ||
1939 | @@ -94,6 +95,95 @@ | |||
1940 | 94 | managers = WindowManager.get_all_instances() | 95 | managers = WindowManager.get_all_instances() |
1941 | 95 | self.assertThat(len(managers), Equals(1)) | 96 | self.assertThat(len(managers), Equals(1)) |
1942 | 96 | return managers[0] | 97 | return managers[0] |
1943 | 98 | ======= | ||
1944 | 99 | from autopilot.emulators.unity.dash import Dash | ||
1945 | 100 | from autopilot.emulators.unity.hud import Hud | ||
1946 | 101 | from autopilot.emulators.unity.launcher import LauncherController | ||
1947 | 102 | from autopilot.emulators.unity.panel import PanelController | ||
1948 | 103 | from autopilot.emulators.unity.switcher import Switcher | ||
1949 | 104 | from autopilot.emulators.unity.window_manager import WindowManager | ||
1950 | 105 | from autopilot.emulators.unity.workspace import WorkspaceManager | ||
1951 | 106 | from autopilot.emulators.X11 import ScreenGeometry, Keyboard, Mouse, reset_display | ||
1952 | 107 | from autopilot.glibrunner import GlibRunner | ||
1953 | 108 | from autopilot.globals import (global_context, | ||
1954 | 109 | video_recording_enabled, | ||
1955 | 110 | video_record_directory, | ||
1956 | 111 | ) | ||
1957 | 112 | from autopilot.keybindings import KeybindingsHelper | ||
1958 | 113 | |||
1959 | 114 | |||
1960 | 115 | logger = logging.getLogger(__name__) | ||
1961 | 116 | |||
1962 | 117 | |||
1963 | 118 | try: | ||
1964 | 119 | from testscenarios.scenarios import multiply_scenarios | ||
1965 | 120 | except ImportError: | ||
1966 | 121 | from itertools import product | ||
1967 | 122 | def multiply_scenarios(*scenarios): | ||
1968 | 123 | """Multiply two or more iterables of scenarios. | ||
1969 | 124 | |||
1970 | 125 | It is safe to pass scenario generators or iterators. | ||
1971 | 126 | |||
1972 | 127 | :returns: A list of compound scenarios: the cross-product of all | ||
1973 | 128 | scenarios, with the names concatenated and the parameters | ||
1974 | 129 | merged together. | ||
1975 | 130 | """ | ||
1976 | 131 | result = [] | ||
1977 | 132 | scenario_lists = map(list, scenarios) | ||
1978 | 133 | for combination in product(*scenario_lists): | ||
1979 | 134 | names, parameters = zip(*combination) | ||
1980 | 135 | scenario_name = ','.join(names) | ||
1981 | 136 | scenario_parameters = {} | ||
1982 | 137 | for parameter in parameters: | ||
1983 | 138 | scenario_parameters.update(parameter) | ||
1984 | 139 | result.append((scenario_name, scenario_parameters)) | ||
1985 | 140 | return result | ||
1986 | 141 | |||
1987 | 142 | |||
1988 | 143 | class LoggedTestCase(TestWithScenarios, TestCase): | ||
1989 | 144 | """Initialize the logging for the test case.""" | ||
1990 | 145 | |||
1991 | 146 | def setUp(self): | ||
1992 | 147 | self._setUpTestLogging() | ||
1993 | 148 | self._setUpUnityLogging() | ||
1994 | 149 | # The reason that the super setup is done here is due to making sure | ||
1995 | 150 | # that the logging is properly set up prior to calling it. | ||
1996 | 151 | super(LoggedTestCase, self).setUp() | ||
1997 | 152 | |||
1998 | 153 | def _setUpTestLogging(self): | ||
1999 | 154 | class MyFormatter(logging.Formatter): | ||
2000 | 155 | |||
2001 | 156 | def formatTime(self, record, datefmt=None): | ||
2002 | 157 | ct = self.converter(record.created) | ||
2003 | 158 | if datefmt: | ||
2004 | 159 | s = time.strftime(datefmt, ct) | ||
2005 | 160 | else: | ||
2006 | 161 | t = time.strftime("%H:%M:%S", ct) | ||
2007 | 162 | s = "%s.%03d" % (t, record.msecs) | ||
2008 | 163 | return s | ||
2009 | 164 | |||
2010 | 165 | self._log_buffer = StringIO() | ||
2011 | 166 | root_logger = logging.getLogger() | ||
2012 | 167 | root_logger.setLevel(logging.DEBUG) | ||
2013 | 168 | handler = logging.StreamHandler(stream=self._log_buffer) | ||
2014 | 169 | log_format = "%(asctime)s %(levelname)s %(module)s:%(lineno)d - %(message)s" | ||
2015 | 170 | handler.setFormatter(MyFormatter(log_format)) | ||
2016 | 171 | root_logger.addHandler(handler) | ||
2017 | 172 | #Tear down logging in a cleanUp handler, so it's done after all other | ||
2018 | 173 | # tearDown() calls and cleanup handlers. | ||
2019 | 174 | self.addCleanup(self._tearDownLogging) | ||
2020 | 175 | |||
2021 | 176 | def _tearDownLogging(self): | ||
2022 | 177 | logger = logging.getLogger() | ||
2023 | 178 | for handler in logger.handlers: | ||
2024 | 179 | handler.flush() | ||
2025 | 180 | self._log_buffer.seek(0) | ||
2026 | 181 | self.addDetail('test-log', text_content(self._log_buffer.getvalue())) | ||
2027 | 182 | logger.removeHandler(handler) | ||
2028 | 183 | # Calling del to remove the handler and flush the buffer. We are | ||
2029 | 184 | # abusing the log handlers here a little. | ||
2030 | 185 | del self._log_buffer | ||
2031 | 186 | >>>>>>> MERGE-SOURCE | ||
2032 | 97 | 187 | ||
2033 | 98 | def _setUpUnityLogging(self): | 188 | def _setUpUnityLogging(self): |
2034 | 99 | self._unity_log_file_name = mktemp(prefix=self.shortDescription()) | 189 | self._unity_log_file_name = mktemp(prefix=self.shortDescription()) |
2035 | @@ -122,3 +212,228 @@ | |||
2036 | 122 | """ | 212 | """ |
2037 | 123 | set_log_severity(component, level) | 213 | set_log_severity(component, level) |
2038 | 124 | 214 | ||
2039 | 215 | <<<<<<< TREE | ||
2040 | 216 | ======= | ||
2041 | 217 | |||
2042 | 218 | class VideoCapturedTestCase(LoggedTestCase): | ||
2043 | 219 | """Video capture autopilot tests, saving the results if the test failed.""" | ||
2044 | 220 | |||
2045 | 221 | _recording_app = '/usr/bin/recordmydesktop' | ||
2046 | 222 | _recording_opts = ['--no-sound', '--no-frame', '-o',] | ||
2047 | 223 | |||
2048 | 224 | def setUp(self): | ||
2049 | 225 | super(VideoCapturedTestCase, self).setUp() | ||
2050 | 226 | global video_recording_enabled | ||
2051 | 227 | if video_recording_enabled and not self._have_recording_app(): | ||
2052 | 228 | video_recording_enabled = False | ||
2053 | 229 | logger.warning("Disabling video capture since '%s' is not present", self._recording_app) | ||
2054 | 230 | |||
2055 | 231 | if video_recording_enabled: | ||
2056 | 232 | self._test_passed = True | ||
2057 | 233 | self.addOnException(self._on_test_failed) | ||
2058 | 234 | self.addCleanup(self._stop_video_capture) | ||
2059 | 235 | self._start_video_capture() | ||
2060 | 236 | |||
2061 | 237 | def _have_recording_app(self): | ||
2062 | 238 | return os.path.exists(self._recording_app) | ||
2063 | 239 | |||
2064 | 240 | def _start_video_capture(self): | ||
2065 | 241 | args = self._get_capture_command_line() | ||
2066 | 242 | self._capture_file = self._get_capture_output_file() | ||
2067 | 243 | self._ensure_directory_exists_but_not_file(self._capture_file) | ||
2068 | 244 | args.append(self._capture_file) | ||
2069 | 245 | logger.debug("Starting: %r", args) | ||
2070 | 246 | self._capture_process = Popen(args, stdout=PIPE, stderr=STDOUT) | ||
2071 | 247 | |||
2072 | 248 | def _stop_video_capture(self): | ||
2073 | 249 | """Stop the video capture. If the test failed, save the resulting file.""" | ||
2074 | 250 | |||
2075 | 251 | if self._test_passed: | ||
2076 | 252 | # We use kill here because we don't want the recording app to start | ||
2077 | 253 | # encoding the video file (since we're removing it anyway.) | ||
2078 | 254 | self._capture_process.kill() | ||
2079 | 255 | self._capture_process.wait() | ||
2080 | 256 | else: | ||
2081 | 257 | self._capture_process.terminate() | ||
2082 | 258 | self._capture_process.wait() | ||
2083 | 259 | if self._capture_process.returncode != 0: | ||
2084 | 260 | self.addDetail('video capture log', text_content(self._capture_process.stdout.read())) | ||
2085 | 261 | self._capture_process = None | ||
2086 | 262 | |||
2087 | 263 | def _get_capture_command_line(self): | ||
2088 | 264 | return [self._recording_app] + self._recording_opts | ||
2089 | 265 | |||
2090 | 266 | def _get_capture_output_file(self): | ||
2091 | 267 | return os.path.join(video_record_directory, '%s.ogv' % (self.shortDescription())) | ||
2092 | 268 | |||
2093 | 269 | def _ensure_directory_exists_but_not_file(self, file_path): | ||
2094 | 270 | dirpath = os.path.dirname(file_path) | ||
2095 | 271 | if not os.path.exists(dirpath): | ||
2096 | 272 | os.makedirs(dirpath) | ||
2097 | 273 | elif os.path.exists(file_path): | ||
2098 | 274 | logger.warning("Video capture file '%s' already exists, deleting.", file_path) | ||
2099 | 275 | os.remove(file_path) | ||
2100 | 276 | |||
2101 | 277 | def _on_test_failed(self, ex_info): | ||
2102 | 278 | """Called when a test fails.""" | ||
2103 | 279 | self._test_passed = False | ||
2104 | 280 | |||
2105 | 281 | |||
2106 | 282 | class AutopilotTestCase(VideoCapturedTestCase, KeybindingsHelper): | ||
2107 | 283 | """Wrapper around testtools.TestCase that takes care of some cleaning.""" | ||
2108 | 284 | |||
2109 | 285 | run_test_with = GlibRunner | ||
2110 | 286 | |||
2111 | 287 | KNOWN_APPS = { | ||
2112 | 288 | 'Character Map' : { | ||
2113 | 289 | 'desktop-file': 'gucharmap.desktop', | ||
2114 | 290 | 'process-name': 'gucharmap', | ||
2115 | 291 | }, | ||
2116 | 292 | 'Calculator' : { | ||
2117 | 293 | 'desktop-file': 'gcalctool.desktop', | ||
2118 | 294 | 'process-name': 'gcalctool', | ||
2119 | 295 | }, | ||
2120 | 296 | 'Mahjongg' : { | ||
2121 | 297 | 'desktop-file': 'mahjongg.desktop', | ||
2122 | 298 | 'process-name': 'mahjongg', | ||
2123 | 299 | }, | ||
2124 | 300 | 'Remmina' : { | ||
2125 | 301 | 'desktop-file': 'remmina.desktop', | ||
2126 | 302 | 'process-name': 'remmina', | ||
2127 | 303 | }, | ||
2128 | 304 | 'System Settings' : { | ||
2129 | 305 | 'desktop-file': 'gnome-control-center.desktop', | ||
2130 | 306 | 'process-name': 'gnome-control-center', | ||
2131 | 307 | }, | ||
2132 | 308 | 'Text Editor' : { | ||
2133 | 309 | 'desktop-file': 'gedit.desktop', | ||
2134 | 310 | 'process-name': 'gedit', | ||
2135 | 311 | }, | ||
2136 | 312 | } | ||
2137 | 313 | |||
2138 | 314 | def setUp(self): | ||
2139 | 315 | super(AutopilotTestCase, self).setUp() | ||
2140 | 316 | self.bamf = Bamf() | ||
2141 | 317 | self.keyboard = Keyboard() | ||
2142 | 318 | self.mouse = Mouse() | ||
2143 | 319 | self.dash = Dash() | ||
2144 | 320 | self.hud = Hud() | ||
2145 | 321 | self.launcher = self._get_launcher_controller() | ||
2146 | 322 | self.panels = self._get_panel_controller() | ||
2147 | 323 | self.switcher = Switcher() | ||
2148 | 324 | self.window_manager = self._get_window_manager() | ||
2149 | 325 | self.workspace = WorkspaceManager() | ||
2150 | 326 | self.screen_geo = ScreenGeometry() | ||
2151 | 327 | self.addCleanup(self.workspace.switch_to, self.workspace.current_workspace) | ||
2152 | 328 | self.addCleanup(Keyboard.cleanup) | ||
2153 | 329 | self.addCleanup(Mouse.cleanup) | ||
2154 | 330 | |||
2155 | 331 | def start_app(self, app_name, files=[], locale=None): | ||
2156 | 332 | """Start one of the known apps, and kill it on tear down. | ||
2157 | 333 | |||
2158 | 334 | If files is specified, start the application with the specified files. | ||
2159 | 335 | If locale is specified, the locale will be set when the application is launched. | ||
2160 | 336 | |||
2161 | 337 | The method returns the BamfApplication instance. | ||
2162 | 338 | |||
2163 | 339 | """ | ||
2164 | 340 | if locale: | ||
2165 | 341 | os.putenv("LC_ALL", locale) | ||
2166 | 342 | self.addCleanup(os.unsetenv, "LC_ALL") | ||
2167 | 343 | logger.info("Starting application '%s' with files %r in locale %s", app_name, files, locale) | ||
2168 | 344 | else: | ||
2169 | 345 | logger.info("Starting application '%s' with files %r", app_name, files) | ||
2170 | 346 | |||
2171 | 347 | app = self.KNOWN_APPS[app_name] | ||
2172 | 348 | self.bamf.launch_application(app['desktop-file'], files) | ||
2173 | 349 | apps = self.bamf.get_running_applications_by_desktop_file(app['desktop-file']) | ||
2174 | 350 | self.addCleanup(call, "kill `pidof %s`" % (app['process-name']), shell=True) | ||
2175 | 351 | self.assertThat(len(apps), Equals(1)) | ||
2176 | 352 | return apps[0] | ||
2177 | 353 | |||
2178 | 354 | def close_all_app(self, app_name): | ||
2179 | 355 | """Close all instances of the app_name.""" | ||
2180 | 356 | app = self.KNOWN_APPS[app_name] | ||
2181 | 357 | pids = check_output(["pidof", app['process-name']]).split() | ||
2182 | 358 | if len(pids): | ||
2183 | 359 | call(["kill"] + pids) | ||
2184 | 360 | |||
2185 | 361 | def get_app_instances(self, app_name): | ||
2186 | 362 | """Get BamfApplication instances for app_name.""" | ||
2187 | 363 | desktop_file = self.KNOWN_APPS[app_name]['desktop-file'] | ||
2188 | 364 | return self.bamf.get_running_applications_by_desktop_file(desktop_file) | ||
2189 | 365 | |||
2190 | 366 | def app_is_running(self, app_name): | ||
2191 | 367 | """Returns true if an instance of the application is running.""" | ||
2192 | 368 | apps = self.get_app_instances(app_name) | ||
2193 | 369 | return len(apps) > 0 | ||
2194 | 370 | |||
2195 | 371 | def call_gsettings_cmd(self, command, schema, *args): | ||
2196 | 372 | """Set a desktop wide gsettings option | ||
2197 | 373 | |||
2198 | 374 | Using the gsettings command because there's a bug with importing | ||
2199 | 375 | from gobject introspection and pygtk2 simultaneously, and the Xlib | ||
2200 | 376 | keyboard layout bits are very unweildy. This seems like the best | ||
2201 | 377 | solution, even a little bit brutish. | ||
2202 | 378 | """ | ||
2203 | 379 | cmd = ['gsettings', command, schema] + list(args) | ||
2204 | 380 | # strip to remove the trailing \n. | ||
2205 | 381 | ret = check_output(cmd).strip() | ||
2206 | 382 | time.sleep(5) | ||
2207 | 383 | reset_display() | ||
2208 | 384 | return ret | ||
2209 | 385 | |||
2210 | 386 | def set_unity_option(self, option_name, option_value): | ||
2211 | 387 | """Set an option in the unity compiz plugin options. | ||
2212 | 388 | |||
2213 | 389 | The value will be set for the current test only. | ||
2214 | 390 | |||
2215 | 391 | """ | ||
2216 | 392 | self.set_compiz_option("unityshell", option_name, option_value) | ||
2217 | 393 | |||
2218 | 394 | def set_compiz_option(self, plugin_name, setting_name, setting_value): | ||
2219 | 395 | """Set setting `setting_name` in compiz plugin `plugin_name` to value `setting_value` | ||
2220 | 396 | for one test only. | ||
2221 | 397 | """ | ||
2222 | 398 | old_value = self._set_compiz_option(plugin_name, setting_name, setting_value) | ||
2223 | 399 | self.addCleanup(self._set_compiz_option, plugin_name, setting_name, old_value) | ||
2224 | 400 | # Allow unity time to respond to the new setting. | ||
2225 | 401 | time.sleep(0.5) | ||
2226 | 402 | |||
2227 | 403 | def _set_compiz_option(self, plugin_name, option_name, option_value): | ||
2228 | 404 | logger.info("Setting compiz option '%s' in plugin '%s' to %r", | ||
2229 | 405 | option_name, plugin_name, option_value) | ||
2230 | 406 | plugin = Plugin(global_context, plugin_name) | ||
2231 | 407 | setting = Setting(plugin, option_name) | ||
2232 | 408 | old_value = setting.Value | ||
2233 | 409 | setting.Value = option_value | ||
2234 | 410 | global_context.Write() | ||
2235 | 411 | return old_value | ||
2236 | 412 | |||
2237 | 413 | def _get_launcher_controller(self): | ||
2238 | 414 | controllers = LauncherController.get_all_instances() | ||
2239 | 415 | self.assertThat(len(controllers), Equals(1)) | ||
2240 | 416 | return controllers[0] | ||
2241 | 417 | |||
2242 | 418 | def _get_panel_controller(self): | ||
2243 | 419 | controllers = PanelController.get_all_instances() | ||
2244 | 420 | self.assertThat(len(controllers), Equals(1)) | ||
2245 | 421 | return controllers[0] | ||
2246 | 422 | |||
2247 | 423 | def _get_window_manager(self): | ||
2248 | 424 | managers = WindowManager.get_all_instances() | ||
2249 | 425 | self.assertThat(len(managers), Equals(1)) | ||
2250 | 426 | return managers[0] | ||
2251 | 427 | |||
2252 | 428 | def assertVisibleWindowStack(self, stack_start): | ||
2253 | 429 | """Check that the visible window stack starts with the windows passed in. | ||
2254 | 430 | |||
2255 | 431 | The start_stack is an iterable of BamfWindow objects. | ||
2256 | 432 | Minimised windows are skipped. | ||
2257 | 433 | |||
2258 | 434 | """ | ||
2259 | 435 | stack = [win for win in self.bamf.get_open_windows() if not win.is_hidden] | ||
2260 | 436 | for pos, win in enumerate(stack_start): | ||
2261 | 437 | self.assertThat(stack[pos].x_id, Equals(win.x_id), | ||
2262 | 438 | "%r at %d does not equal %r" % (stack[pos], pos, win)) | ||
2263 | 439 | >>>>>>> MERGE-SOURCE | ||
2264 | 125 | 440 | ||
2265 | === modified file 'tests/autopilot/unity/tests/test_command_lens.py' | |||
2266 | --- tests/autopilot/unity/tests/test_command_lens.py 2012-05-08 16:13:17 +0000 | |||
2267 | +++ tests/autopilot/unity/tests/test_command_lens.py 2012-05-24 17:16:22 +0000 | |||
2268 | @@ -12,10 +12,18 @@ | |||
2269 | 12 | from testtools.matchers import Equals | 12 | from testtools.matchers import Equals |
2270 | 13 | from time import sleep | 13 | from time import sleep |
2271 | 14 | 14 | ||
2272 | 15 | <<<<<<< TREE | ||
2273 | 15 | from unity.tests import UnityTestCase | 16 | from unity.tests import UnityTestCase |
2274 | 16 | 17 | ||
2275 | 17 | 18 | ||
2276 | 18 | class CommandLensSearchTests(UnityTestCase): | 19 | class CommandLensSearchTests(UnityTestCase): |
2277 | 20 | ======= | ||
2278 | 21 | from autopilot.tests import AutopilotTestCase | ||
2279 | 22 | from autopilot.matchers import Eventually | ||
2280 | 23 | |||
2281 | 24 | |||
2282 | 25 | class CommandLensSearchTests(AutopilotTestCase): | ||
2283 | 26 | >>>>>>> MERGE-SOURCE | ||
2284 | 19 | """Test the command lense search bahavior.""" | 27 | """Test the command lense search bahavior.""" |
2285 | 20 | 28 | ||
2286 | 21 | def setUp(self): | 29 | def setUp(self): |
2287 | 22 | 30 | ||
2288 | === modified file 'tests/autopilot/unity/tests/test_dash.py' | |||
2289 | --- tests/autopilot/unity/tests/test_dash.py 2012-05-08 16:13:17 +0000 | |||
2290 | +++ tests/autopilot/unity/tests/test_dash.py 2012-05-24 17:16:22 +0000 | |||
2291 | @@ -12,12 +12,22 @@ | |||
2292 | 12 | 12 | ||
2293 | 13 | from autopilot.matchers import Eventually | 13 | from autopilot.matchers import Eventually |
2294 | 14 | from gtk import Clipboard | 14 | from gtk import Clipboard |
2295 | 15 | <<<<<<< TREE | ||
2296 | 15 | from testtools.matchers import Equals, NotEquals | 16 | from testtools.matchers import Equals, NotEquals |
2297 | 16 | 17 | ||
2298 | 17 | from unity.tests import UnityTestCase | 18 | from unity.tests import UnityTestCase |
2299 | 18 | 19 | ||
2300 | 19 | 20 | ||
2301 | 20 | class DashTestCase(UnityTestCase): | 21 | class DashTestCase(UnityTestCase): |
2302 | 22 | ======= | ||
2303 | 23 | from testtools.matchers import Equals, NotEquals | ||
2304 | 24 | |||
2305 | 25 | from autopilot.matchers import Eventually | ||
2306 | 26 | from autopilot.tests import AutopilotTestCase | ||
2307 | 27 | |||
2308 | 28 | |||
2309 | 29 | class DashTestCase(AutopilotTestCase): | ||
2310 | 30 | >>>>>>> MERGE-SOURCE | ||
2311 | 21 | def setUp(self): | 31 | def setUp(self): |
2312 | 22 | super(DashTestCase, self).setUp() | 32 | super(DashTestCase, self).setUp() |
2313 | 23 | self.set_unity_log_level("unity.shell", "DEBUG") | 33 | self.set_unity_log_level("unity.shell", "DEBUG") |
2314 | 24 | 34 | ||
2315 | === modified file 'tests/autopilot/unity/tests/test_home_lens.py' | |||
2316 | --- tests/autopilot/unity/tests/test_home_lens.py 2012-05-08 16:13:17 +0000 | |||
2317 | +++ tests/autopilot/unity/tests/test_home_lens.py 2012-05-24 17:16:22 +0000 | |||
2318 | @@ -6,16 +6,28 @@ | |||
2319 | 6 | # under the terms of the GNU General Public License version 3, as published | 6 | # under the terms of the GNU General Public License version 3, as published |
2320 | 7 | # by the Free Software Foundation. | 7 | # by the Free Software Foundation. |
2321 | 8 | 8 | ||
2322 | 9 | <<<<<<< TREE | ||
2323 | 9 | from __future__ import absolute_import | 10 | from __future__ import absolute_import |
2324 | 10 | 11 | ||
2325 | 11 | from autopilot.matchers import Eventually | 12 | from autopilot.matchers import Eventually |
2326 | 12 | from testtools.matchers import Equals | 13 | from testtools.matchers import Equals |
2327 | 14 | ======= | ||
2328 | 15 | from testtools.matchers import Equals | ||
2329 | 16 | >>>>>>> MERGE-SOURCE | ||
2330 | 13 | from time import sleep | 17 | from time import sleep |
2331 | 14 | 18 | ||
2332 | 19 | <<<<<<< TREE | ||
2333 | 15 | from unity.tests import UnityTestCase | 20 | from unity.tests import UnityTestCase |
2334 | 16 | 21 | ||
2335 | 17 | 22 | ||
2336 | 18 | class HomeLensSearchTests(UnityTestCase): | 23 | class HomeLensSearchTests(UnityTestCase): |
2337 | 24 | ======= | ||
2338 | 25 | from autopilot.matchers import Eventually | ||
2339 | 26 | from autopilot.tests import AutopilotTestCase | ||
2340 | 27 | |||
2341 | 28 | |||
2342 | 29 | class HomeLensSearchTests(AutopilotTestCase): | ||
2343 | 30 | >>>>>>> MERGE-SOURCE | ||
2344 | 19 | """Test the command lense search bahavior.""" | 31 | """Test the command lense search bahavior.""" |
2345 | 20 | 32 | ||
2346 | 21 | def setUp(self): | 33 | def setUp(self): |
2347 | 22 | 34 | ||
2348 | === modified file 'tests/autopilot/unity/tests/test_hud.py' | |||
2349 | --- tests/autopilot/unity/tests/test_hud.py 2012-05-08 16:13:17 +0000 | |||
2350 | +++ tests/autopilot/unity/tests/test_hud.py 2012-05-24 17:16:22 +0000 | |||
2351 | @@ -7,6 +7,7 @@ | |||
2352 | 7 | # under the terms of the GNU General Public License version 3, as published | 7 | # under the terms of the GNU General Public License version 3, as published |
2353 | 8 | # by the Free Software Foundation. | 8 | # by the Free Software Foundation. |
2354 | 9 | 9 | ||
2355 | 10 | <<<<<<< TREE | ||
2356 | 10 | from __future__ import absolute_import | 11 | from __future__ import absolute_import |
2357 | 11 | 12 | ||
2358 | 12 | from autopilot.matchers import Eventually | 13 | from autopilot.matchers import Eventually |
2359 | @@ -20,10 +21,28 @@ | |||
2360 | 20 | LessThan, | 21 | LessThan, |
2361 | 21 | NotEquals, | 22 | NotEquals, |
2362 | 22 | ) | 23 | ) |
2363 | 24 | ======= | ||
2364 | 25 | from os import remove | ||
2365 | 26 | from testtools.matchers import ( | ||
2366 | 27 | Equals, | ||
2367 | 28 | EndsWith, | ||
2368 | 29 | GreaterThan, | ||
2369 | 30 | LessThan, | ||
2370 | 31 | NotEquals, | ||
2371 | 32 | ) | ||
2372 | 33 | >>>>>>> MERGE-SOURCE | ||
2373 | 23 | from time import sleep | 34 | from time import sleep |
2374 | 24 | 35 | ||
2375 | 36 | <<<<<<< TREE | ||
2376 | 25 | from unity.emulators.icons import HudLauncherIcon | 37 | from unity.emulators.icons import HudLauncherIcon |
2377 | 26 | from unity.tests import UnityTestCase | 38 | from unity.tests import UnityTestCase |
2378 | 39 | ======= | ||
2379 | 40 | from autopilot.emulators.unity.icons import HudLauncherIcon | ||
2380 | 41 | from autopilot.emulators.X11 import ScreenGeometry | ||
2381 | 42 | from autopilot.matchers import Eventually | ||
2382 | 43 | from autopilot.tests import AutopilotTestCase, multiply_scenarios | ||
2383 | 44 | |||
2384 | 45 | >>>>>>> MERGE-SOURCE | ||
2385 | 27 | 46 | ||
2386 | 28 | 47 | ||
2387 | 29 | def _make_monitor_scenarios(): | 48 | def _make_monitor_scenarios(): |
2388 | @@ -208,9 +227,15 @@ | |||
2389 | 208 | """When switching from the hud to the dash alt+f1 is disabled.""" | 227 | """When switching from the hud to the dash alt+f1 is disabled.""" |
2390 | 209 | self.hud.ensure_visible() | 228 | self.hud.ensure_visible() |
2391 | 210 | self.dash.ensure_visible() | 229 | self.dash.ensure_visible() |
2392 | 230 | <<<<<<< TREE | ||
2393 | 211 | self.addCleanup(self.dash.ensure_hidden) | 231 | self.addCleanup(self.dash.ensure_hidden) |
2394 | 212 | 232 | ||
2395 | 213 | self.keybinding("launcher/keynav") | 233 | self.keybinding("launcher/keynav") |
2396 | 234 | ======= | ||
2397 | 235 | self.addCleanup(self.dash.ensure_hidden) | ||
2398 | 236 | |||
2399 | 237 | self.keybinding("launcher/keynav") | ||
2400 | 238 | >>>>>>> MERGE-SOURCE | ||
2401 | 214 | self.assertThat(self.launcher.key_nav_is_active, Equals(False)) | 239 | self.assertThat(self.launcher.key_nav_is_active, Equals(False)) |
2402 | 215 | 240 | ||
2403 | 216 | def test_hud_to_dash_has_key_focus(self): | 241 | def test_hud_to_dash_has_key_focus(self): |
2404 | 217 | 242 | ||
2405 | === modified file 'tests/autopilot/unity/tests/test_ibus.py' | |||
2406 | --- tests/autopilot/unity/tests/test_ibus.py 2012-05-16 02:57:25 +0000 | |||
2407 | +++ tests/autopilot/unity/tests/test_ibus.py 2012-05-24 17:16:22 +0000 | |||
2408 | @@ -8,13 +8,18 @@ | |||
2409 | 8 | 8 | ||
2410 | 9 | """Tests to ensure unity is compatible with ibus input method.""" | 9 | """Tests to ensure unity is compatible with ibus input method.""" |
2411 | 10 | 10 | ||
2412 | 11 | <<<<<<< TREE | ||
2413 | 11 | from __future__ import absolute_import | 12 | from __future__ import absolute_import |
2414 | 13 | ======= | ||
2415 | 14 | from testtools.matchers import Equals, NotEquals | ||
2416 | 15 | >>>>>>> MERGE-SOURCE | ||
2417 | 12 | 16 | ||
2418 | 13 | from autopilot.emulators.ibus import ( | 17 | from autopilot.emulators.ibus import ( |
2419 | 14 | get_active_input_engines, | 18 | get_active_input_engines, |
2420 | 15 | set_active_engines, | 19 | set_active_engines, |
2421 | 16 | get_available_input_engines, | 20 | get_available_input_engines, |
2422 | 17 | ) | 21 | ) |
2423 | 22 | <<<<<<< TREE | ||
2424 | 18 | from autopilot.matchers import Eventually | 23 | from autopilot.matchers import Eventually |
2425 | 19 | from autopilot.testcase import multiply_scenarios | 24 | from autopilot.testcase import multiply_scenarios |
2426 | 20 | from testtools.matchers import Equals, NotEquals | 25 | from testtools.matchers import Equals, NotEquals |
2427 | @@ -23,6 +28,13 @@ | |||
2428 | 23 | 28 | ||
2429 | 24 | 29 | ||
2430 | 25 | class IBusTests(UnityTestCase): | 30 | class IBusTests(UnityTestCase): |
2431 | 31 | ======= | ||
2432 | 32 | from autopilot.matchers import Eventually | ||
2433 | 33 | from autopilot.tests import AutopilotTestCase, multiply_scenarios | ||
2434 | 34 | |||
2435 | 35 | |||
2436 | 36 | class IBusTests(AutopilotTestCase): | ||
2437 | 37 | >>>>>>> MERGE-SOURCE | ||
2438 | 26 | """Base class for IBus tests.""" | 38 | """Base class for IBus tests.""" |
2439 | 27 | 39 | ||
2440 | 28 | def setUp(self): | 40 | def setUp(self): |
2441 | @@ -31,6 +43,7 @@ | |||
2442 | 31 | def tearDown(self): | 43 | def tearDown(self): |
2443 | 32 | super(IBusTests, self).tearDown() | 44 | super(IBusTests, self).tearDown() |
2444 | 33 | 45 | ||
2445 | 46 | <<<<<<< TREE | ||
2446 | 34 | @classmethod | 47 | @classmethod |
2447 | 35 | def setUpClass(cls): | 48 | def setUpClass(cls): |
2448 | 36 | cls._old_engines = None | 49 | cls._old_engines = None |
2449 | @@ -41,11 +54,30 @@ | |||
2450 | 41 | set_active_engines(cls._old_engines) | 54 | set_active_engines(cls._old_engines) |
2451 | 42 | 55 | ||
2452 | 43 | def activate_input_engine_or_skip(self, engine_name): | 56 | def activate_input_engine_or_skip(self, engine_name): |
2453 | 57 | ======= | ||
2454 | 58 | @classmethod | ||
2455 | 59 | def setUpClass(cls): | ||
2456 | 60 | cls._old_engines = None | ||
2457 | 61 | cls.activate_input_engine_or_skip(cls.engine_name) | ||
2458 | 62 | |||
2459 | 63 | @classmethod | ||
2460 | 64 | def tearDownClass(cls): | ||
2461 | 65 | if cls._old_engines is not None: | ||
2462 | 66 | set_active_engines(cls._old_engines) | ||
2463 | 67 | |||
2464 | 68 | @classmethod | ||
2465 | 69 | def activate_input_engine_or_skip(cls, engine_name): | ||
2466 | 70 | >>>>>>> MERGE-SOURCE | ||
2467 | 44 | available_engines = get_available_input_engines() | 71 | available_engines = get_available_input_engines() |
2468 | 45 | if engine_name in available_engines: | 72 | if engine_name in available_engines: |
2469 | 73 | <<<<<<< TREE | ||
2470 | 46 | if get_active_input_engines() != [engine_name]: | 74 | if get_active_input_engines() != [engine_name]: |
2471 | 47 | IBusTests._old_engines = set_active_engines([engine_name]) | 75 | IBusTests._old_engines = set_active_engines([engine_name]) |
2472 | 76 | ======= | ||
2473 | 77 | cls._old_engines = set_active_engines([engine_name]) | ||
2474 | 78 | >>>>>>> MERGE-SOURCE | ||
2475 | 48 | else: | 79 | else: |
2476 | 80 | <<<<<<< TREE | ||
2477 | 49 | self.skip("This test requires the '%s' engine to be installed." % (engine_name)) | 81 | self.skip("This test requires the '%s' engine to be installed." % (engine_name)) |
2478 | 50 | 82 | ||
2479 | 51 | def activate_ibus(self, widget): | 83 | def activate_ibus(self, widget): |
2480 | @@ -81,6 +113,43 @@ | |||
2481 | 81 | self.keyboard.press_and_release(commit_key) | 113 | self.keyboard.press_and_release(commit_key) |
2482 | 82 | self.deactivate_ibus(self.hud.searchbar) | 114 | self.deactivate_ibus(self.hud.searchbar) |
2483 | 83 | self.assertThat(self.hud.search_string, Eventually(Equals(self.result))) | 115 | self.assertThat(self.hud.search_string, Eventually(Equals(self.result))) |
2484 | 116 | ======= | ||
2485 | 117 | raise AutopilotTestCase.skipException("This test requires the '%s' engine to be installed." % (engine_name)) | ||
2486 | 118 | |||
2487 | 119 | def activate_ibus(self, widget): | ||
2488 | 120 | """Activate IBus, and wait till it's actived on 'widget'""" | ||
2489 | 121 | self.assertThat(widget.im_active, Equals(False)) | ||
2490 | 122 | self.keyboard.press_and_release('Ctrl+Space', 0.05) | ||
2491 | 123 | self.assertThat(widget.im_active, Eventually(Equals(True))) | ||
2492 | 124 | |||
2493 | 125 | def deactivate_ibus(self, widget): | ||
2494 | 126 | """Deactivate ibus, and wait till it's inactive on 'widget'""" | ||
2495 | 127 | self.assertThat(widget.im_active, Equals(True)) | ||
2496 | 128 | self.keyboard.press_and_release('Ctrl+Space', 0.05) | ||
2497 | 129 | self.assertThat(widget.im_active, Eventually(Equals(False))) | ||
2498 | 130 | |||
2499 | 131 | def do_dash_test_with_engine(self): | ||
2500 | 132 | self.dash.ensure_visible() | ||
2501 | 133 | self.addCleanup(self.dash.ensure_hidden) | ||
2502 | 134 | self.activate_ibus(self.dash.searchbar) | ||
2503 | 135 | self.keyboard.type(self.input) | ||
2504 | 136 | commit_key = getattr(self, 'commit_key', None) | ||
2505 | 137 | if commit_key: | ||
2506 | 138 | self.keyboard.press_and_release(commit_key) | ||
2507 | 139 | self.deactivate_ibus(self.dash.searchbar) | ||
2508 | 140 | self.assertThat(self.dash.search_string, Eventually(Equals(self.result))) | ||
2509 | 141 | |||
2510 | 142 | def do_hud_test_with_engine(self): | ||
2511 | 143 | self.hud.ensure_visible() | ||
2512 | 144 | self.addCleanup(self.hud.ensure_hidden) | ||
2513 | 145 | self.activate_ibus(self.hud.searchbar) | ||
2514 | 146 | self.keyboard.type(self.input) | ||
2515 | 147 | commit_key = getattr(self, 'commit_key', None) | ||
2516 | 148 | if commit_key: | ||
2517 | 149 | self.keyboard.press_and_release(commit_key) | ||
2518 | 150 | self.deactivate_ibus(self.hud.searchbar) | ||
2519 | 151 | self.assertThat(self.hud.search_string, Eventually(Equals(self.result))) | ||
2520 | 152 | >>>>>>> MERGE-SOURCE | ||
2521 | 84 | 153 | ||
2522 | 85 | 154 | ||
2523 | 86 | class IBusTestsPinyin(IBusTests): | 155 | class IBusTestsPinyin(IBusTests): |
2524 | @@ -160,12 +229,17 @@ | |||
2525 | 160 | class IBusTestsPinyinIgnore(IBusTests): | 229 | class IBusTestsPinyinIgnore(IBusTests): |
2526 | 161 | """Tests for ignoring key events while the Pinyin input engine is active.""" | 230 | """Tests for ignoring key events while the Pinyin input engine is active.""" |
2527 | 162 | 231 | ||
2528 | 232 | <<<<<<< TREE | ||
2529 | 163 | engine_name = "pinyin" | 233 | engine_name = "pinyin" |
2530 | 164 | 234 | ||
2531 | 165 | def setUp(self): | 235 | def setUp(self): |
2532 | 166 | super(IBusTestsPinyinIgnore, self).setUp() | 236 | super(IBusTestsPinyinIgnore, self).setUp() |
2533 | 167 | self.activate_input_engine_or_skip(self.engine_name) | 237 | self.activate_input_engine_or_skip(self.engine_name) |
2534 | 168 | 238 | ||
2535 | 239 | ======= | ||
2536 | 240 | engine_name = "pinyin" | ||
2537 | 241 | |||
2538 | 242 | >>>>>>> MERGE-SOURCE | ||
2539 | 169 | def test_ignore_key_events_on_dash(self): | 243 | def test_ignore_key_events_on_dash(self): |
2540 | 170 | self.dash.ensure_visible() | 244 | self.dash.ensure_visible() |
2541 | 171 | self.addCleanup(self.dash.ensure_hidden) | 245 | self.addCleanup(self.dash.ensure_hidden) |
2542 | @@ -194,12 +268,17 @@ | |||
2543 | 194 | class IBusTestsAnthyIgnore(IBusTests): | 268 | class IBusTestsAnthyIgnore(IBusTests): |
2544 | 195 | """Tests for ignoring key events while the Anthy input engine is active.""" | 269 | """Tests for ignoring key events while the Anthy input engine is active.""" |
2545 | 196 | 270 | ||
2546 | 271 | <<<<<<< TREE | ||
2547 | 197 | engine_name = "anthy" | 272 | engine_name = "anthy" |
2548 | 198 | 273 | ||
2549 | 199 | def setUp(self): | 274 | def setUp(self): |
2550 | 200 | super(IBusTestsAnthyIgnore, self).setUp() | 275 | super(IBusTestsAnthyIgnore, self).setUp() |
2551 | 201 | self.activate_input_engine_or_skip(self.engine_name) | 276 | self.activate_input_engine_or_skip(self.engine_name) |
2552 | 202 | 277 | ||
2553 | 278 | ======= | ||
2554 | 279 | engine_name = "anthy" | ||
2555 | 280 | |||
2556 | 281 | >>>>>>> MERGE-SOURCE | ||
2557 | 203 | def test_ignore_key_events_on_dash(self): | 282 | def test_ignore_key_events_on_dash(self): |
2558 | 204 | self.dash.ensure_visible() | 283 | self.dash.ensure_visible() |
2559 | 205 | self.addCleanup(self.dash.ensure_hidden) | 284 | self.addCleanup(self.dash.ensure_hidden) |
2560 | 206 | 285 | ||
2561 | === modified file 'tests/autopilot/unity/tests/test_launcher.py' | |||
2562 | --- tests/autopilot/unity/tests/test_launcher.py 2012-05-17 22:49:33 +0000 | |||
2563 | +++ tests/autopilot/unity/tests/test_launcher.py 2012-05-24 17:16:22 +0000 | |||
2564 | @@ -19,9 +19,17 @@ | |||
2565 | 19 | from testtools.matchers import Equals, NotEquals, LessThan, GreaterThan | 19 | from testtools.matchers import Equals, NotEquals, LessThan, GreaterThan |
2566 | 20 | from time import sleep | 20 | from time import sleep |
2567 | 21 | 21 | ||
2568 | 22 | <<<<<<< TREE | ||
2569 | 22 | from unity.emulators.icons import BFBLauncherIcon | 23 | from unity.emulators.icons import BFBLauncherIcon |
2570 | 23 | from unity.emulators.switcher import SwitcherMode | 24 | from unity.emulators.switcher import SwitcherMode |
2571 | 24 | from unity.tests import UnityTestCase | 25 | from unity.tests import UnityTestCase |
2572 | 26 | ======= | ||
2573 | 27 | from autopilot.emulators.bamf import Bamf | ||
2574 | 28 | from autopilot.emulators.unity.icons import BFBLauncherIcon | ||
2575 | 29 | from autopilot.emulators.X11 import ScreenGeometry | ||
2576 | 30 | from autopilot.matchers import Eventually | ||
2577 | 31 | from autopilot.tests import AutopilotTestCase, multiply_scenarios | ||
2578 | 32 | >>>>>>> MERGE-SOURCE | ||
2579 | 25 | 33 | ||
2580 | 26 | logger = logging.getLogger(__name__) | 34 | logger = logging.getLogger(__name__) |
2581 | 27 | 35 | ||
2582 | @@ -41,8 +49,13 @@ | |||
2583 | 41 | ('launcher on all', {'only_primary': False})] | 49 | ('launcher on all', {'only_primary': False})] |
2584 | 42 | return multiply_scenarios(monitor_scenarios, launcher_mode_scenarios) | 50 | return multiply_scenarios(monitor_scenarios, launcher_mode_scenarios) |
2585 | 43 | 51 | ||
2586 | 52 | <<<<<<< TREE | ||
2587 | 44 | 53 | ||
2588 | 45 | class LauncherTestCase(UnityTestCase): | 54 | class LauncherTestCase(UnityTestCase): |
2589 | 55 | ======= | ||
2590 | 56 | |||
2591 | 57 | class LauncherTestCase(AutopilotTestCase): | ||
2592 | 58 | >>>>>>> MERGE-SOURCE | ||
2593 | 46 | """A base class for all launcher tests that uses scenarios to run on | 59 | """A base class for all launcher tests that uses scenarios to run on |
2594 | 47 | each launcher (for multi-monitor setups). | 60 | each launcher (for multi-monitor setups). |
2595 | 48 | """ | 61 | """ |
2596 | @@ -381,9 +394,15 @@ | |||
2597 | 381 | def test_launcher_keynav_alt_grave_quits(self): | 394 | def test_launcher_keynav_alt_grave_quits(self): |
2598 | 382 | """Tests that alt+` exits keynav mode.""" | 395 | """Tests that alt+` exits keynav mode.""" |
2599 | 383 | 396 | ||
2600 | 397 | <<<<<<< TREE | ||
2601 | 384 | # Can't use switcher emulat here since the switcher won't appear. | 398 | # Can't use switcher emulat here since the switcher won't appear. |
2602 | 385 | self.keybinding("switcher/reveal_details") | 399 | self.keybinding("switcher/reveal_details") |
2603 | 386 | self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False))) | 400 | self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False))) |
2604 | 401 | ======= | ||
2605 | 402 | self.switcher.initiate_detail_mode() | ||
2606 | 403 | self.addCleanup(self.switcher.terminate) | ||
2607 | 404 | self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False))) | ||
2608 | 405 | >>>>>>> MERGE-SOURCE | ||
2609 | 387 | 406 | ||
2610 | 388 | 407 | ||
2611 | 389 | class LauncherIconsBehaviorTests(LauncherTestCase): | 408 | class LauncherIconsBehaviorTests(LauncherTestCase): |
2612 | @@ -586,6 +605,7 @@ | |||
2613 | 586 | self.mouse.move(x + w/2, y + h/2) | 605 | self.mouse.move(x + w/2, y + h/2) |
2614 | 587 | sleep(.5) | 606 | sleep(.5) |
2615 | 588 | for icon in self.launcher.model.get_launcher_icons(): | 607 | for icon in self.launcher.model.get_launcher_icons(): |
2616 | 608 | <<<<<<< TREE | ||
2617 | 589 | self.assertThat(icon.desaturated, Eventually(Equals(False))) | 609 | self.assertThat(icon.desaturated, Eventually(Equals(False))) |
2618 | 590 | 610 | ||
2619 | 591 | class BamfDaemonTests(LauncherTestCase): | 611 | class BamfDaemonTests(LauncherTestCase): |
2620 | @@ -685,6 +705,107 @@ | |||
2621 | 685 | 705 | ||
2622 | 686 | 706 | ||
2623 | 687 | class LauncherCaptureTests(UnityTestCase): | 707 | class LauncherCaptureTests(UnityTestCase): |
2624 | 708 | ======= | ||
2625 | 709 | self.assertThat(icon.desaturated, Eventually(Equals(False))) | ||
2626 | 710 | |||
2627 | 711 | class BamfDaemonTests(LauncherTestCase): | ||
2628 | 712 | """Test interaction between the launcher and the BAMF Daemon.""" | ||
2629 | 713 | |||
2630 | 714 | def start_test_apps(self): | ||
2631 | 715 | """Starts some test applications.""" | ||
2632 | 716 | self.start_app("Calculator") | ||
2633 | 717 | self.start_app("System Settings") | ||
2634 | 718 | |||
2635 | 719 | def start_desktopless_test_apps(self): | ||
2636 | 720 | """Start test applications with no .desktop file associated.""" | ||
2637 | 721 | test_apps = ["xclock"] | ||
2638 | 722 | |||
2639 | 723 | for app in test_apps: | ||
2640 | 724 | os.spawnlp(os.P_NOWAIT, app, app) | ||
2641 | 725 | self.addCleanup(call, ["killall", app]) | ||
2642 | 726 | self.wait_for_process_started(app) | ||
2643 | 727 | |||
2644 | 728 | def get_test_apps(self): | ||
2645 | 729 | """Return a tuple of test application instances. | ||
2646 | 730 | |||
2647 | 731 | We don't store these since when we kill the bamf daemon all references | ||
2648 | 732 | to the old apps will die. | ||
2649 | 733 | |||
2650 | 734 | """ | ||
2651 | 735 | [calc] = self.get_app_instances("Calculator") | ||
2652 | 736 | [sys_settings] = self.get_app_instances("System Settings") | ||
2653 | 737 | return [calc, sys_settings] | ||
2654 | 738 | |||
2655 | 739 | def get_desktopless_test_apps(self): | ||
2656 | 740 | """Return a tuple of test application with no .desktop files instances.""" | ||
2657 | 741 | [xclock_win] = [w for w in self.bamf.get_open_windows() if w.name == "xclock"] | ||
2658 | 742 | return [xclock_win.application] | ||
2659 | 743 | |||
2660 | 744 | def assertOnlyOneLauncherIcon(self, **kwargs): | ||
2661 | 745 | """Asserts that there is only one launcher icon with the given filter.""" | ||
2662 | 746 | icons = self.launcher.model.get_icons_by_filter(**kwargs) | ||
2663 | 747 | self.assertThat(len(icons), Equals(1)) | ||
2664 | 748 | |||
2665 | 749 | def wait_for_process_started(self, app): | ||
2666 | 750 | """Wait until the application app has been started.""" | ||
2667 | 751 | for i in range(10): | ||
2668 | 752 | sleep(1) | ||
2669 | 753 | #pgrep returns 0 if it matched something: | ||
2670 | 754 | if call(["pgrep", app]) == 0: | ||
2671 | 755 | return | ||
2672 | 756 | |||
2673 | 757 | def wait_for_process_killed(self, app): | ||
2674 | 758 | """Wait until the application app has been killed.""" | ||
2675 | 759 | for i in range(10): | ||
2676 | 760 | #pgrep returns 0 if it matched something: | ||
2677 | 761 | if call(["pgrep", app]) != 0: | ||
2678 | 762 | return | ||
2679 | 763 | sleep(1) | ||
2680 | 764 | |||
2681 | 765 | def kill_and_restart_bamfdaemon(self): | ||
2682 | 766 | """Kills and resumes bamfdaemon.""" | ||
2683 | 767 | call(["pkill", "bamfdaemon"]) | ||
2684 | 768 | self.wait_for_process_killed("bamfdaemon") | ||
2685 | 769 | |||
2686 | 770 | # trigger the bamfdaemon to be reloaded again, and wait for it to appear: | ||
2687 | 771 | self.bamf = Bamf() | ||
2688 | 772 | self.wait_for_process_started("bamfdaemon") | ||
2689 | 773 | |||
2690 | 774 | def test_killing_bamfdaemon_does_not_duplicate_desktop_ids(self): | ||
2691 | 775 | """Killing bamfdaemon should not duplicate any desktop ids in the model.""" | ||
2692 | 776 | self.start_test_apps() | ||
2693 | 777 | self.kill_and_restart_bamfdaemon() | ||
2694 | 778 | |||
2695 | 779 | for test_app in self.get_test_apps(): | ||
2696 | 780 | logger.info("Checking for duplicated launcher icon for application %s", test_app.name) | ||
2697 | 781 | self.assertOnlyOneLauncherIcon(desktop_id=test_app.desktop_file) | ||
2698 | 782 | |||
2699 | 783 | def test_killing_bamfdaemon_does_not_duplicate_application_xids(self): | ||
2700 | 784 | """Killing bamfdaemon should not duplicate any xid in the model.""" | ||
2701 | 785 | self.start_test_apps() | ||
2702 | 786 | self.start_desktopless_test_apps() | ||
2703 | 787 | self.kill_and_restart_bamfdaemon() | ||
2704 | 788 | |||
2705 | 789 | test_apps = self.get_test_apps() + self.get_desktopless_test_apps() | ||
2706 | 790 | |||
2707 | 791 | for test_app in test_apps: | ||
2708 | 792 | logger.info("Checking for duplicated launcher icon for application %s", test_app.name) | ||
2709 | 793 | test_windows = [w.x_id for w in test_app.get_windows()] | ||
2710 | 794 | self.assertOnlyOneLauncherIcon(xids=test_windows) | ||
2711 | 795 | |||
2712 | 796 | def test_killing_bamfdaemon_does_not_duplicate_any_icon_application_id(self): | ||
2713 | 797 | """Killing bamfdaemon should not duplicate any application ids in the model.""" | ||
2714 | 798 | self.start_test_apps() | ||
2715 | 799 | self.start_desktopless_test_apps() | ||
2716 | 800 | self.kill_and_restart_bamfdaemon() | ||
2717 | 801 | |||
2718 | 802 | for icon in self.launcher.model.get_bamf_launcher_icons(): | ||
2719 | 803 | logger.info("Checking for duplicated launcher icon %s", icon.tooltip_text) | ||
2720 | 804 | self.assertOnlyOneLauncherIcon(application_id=icon.application_id) | ||
2721 | 805 | |||
2722 | 806 | |||
2723 | 807 | class LauncherCaptureTests(AutopilotTestCase): | ||
2724 | 808 | >>>>>>> MERGE-SOURCE | ||
2725 | 688 | """Test the launchers ability to capture/not capture the mouse.""" | 809 | """Test the launchers ability to capture/not capture the mouse.""" |
2726 | 689 | 810 | ||
2727 | 690 | screen_geo = ScreenGeometry() | 811 | screen_geo = ScreenGeometry() |
2728 | @@ -783,6 +904,7 @@ | |||
2729 | 783 | x_fin, y_fin = self.mouse.position() | 904 | x_fin, y_fin = self.mouse.position() |
2730 | 784 | # The launcher should have held the mouse a little bit | 905 | # The launcher should have held the mouse a little bit |
2731 | 785 | self.assertThat(x_fin, LessThan(x + width * 1.5)) | 906 | self.assertThat(x_fin, LessThan(x + width * 1.5)) |
2732 | 907 | <<<<<<< TREE | ||
2733 | 786 | 908 | ||
2734 | 787 | 909 | ||
2735 | 788 | class LauncherTooltipTests(UnityTestCase): | 910 | class LauncherTooltipTests(UnityTestCase): |
2736 | @@ -811,3 +933,33 @@ | |||
2737 | 811 | self.mouse.move(bfb.center_x, bfb.center_y) | 933 | self.mouse.move(bfb.center_x, bfb.center_y) |
2738 | 812 | 934 | ||
2739 | 813 | self.assertThat(bfb.get_tooltip().active, Eventually(Equals(False))) | 935 | self.assertThat(bfb.get_tooltip().active, Eventually(Equals(False))) |
2740 | 936 | ======= | ||
2741 | 937 | |||
2742 | 938 | |||
2743 | 939 | class LauncherTooltipTests(AutopilotTestCase): | ||
2744 | 940 | """Test the launcher tooltips""" | ||
2745 | 941 | |||
2746 | 942 | def setUp(self): | ||
2747 | 943 | super(LauncherTooltipTests, self).setUp() | ||
2748 | 944 | self.set_unity_option('launcher_hide_mode', 0) | ||
2749 | 945 | |||
2750 | 946 | def test_bfb_tooltip_disappear_when_dash_is_opened(self): | ||
2751 | 947 | """Tests that the bfb tooltip disappear when the dash is opened.""" | ||
2752 | 948 | bfb = self.launcher.model.get_bfb_icon() | ||
2753 | 949 | self.mouse.move(bfb.center_x, bfb.center_y) | ||
2754 | 950 | |||
2755 | 951 | self.dash.ensure_visible() | ||
2756 | 952 | self.addCleanup(self.dash.ensure_hidden) | ||
2757 | 953 | |||
2758 | 954 | self.assertThat(bfb.get_tooltip().active, Eventually(Equals(False))) | ||
2759 | 955 | |||
2760 | 956 | def test_bfb_tooltip_is_disabled_when_dash_is_open(self): | ||
2761 | 957 | """Tests the that bfb tooltip is disabled when the dash is open.""" | ||
2762 | 958 | self.dash.ensure_visible() | ||
2763 | 959 | self.addCleanup(self.dash.ensure_hidden) | ||
2764 | 960 | |||
2765 | 961 | bfb = self.launcher.model.get_bfb_icon() | ||
2766 | 962 | self.mouse.move(bfb.center_x, bfb.center_y) | ||
2767 | 963 | |||
2768 | 964 | self.assertThat(bfb.get_tooltip().active, Eventually(Equals(False))) | ||
2769 | 965 | >>>>>>> MERGE-SOURCE | ||
2770 | 814 | 966 | ||
2771 | === modified file 'tests/autopilot/unity/tests/test_panel.py' | |||
2772 | --- tests/autopilot/unity/tests/test_panel.py 2012-05-08 16:13:17 +0000 | |||
2773 | +++ tests/autopilot/unity/tests/test_panel.py 2012-05-24 17:16:22 +0000 | |||
2774 | @@ -19,6 +19,7 @@ | |||
2775 | 19 | from unity.tests import UnityTestCase | 19 | from unity.tests import UnityTestCase |
2776 | 20 | 20 | ||
2777 | 21 | 21 | ||
2778 | 22 | |||
2779 | 22 | logger = logging.getLogger(__name__) | 23 | logger = logging.getLogger(__name__) |
2780 | 23 | 24 | ||
2781 | 24 | 25 | ||
2782 | 25 | 26 | ||
2783 | === modified file 'tests/autopilot/unity/tests/test_quicklist.py' | |||
2784 | --- tests/autopilot/unity/tests/test_quicklist.py 2012-05-17 23:16:25 +0000 | |||
2785 | +++ tests/autopilot/unity/tests/test_quicklist.py 2012-05-24 17:16:22 +0000 | |||
2786 | @@ -13,6 +13,7 @@ | |||
2787 | 13 | import os.path | 13 | import os.path |
2788 | 14 | from testtools.matchers import Contains, Equals, NotEquals | 14 | from testtools.matchers import Contains, Equals, NotEquals |
2789 | 15 | from xdg.DesktopEntry import DesktopEntry | 15 | from xdg.DesktopEntry import DesktopEntry |
2790 | 16 | <<<<<<< TREE | ||
2791 | 16 | from time import sleep | 17 | from time import sleep |
2792 | 17 | 18 | ||
2793 | 18 | from unity.emulators.quicklist import QuicklistMenuItemLabel | 19 | from unity.emulators.quicklist import QuicklistMenuItemLabel |
2794 | @@ -20,12 +21,23 @@ | |||
2795 | 20 | 21 | ||
2796 | 21 | 22 | ||
2797 | 22 | class QuicklistActionTests(UnityTestCase): | 23 | class QuicklistActionTests(UnityTestCase): |
2798 | 24 | ======= | ||
2799 | 25 | from time import sleep | ||
2800 | 26 | |||
2801 | 27 | from autopilot.emulators.unity.quicklist import QuicklistMenuItemLabel | ||
2802 | 28 | from autopilot.matchers import Eventually | ||
2803 | 29 | from autopilot.tests import AutopilotTestCase | ||
2804 | 30 | |||
2805 | 31 | |||
2806 | 32 | class QuicklistActionTests(AutopilotTestCase): | ||
2807 | 33 | >>>>>>> MERGE-SOURCE | ||
2808 | 23 | """Tests for quicklist actions.""" | 34 | """Tests for quicklist actions.""" |
2809 | 24 | 35 | ||
2810 | 25 | scenarios = [ | 36 | scenarios = [ |
2811 | 26 | ('remmina', {'app_name': 'Remmina'}), | 37 | ('remmina', {'app_name': 'Remmina'}), |
2812 | 27 | ] | 38 | ] |
2813 | 28 | 39 | ||
2814 | 40 | <<<<<<< TREE | ||
2815 | 29 | def open_quicklist_for_icon(self, launcher_icon): | 41 | def open_quicklist_for_icon(self, launcher_icon): |
2816 | 30 | """Open the quicklist for the given launcher icon. | 42 | """Open the quicklist for the given launcher icon. |
2817 | 31 | 43 | ||
2818 | @@ -41,6 +53,13 @@ | |||
2819 | 41 | return ql | 53 | return ql |
2820 | 42 | sleep(1) | 54 | sleep(1) |
2821 | 43 | 55 | ||
2822 | 56 | ======= | ||
2823 | 57 | def open_quicklist_for_icon(self, launcher_icon): | ||
2824 | 58 | launcher = self.launcher.get_launcher_for_monitor(0) | ||
2825 | 59 | launcher.click_launcher_icon(launcher_icon, button=3) | ||
2826 | 60 | self.addCleanup(self.keyboard.press_and_release, "Escape") | ||
2827 | 61 | |||
2828 | 62 | >>>>>>> MERGE-SOURCE | ||
2829 | 44 | def test_quicklist_actions(self): | 63 | def test_quicklist_actions(self): |
2830 | 45 | """Test that all actions present in the destop file are shown in the quicklist.""" | 64 | """Test that all actions present in the destop file are shown in the quicklist.""" |
2831 | 46 | self.start_app(self.app_name) | 65 | self.start_app(self.app_name) |
2832 | @@ -54,7 +73,12 @@ | |||
2833 | 54 | self.assertThat(launcher_icon, NotEquals(None)) | 73 | self.assertThat(launcher_icon, NotEquals(None)) |
2834 | 55 | 74 | ||
2835 | 56 | # open the icon quicklist, and get all the text labels: | 75 | # open the icon quicklist, and get all the text labels: |
2836 | 76 | <<<<<<< TREE | ||
2837 | 57 | ql = self.open_quicklist_for_icon(launcher_icon) | 77 | ql = self.open_quicklist_for_icon(launcher_icon) |
2838 | 78 | ======= | ||
2839 | 79 | self.open_quicklist_for_icon(launcher_icon) | ||
2840 | 80 | ql = launcher_icon.get_quicklist() | ||
2841 | 81 | >>>>>>> MERGE-SOURCE | ||
2842 | 58 | ql_item_texts = [i.text for i in ql.items if type(i) is QuicklistMenuItemLabel] | 82 | ql_item_texts = [i.text for i in ql.items if type(i) is QuicklistMenuItemLabel] |
2843 | 59 | 83 | ||
2844 | 60 | # iterate over all the actions from the desktop file, make sure they're | 84 | # iterate over all the actions from the desktop file, make sure they're |
2845 | @@ -67,6 +91,7 @@ | |||
2846 | 67 | name = de.content[key]['Name'] | 91 | name = de.content[key]['Name'] |
2847 | 68 | self.assertThat(ql_item_texts, Contains(name)) | 92 | self.assertThat(ql_item_texts, Contains(name)) |
2848 | 69 | 93 | ||
2849 | 94 | <<<<<<< TREE | ||
2850 | 70 | def test_quicklist_application_item_focus_last_active_window(self): | 95 | def test_quicklist_application_item_focus_last_active_window(self): |
2851 | 71 | """This tests shows that when you activate a quicklist application item | 96 | """This tests shows that when you activate a quicklist application item |
2852 | 72 | only the last focused instance of that application is rasied. | 97 | only the last focused instance of that application is rasied. |
2853 | @@ -335,3 +360,276 @@ | |||
2854 | 335 | mouse_item.mouse_move_to() | 360 | mouse_item.mouse_move_to() |
2855 | 336 | self.assertThat(mouse_item.selected, Eventually(Equals(True))) | 361 | self.assertThat(mouse_item.selected, Eventually(Equals(True))) |
2856 | 337 | self.assertThat(self.quicklist.selected_item.id, Equals(mouse_item.id)) | 362 | self.assertThat(self.quicklist.selected_item.id, Equals(mouse_item.id)) |
2857 | 363 | ======= | ||
2858 | 364 | def test_quicklist_application_item_focus_last_active_window(self): | ||
2859 | 365 | """This tests shows that when you activate a quicklist application item | ||
2860 | 366 | only the last focused instance of that application is rasied. | ||
2861 | 367 | |||
2862 | 368 | This is tested by opening 2 Mahjongg and a Calculator. | ||
2863 | 369 | Then we activate the Calculator quicklist item. | ||
2864 | 370 | Then we actiavte the Mahjongg launcher icon. | ||
2865 | 371 | """ | ||
2866 | 372 | mahj = self.start_app("Mahjongg") | ||
2867 | 373 | [mah_win1] = mahj.get_windows() | ||
2868 | 374 | self.assertTrue(mah_win1.is_focused) | ||
2869 | 375 | |||
2870 | 376 | calc = self.start_app("Calculator") | ||
2871 | 377 | [calc_win] = calc.get_windows() | ||
2872 | 378 | self.assertTrue(calc_win.is_focused) | ||
2873 | 379 | |||
2874 | 380 | self.start_app("Mahjongg") | ||
2875 | 381 | # Sleeping due to the start_app only waiting for the bamf model to be | ||
2876 | 382 | # updated with the application. Since the app has already started, | ||
2877 | 383 | # and we are just waiting on a second window, however a defined sleep | ||
2878 | 384 | # here is likely to be problematic. | ||
2879 | 385 | # TODO: fix bamf emulator to enable waiting for new windows. | ||
2880 | 386 | sleep(1) | ||
2881 | 387 | [mah_win2] = [w for w in mahj.get_windows() if w.x_id != mah_win1.x_id] | ||
2882 | 388 | self.assertTrue(mah_win2.is_focused) | ||
2883 | 389 | |||
2884 | 390 | self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1]) | ||
2885 | 391 | |||
2886 | 392 | mahj_icon = self.launcher.model.get_icon_by_desktop_id(mahj.desktop_file) | ||
2887 | 393 | calc_icon = self.launcher.model.get_icon_by_desktop_id(calc.desktop_file) | ||
2888 | 394 | |||
2889 | 395 | self.open_quicklist_for_icon(calc_icon) | ||
2890 | 396 | calc_ql = calc_icon.get_quicklist() | ||
2891 | 397 | calc_ql.get_quicklist_application_item(calc.name).mouse_click() | ||
2892 | 398 | sleep(1) | ||
2893 | 399 | self.assertTrue(calc_win.is_focused) | ||
2894 | 400 | self.assertVisibleWindowStack([calc_win, mah_win2, mah_win1]) | ||
2895 | 401 | |||
2896 | 402 | self.open_quicklist_for_icon(mahj_icon) | ||
2897 | 403 | mahj_ql = mahj_icon.get_quicklist() | ||
2898 | 404 | mahj_ql.get_quicklist_application_item(mahj.name).mouse_click() | ||
2899 | 405 | sleep(1) | ||
2900 | 406 | self.assertTrue(mah_win2.is_focused) | ||
2901 | 407 | self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1]) | ||
2902 | 408 | |||
2903 | 409 | def test_quicklist_application_item_initiate_spread(self): | ||
2904 | 410 | """This tests shows that when you activate a quicklist application item | ||
2905 | 411 | when an application window is focused, the spread is initiated. | ||
2906 | 412 | """ | ||
2907 | 413 | calc = self.start_app("Calculator") | ||
2908 | 414 | [calc_win1] = calc.get_windows() | ||
2909 | 415 | self.assertTrue(calc_win1.is_focused) | ||
2910 | 416 | |||
2911 | 417 | self.start_app("Calculator") | ||
2912 | 418 | # Sleeping due to the start_app only waiting for the bamf model to be | ||
2913 | 419 | # updated with the application. Since the app has already started, | ||
2914 | 420 | # and we are just waiting on a second window, however a defined sleep | ||
2915 | 421 | # here is likely to be problematic. | ||
2916 | 422 | # TODO: fix bamf emulator to enable waiting for new windows. | ||
2917 | 423 | sleep(1) | ||
2918 | 424 | [calc_win2] = [w for w in calc.get_windows() if w.x_id != calc_win1.x_id] | ||
2919 | 425 | |||
2920 | 426 | self.assertVisibleWindowStack([calc_win2, calc_win1]) | ||
2921 | 427 | self.assertTrue(calc_win2.is_focused) | ||
2922 | 428 | |||
2923 | 429 | calc_icon = self.launcher.model.get_icon_by_desktop_id(calc.desktop_file) | ||
2924 | 430 | |||
2925 | 431 | self.open_quicklist_for_icon(calc_icon) | ||
2926 | 432 | calc_ql = calc_icon.get_quicklist() | ||
2927 | 433 | app_item = calc_ql.get_quicklist_application_item(calc.name) | ||
2928 | 434 | |||
2929 | 435 | self.addCleanup(self.keybinding, "spread/cancel") | ||
2930 | 436 | app_item.mouse_click() | ||
2931 | 437 | self.assertThat(self.window_manager.scale_active, Eventually(Equals(True))) | ||
2932 | 438 | self.assertThat(self.window_manager.scale_active_for_group, Eventually(Equals(True))) | ||
2933 | 439 | |||
2934 | 440 | |||
2935 | 441 | class QuicklistKeyNavigationTests(AutopilotTestCase): | ||
2936 | 442 | """Tests for the quicklist key navigation.""" | ||
2937 | 443 | |||
2938 | 444 | def setUp(self): | ||
2939 | 445 | super(QuicklistKeyNavigationTests, self).setUp() | ||
2940 | 446 | |||
2941 | 447 | self.ql_app = self.start_app("Text Editor") | ||
2942 | 448 | |||
2943 | 449 | self.ql_launcher_icon = self.launcher.model.get_icon_by_desktop_id(self.ql_app.desktop_file) | ||
2944 | 450 | self.assertThat(self.ql_launcher_icon, NotEquals(None)) | ||
2945 | 451 | |||
2946 | 452 | self.ql_launcher = self.launcher.get_launcher_for_monitor(0) | ||
2947 | 453 | |||
2948 | 454 | def open_quicklist_with_mouse(self): | ||
2949 | 455 | """Opens a quicklist with the mouse.""" | ||
2950 | 456 | self.ql_launcher.click_launcher_icon(self.ql_launcher_icon, button=3) | ||
2951 | 457 | self.addCleanup(self.keyboard.press_and_release, "Escape") | ||
2952 | 458 | self.quicklist = self.ql_launcher_icon.get_quicklist() | ||
2953 | 459 | self.assertThat(self.quicklist, NotEquals(None)) | ||
2954 | 460 | self.quicklist.move_mouse_to_right() | ||
2955 | 461 | self.assertThat(self.quicklist.selected_item, Equals(None)) | ||
2956 | 462 | |||
2957 | 463 | def open_quicklist_with_keyboard(self): | ||
2958 | 464 | """Opens a quicklist using the keyboard.""" | ||
2959 | 465 | self.screen_geo.move_mouse_to_monitor(0) | ||
2960 | 466 | self.ql_launcher.key_nav_start() | ||
2961 | 467 | self.addCleanup(self.ql_launcher.key_nav_cancel) | ||
2962 | 468 | |||
2963 | 469 | for icon in self.launcher.model.get_launcher_icons(): | ||
2964 | 470 | if icon.tooltip_text != self.ql_app.name: | ||
2965 | 471 | self.ql_launcher.key_nav_next() | ||
2966 | 472 | else: | ||
2967 | 473 | self.keybinding("launcher/keynav/open-quicklist") | ||
2968 | 474 | self.addCleanup(self.keybinding, "launcher/keynav/close-quicklist") | ||
2969 | 475 | break | ||
2970 | 476 | |||
2971 | 477 | self.quicklist = self.ql_launcher_icon.get_quicklist() | ||
2972 | 478 | self.assertThat(self.quicklist, NotEquals(None)) | ||
2973 | 479 | self.assertThat(self.quicklist.selected_item, NotEquals(None)) | ||
2974 | 480 | |||
2975 | 481 | def test_keynav_selects_first_item_when_unselected(self): | ||
2976 | 482 | """Home key MUST select the first selectable item in a quicklist.""" | ||
2977 | 483 | self.open_quicklist_with_mouse() | ||
2978 | 484 | |||
2979 | 485 | self.keybinding("quicklist/keynav/first") | ||
2980 | 486 | |||
2981 | 487 | expected_item = self.quicklist.selectable_items[0] | ||
2982 | 488 | self.assertThat(expected_item.selected, Eventually(Equals(True))) | ||
2983 | 489 | self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id)) | ||
2984 | 490 | |||
2985 | 491 | def test_keynav_selects_first_item_when_selected(self): | ||
2986 | 492 | """Home key MUST select the first selectable item in a quicklist when | ||
2987 | 493 | another item is selected. | ||
2988 | 494 | """ | ||
2989 | 495 | self.open_quicklist_with_mouse() | ||
2990 | 496 | mouse_item = self.quicklist.selectable_items[-1] | ||
2991 | 497 | mouse_item.mouse_move_to() | ||
2992 | 498 | self.assertThat(mouse_item.selected, Eventually(Equals(True))) | ||
2993 | 499 | |||
2994 | 500 | self.keybinding("quicklist/keynav/first") | ||
2995 | 501 | |||
2996 | 502 | expected_item = self.quicklist.selectable_items[0] | ||
2997 | 503 | self.assertThat(expected_item.selected, Eventually(Equals(True))) | ||
2998 | 504 | self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id)) | ||
2999 | 505 | |||
3000 | 506 | def test_keynav_next_selects_first_item_when_unselected(self): | ||
3001 | 507 | """Down key MUST select the first valid item when nothing is selected.""" | ||
3002 | 508 | self.open_quicklist_with_mouse() | ||
3003 | 509 | |||
3004 | 510 | self.keybinding("quicklist/keynav/next") | ||
3005 | 511 | |||
3006 | 512 | expected_item = self.quicklist.selectable_items[0] | ||
3007 | 513 | self.assertThat(expected_item.selected, Eventually(Equals(True))) | ||
3008 | 514 | self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id)) | ||
3009 | 515 | |||
3010 | 516 | def test_keynav_selects_last_item_when_unselected(self): | ||
3011 | 517 | """End key MUST select the last selectable item in a quicklist.""" | ||
3012 | 518 | self.open_quicklist_with_mouse() | ||
3013 | 519 | |||
3014 | 520 | self.keybinding("quicklist/keynav/last") | ||
3015 | 521 | |||
3016 | 522 | expected_item = self.quicklist.selectable_items[-1] | ||
3017 | 523 | self.assertThat(expected_item.selected, Eventually(Equals(True))) | ||
3018 | 524 | self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id)) | ||
3019 | 525 | |||
3020 | 526 | def test_keynav_selects_last_item_when_selected(self): | ||
3021 | 527 | """End key MUST select the last selectable item in a quicklist when | ||
3022 | 528 | another item is selected. | ||
3023 | 529 | """ | ||
3024 | 530 | self.open_quicklist_with_mouse() | ||
3025 | 531 | mouse_item = self.quicklist.selectable_items[0] | ||
3026 | 532 | mouse_item.mouse_move_to() | ||
3027 | 533 | self.assertThat(mouse_item.selected, Eventually(Equals(True))) | ||
3028 | 534 | |||
3029 | 535 | self.keybinding("quicklist/keynav/last") | ||
3030 | 536 | |||
3031 | 537 | expected_item = self.quicklist.selectable_items[-1] | ||
3032 | 538 | self.assertThat(expected_item.selected, Eventually(Equals(True))) | ||
3033 | 539 | self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id)) | ||
3034 | 540 | |||
3035 | 541 | def test_keynav_prev_selects_last_item_when_unselected(self): | ||
3036 | 542 | """Up key MUST select the last valid item when nothing is selected.""" | ||
3037 | 543 | self.open_quicklist_with_mouse() | ||
3038 | 544 | |||
3039 | 545 | self.keybinding("quicklist/keynav/prev") | ||
3040 | 546 | |||
3041 | 547 | expected_item = self.quicklist.selectable_items[-1] | ||
3042 | 548 | self.assertThat(expected_item.selected, Eventually(Equals(True))) | ||
3043 | 549 | self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id)) | ||
3044 | 550 | |||
3045 | 551 | def test_launcher_keynav_selects_first_item(self): | ||
3046 | 552 | """The first selectable item of the quicklist must be selected when | ||
3047 | 553 | opening the quicklist using the launcher key navigation. | ||
3048 | 554 | """ | ||
3049 | 555 | self.open_quicklist_with_keyboard() | ||
3050 | 556 | |||
3051 | 557 | expected_item = self.quicklist.selectable_items[0] | ||
3052 | 558 | self.assertThat(expected_item.selected, Eventually(Equals(True))) | ||
3053 | 559 | self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id)) | ||
3054 | 560 | |||
3055 | 561 | def test_keynav_next_selection_works(self): | ||
3056 | 562 | """Down key MUST select the next valid item.""" | ||
3057 | 563 | self.open_quicklist_with_mouse() | ||
3058 | 564 | |||
3059 | 565 | for item in self.quicklist.selectable_items: | ||
3060 | 566 | self.keybinding("quicklist/keynav/next") | ||
3061 | 567 | self.assertThat(item.selected, Eventually(Equals(True))) | ||
3062 | 568 | self.assertThat(self.quicklist.selected_item.id, Equals(item.id)) | ||
3063 | 569 | |||
3064 | 570 | def test_keynav_prev_selection_works(self): | ||
3065 | 571 | """Up key MUST select the previous valid item.""" | ||
3066 | 572 | self.open_quicklist_with_mouse() | ||
3067 | 573 | |||
3068 | 574 | for item in reversed(self.quicklist.selectable_items): | ||
3069 | 575 | self.keybinding("quicklist/keynav/prev") | ||
3070 | 576 | self.assertThat(item.selected, Eventually(Equals(True))) | ||
3071 | 577 | self.assertThat(self.quicklist.selected_item.id, Equals(item.id)) | ||
3072 | 578 | |||
3073 | 579 | def test_keynav_prev_is_cyclic(self): | ||
3074 | 580 | """Up key MUST select the last item, when the first one is selected.""" | ||
3075 | 581 | self.open_quicklist_with_mouse() | ||
3076 | 582 | |||
3077 | 583 | mouse_item = self.quicklist.selectable_items[0] | ||
3078 | 584 | mouse_item.mouse_move_to() | ||
3079 | 585 | self.assertThat(mouse_item.selected, Eventually(Equals(True))) | ||
3080 | 586 | |||
3081 | 587 | self.keybinding("quicklist/keynav/prev") | ||
3082 | 588 | expected_item = self.quicklist.selectable_items[-1] | ||
3083 | 589 | self.assertThat(expected_item.selected, Eventually(Equals(True))) | ||
3084 | 590 | self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id)) | ||
3085 | 591 | |||
3086 | 592 | def test_keynav_next_is_cyclic(self): | ||
3087 | 593 | """Down key MUST select the first item, when the last one is selected.""" | ||
3088 | 594 | self.open_quicklist_with_mouse() | ||
3089 | 595 | |||
3090 | 596 | mouse_item = self.quicklist.selectable_items[-1] | ||
3091 | 597 | mouse_item.mouse_move_to() | ||
3092 | 598 | self.assertThat(mouse_item.selected, Eventually(Equals(True))) | ||
3093 | 599 | |||
3094 | 600 | self.keybinding("quicklist/keynav/next") | ||
3095 | 601 | expected_item = self.quicklist.selectable_items[0] | ||
3096 | 602 | self.assertThat(expected_item.selected, Eventually(Equals(True))) | ||
3097 | 603 | self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id)) | ||
3098 | 604 | |||
3099 | 605 | def test_keynav_mouse_interaction(self): | ||
3100 | 606 | """Tests that the interaction between key-navigation and mouse works as | ||
3101 | 607 | expected. See bug #911561. | ||
3102 | 608 | """ | ||
3103 | 609 | self.open_quicklist_with_mouse() | ||
3104 | 610 | mouse_item = self.quicklist.selectable_items[-1] | ||
3105 | 611 | mouse_item.mouse_move_to() | ||
3106 | 612 | self.assertThat(mouse_item.selected, Eventually(Equals(True))) | ||
3107 | 613 | |||
3108 | 614 | self.keybinding("quicklist/keynav/prev") | ||
3109 | 615 | sleep(.1) | ||
3110 | 616 | self.keybinding("quicklist/keynav/prev") | ||
3111 | 617 | |||
3112 | 618 | key_item = self.quicklist.selectable_items[-3] | ||
3113 | 619 | self.assertThat(key_item.selected, Eventually(Equals(True))) | ||
3114 | 620 | self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id)) | ||
3115 | 621 | |||
3116 | 622 | # Moving the mouse horizontally doesn't change the selection | ||
3117 | 623 | self.mouse.move(mouse_item.x + mouse_item.width - 10, mouse_item.y + mouse_item.height / 2) | ||
3118 | 624 | self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id)) | ||
3119 | 625 | |||
3120 | 626 | # Moving the mouse outside doesn't change the selection | ||
3121 | 627 | self.mouse.move(mouse_item.x + mouse_item.width + 50, mouse_item.y + mouse_item.height / 2) | ||
3122 | 628 | self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id)) | ||
3123 | 629 | |||
3124 | 630 | # Moving the mouse to another entry, changes the selection | ||
3125 | 631 | mouse_item = self.quicklist.selectable_items[-2] | ||
3126 | 632 | mouse_item.mouse_move_to() | ||
3127 | 633 | self.assertThat(mouse_item.selected, Eventually(Equals(True))) | ||
3128 | 634 | self.assertThat(self.quicklist.selected_item.id, Equals(mouse_item.id)) | ||
3129 | 635 | >>>>>>> MERGE-SOURCE | ||
3130 | 338 | 636 | ||
3131 | === modified file 'tests/autopilot/unity/tests/test_shortcut_hint.py' | |||
3132 | --- tests/autopilot/unity/tests/test_shortcut_hint.py 2012-05-17 11:52:32 +0000 | |||
3133 | +++ tests/autopilot/unity/tests/test_shortcut_hint.py 2012-05-24 17:16:22 +0000 | |||
3134 | @@ -12,11 +12,21 @@ | |||
3135 | 12 | from testtools.matchers import Equals | 12 | from testtools.matchers import Equals |
3136 | 13 | from time import sleep | 13 | from time import sleep |
3137 | 14 | 14 | ||
3138 | 15 | <<<<<<< TREE | ||
3139 | 15 | from unity.emulators.shortcut_hint import ShortcutController | 16 | from unity.emulators.shortcut_hint import ShortcutController |
3140 | 16 | from unity.tests import UnityTestCase | 17 | from unity.tests import UnityTestCase |
3141 | 17 | 18 | ||
3142 | 18 | 19 | ||
3143 | 19 | class BaseShortcutHintTests(UnityTestCase): | 20 | class BaseShortcutHintTests(UnityTestCase): |
3144 | 21 | ======= | ||
3145 | 22 | from autopilot.emulators.unity.shortcut_hint import ShortcutController | ||
3146 | 23 | from autopilot.matchers import Eventually | ||
3147 | 24 | from autopilot.tests import AutopilotTestCase | ||
3148 | 25 | |||
3149 | 26 | |||
3150 | 27 | |||
3151 | 28 | class BaseShortcutHintTests(AutopilotTestCase): | ||
3152 | 29 | >>>>>>> MERGE-SOURCE | ||
3153 | 20 | """Base class for the shortcut hint tests""" | 30 | """Base class for the shortcut hint tests""" |
3154 | 21 | 31 | ||
3155 | 22 | def setUp(self): | 32 | def setUp(self): |
3156 | 23 | 33 | ||
3157 | === modified file 'tests/test-gesture-engine/CMakeLists.txt' | |||
3158 | === added file 'tests/test_resultviewgrid.cpp' | |||
3159 | --- tests/test_resultviewgrid.cpp 1970-01-01 00:00:00 +0000 | |||
3160 | +++ tests/test_resultviewgrid.cpp 2012-05-24 17:16:22 +0000 | |||
3161 | @@ -0,0 +1,103 @@ | |||
3162 | 1 | // -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*- | ||
3163 | 2 | /* | ||
3164 | 3 | * Copyright 2012 Canonical Ltd. | ||
3165 | 4 | * | ||
3166 | 5 | * This program is free software: you can redistribute it and/or modify it | ||
3167 | 6 | * under the terms of the GNU Lesser General Public License version 3, as | ||
3168 | 7 | * published by the Free Software Foundation. | ||
3169 | 8 | * | ||
3170 | 9 | * This program is distributed in the hope that it will be useful, but | ||
3171 | 10 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
3172 | 11 | * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
3173 | 12 | * PURPOSE. See the applicable version of the GNU Lesser General Public | ||
3174 | 13 | * License for more details. | ||
3175 | 14 | * | ||
3176 | 15 | * You should have received a copy of both the GNU Lesser General Public | ||
3177 | 16 | * License version 3 along with this program. If not, see | ||
3178 | 17 | * <http://www.gnu.org/licenses/> | ||
3179 | 18 | * | ||
3180 | 19 | * Authored by: Andrea Azzarone <azzaronea@gmail.com> | ||
3181 | 20 | * | ||
3182 | 21 | */ | ||
3183 | 22 | |||
3184 | 23 | #include <gtest/gtest.h> | ||
3185 | 24 | #include <gmock/gmock.h> | ||
3186 | 25 | using namespace testing; | ||
3187 | 26 | |||
3188 | 27 | #include "ResultViewGrid.h" | ||
3189 | 28 | using namespace unity; | ||
3190 | 29 | |||
3191 | 30 | namespace | ||
3192 | 31 | { | ||
3193 | 32 | |||
3194 | 33 | class MockResultViewGrid : public dash::ResultViewGrid | ||
3195 | 34 | { | ||
3196 | 35 | public: | ||
3197 | 36 | MockResultViewGrid(NUX_FILE_LINE_DECL) : dash::ResultViewGrid(NUX_FILE_LINE_PARAM) {} | ||
3198 | 37 | |||
3199 | 38 | MOCK_METHOD0(QueueDraw, void()); | ||
3200 | 39 | MOCK_METHOD2(GetIndexAtPosition, uint(int x, int y)); | ||
3201 | 40 | |||
3202 | 41 | void FakeMouseMoveSignal(int x = 0, int y = 0, int dx = 0, int dy = 0, unsigned long mouse_button_state = 0, unsigned long special_keys_state = 0) | ||
3203 | 42 | { | ||
3204 | 43 | EmitMouseMoveSignal(x, y, dy, dy, mouse_button_state, special_keys_state); | ||
3205 | 44 | } | ||
3206 | 45 | }; | ||
3207 | 46 | |||
3208 | 47 | class TestResultViewGrid : public Test | ||
3209 | 48 | { | ||
3210 | 49 | public: | ||
3211 | 50 | virtual void SetUp() | ||
3212 | 51 | { | ||
3213 | 52 | view.Adopt(new MockResultViewGrid(NUX_TRACKER_LOCATION)); | ||
3214 | 53 | renderer.Adopt(new dash::ResultRenderer(NUX_TRACKER_LOCATION)); | ||
3215 | 54 | |||
3216 | 55 | view->SetModelRenderer(renderer.GetPointer()); | ||
3217 | 56 | nux::GetWindowCompositor().SetKeyFocusArea(view.GetPointer()); | ||
3218 | 57 | } | ||
3219 | 58 | |||
3220 | 59 | nux::ObjectPtr<MockResultViewGrid> view; | ||
3221 | 60 | nux::ObjectPtr<dash::ResultRenderer> renderer; | ||
3222 | 61 | }; | ||
3223 | 62 | |||
3224 | 63 | |||
3225 | 64 | TEST_F(TestResultViewGrid, TestQueueDrawMouseMoveInsideUnfocusedIcon) | ||
3226 | 65 | { | ||
3227 | 66 | EXPECT_CALL(*view, QueueDraw()) | ||
3228 | 67 | .Times(1); | ||
3229 | 68 | |||
3230 | 69 | EXPECT_CALL(*view, GetIndexAtPosition(_, _)) | ||
3231 | 70 | .WillOnce(Return(7)); | ||
3232 | 71 | |||
3233 | 72 | view->FakeMouseMoveSignal(); | ||
3234 | 73 | } | ||
3235 | 74 | |||
3236 | 75 | |||
3237 | 76 | TEST_F(TestResultViewGrid, TestQueueDrawMouseMoveInsideFocusedIcon) | ||
3238 | 77 | { | ||
3239 | 78 | EXPECT_CALL(*view, GetIndexAtPosition(_, _)) | ||
3240 | 79 | .WillRepeatedly(Return(7)); | ||
3241 | 80 | |||
3242 | 81 | view->FakeMouseMoveSignal(); | ||
3243 | 82 | |||
3244 | 83 | EXPECT_CALL(*view, QueueDraw()) | ||
3245 | 84 | .Times(0); | ||
3246 | 85 | |||
3247 | 86 | view->FakeMouseMoveSignal(); | ||
3248 | 87 | } | ||
3249 | 88 | |||
3250 | 89 | |||
3251 | 90 | TEST_F(TestResultViewGrid, TestQueueDrawMouseMoveOutside) | ||
3252 | 91 | { | ||
3253 | 92 | EXPECT_CALL(*view, GetIndexAtPosition(_, _)) | ||
3254 | 93 | .WillRepeatedly(Return(-1)); | ||
3255 | 94 | |||
3256 | 95 | view->FakeMouseMoveSignal(); | ||
3257 | 96 | |||
3258 | 97 | EXPECT_CALL(*view, QueueDraw()) | ||
3259 | 98 | .Times(0); | ||
3260 | 99 | |||
3261 | 100 | view->FakeMouseMoveSignal(); | ||
3262 | 101 | } | ||
3263 | 102 | |||
3264 | 103 | } | ||
3265 | 0 | 104 | ||
3266 | === renamed file 'tests/test_resultviewgrid.cpp' => 'tests/test_resultviewgrid.cpp.moved' | |||
3267 | === modified file 'unity-shared/DashStyle.cpp' | |||
3268 | === modified file 'unity-shared/DashStyle.h' | |||
3269 | === modified file 'unity-shared/IconTexture.h' | |||
3270 | === modified file 'unity-shared/OverlayRenderer.cpp' | |||
3271 | --- unity-shared/OverlayRenderer.cpp 2012-05-22 10:15:47 +0000 | |||
3272 | +++ unity-shared/OverlayRenderer.cpp 2012-05-24 17:16:22 +0000 | |||
3273 | @@ -378,8 +378,13 @@ | |||
3274 | 378 | bool paint_blur = BackgroundEffectHelper::blur_type != BLUR_NONE; | 378 | bool paint_blur = BackgroundEffectHelper::blur_type != BLUR_NONE; |
3275 | 379 | nux::Geometry geo(content_geo); | 379 | nux::Geometry geo(content_geo); |
3276 | 380 | 380 | ||
3277 | 381 | <<<<<<< TREE | ||
3278 | 381 | int excess_border = (Settings::Instance().GetFormFactor() != FormFactor::NETBOOK || force_edges) ? EXCESS_BORDER : 0; | 382 | int excess_border = (Settings::Instance().GetFormFactor() != FormFactor::NETBOOK || force_edges) ? EXCESS_BORDER : 0; |
3279 | 382 | 383 | ||
3280 | 384 | ======= | ||
3281 | 385 | int excess_border = (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK || force_edges) ? EXCESS_BORDER : 0; | ||
3282 | 386 | |||
3283 | 387 | >>>>>>> MERGE-SOURCE | ||
3284 | 383 | nux::Geometry larger_content_geo = content_geo; | 388 | nux::Geometry larger_content_geo = content_geo; |
3285 | 384 | larger_content_geo.OffsetSize(excess_border, excess_border); | 389 | larger_content_geo.OffsetSize(excess_border, excess_border); |
3286 | 385 | 390 | ||
3287 | @@ -767,8 +772,13 @@ | |||
3288 | 767 | nux::Geometry geo = geometry; | 772 | nux::Geometry geo = geometry; |
3289 | 768 | bgs = 0; | 773 | bgs = 0; |
3290 | 769 | 774 | ||
3291 | 775 | <<<<<<< TREE | ||
3292 | 770 | int excess_border = (Settings::Instance().GetFormFactor() != FormFactor::NETBOOK) ? EXCESS_BORDER : 0; | 776 | int excess_border = (Settings::Instance().GetFormFactor() != FormFactor::NETBOOK) ? EXCESS_BORDER : 0; |
3293 | 771 | 777 | ||
3294 | 778 | ======= | ||
3295 | 779 | int excess_border = (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK) ? EXCESS_BORDER : 0; | ||
3296 | 780 | |||
3297 | 781 | >>>>>>> MERGE-SOURCE | ||
3298 | 772 | nux::Geometry larger_content_geo = content_geo; | 782 | nux::Geometry larger_content_geo = content_geo; |
3299 | 773 | larger_content_geo.OffsetSize(excess_border, excess_border); | 783 | larger_content_geo.OffsetSize(excess_border, excess_border); |
3300 | 774 | 784 | ||
3301 | 775 | 785 | ||
3302 | === modified file 'unity-shared/SearchBar.cpp' | |||
3303 | === modified file 'unity-shared/UnityWindowView.h' | |||
3304 | --- unity-shared/UnityWindowView.h 2012-05-17 11:52:32 +0000 | |||
3305 | +++ unity-shared/UnityWindowView.h 2012-05-24 17:16:22 +0000 | |||
3306 | @@ -20,8 +20,13 @@ | |||
3307 | 20 | #ifndef UNITYWINDOWVIEW_H | 20 | #ifndef UNITYWINDOWVIEW_H |
3308 | 21 | #define UNITYWINDOWVIEW_H | 21 | #define UNITYWINDOWVIEW_H |
3309 | 22 | 22 | ||
3310 | 23 | <<<<<<< TREE | ||
3311 | 23 | #include "unity-shared/BackgroundEffectHelper.h" | 24 | #include "unity-shared/BackgroundEffectHelper.h" |
3312 | 24 | #include "Introspectable.h" | 25 | #include "Introspectable.h" |
3313 | 26 | ======= | ||
3314 | 27 | #include "BackgroundEffectHelper.h" | ||
3315 | 28 | #include "Introspectable.h" | ||
3316 | 29 | >>>>>>> MERGE-SOURCE | ||
3317 | 25 | #include "UnityWindowStyle.h" | 30 | #include "UnityWindowStyle.h" |
3318 | 26 | #include <sigc++/sigc++.h> | 31 | #include <sigc++/sigc++.h> |
3319 | 27 | 32 | ||
3320 | 28 | 33 | ||
3321 | === modified file 'unity-shared/WindowManager.h' | |||
3322 | --- unity-shared/WindowManager.h 2012-05-07 00:49:31 +0000 | |||
3323 | +++ unity-shared/WindowManager.h 2012-05-24 17:16:22 +0000 | |||
3324 | @@ -23,9 +23,15 @@ | |||
3325 | 23 | #include <gdk/gdkx.h> | 23 | #include <gdk/gdkx.h> |
3326 | 24 | #include <core/core.h> | 24 | #include <core/core.h> |
3327 | 25 | 25 | ||
3328 | 26 | <<<<<<< TREE | ||
3329 | 26 | #include "unity-shared/Introspectable.h" | 27 | #include "unity-shared/Introspectable.h" |
3330 | 27 | 28 | ||
3331 | 28 | class WindowManager : public unity::debug::Introspectable | 29 | class WindowManager : public unity::debug::Introspectable |
3332 | 30 | ======= | ||
3333 | 31 | #include "Introspectable.h" | ||
3334 | 32 | |||
3335 | 33 | class WindowManager : public unity::debug::Introspectable | ||
3336 | 34 | >>>>>>> MERGE-SOURCE | ||
3337 | 29 | { | 35 | { |
3338 | 30 | // This is a glue interface that breaks the dependancy of Unity with Compiz | 36 | // This is a glue interface that breaks the dependancy of Unity with Compiz |
3339 | 31 | // Basically it has a default implementation that does nothing useful, but | 37 | // Basically it has a default implementation that does nothing useful, but |