Merge lp:~3v1n0/unity/unset-bamficon-on-removal-5.0 into lp:unity

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
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

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
=== modified file 'CMakeLists.txt'
=== modified file 'dash/DashController.cpp'
--- dash/DashController.cpp 2012-05-22 15:46:04 +0000
+++ dash/DashController.cpp 2012-05-24 17:16:22 +0000
@@ -266,6 +266,10 @@
266 need_show_ = true;266 need_show_ = true;
267 return;267 return;
268 }268 }
269<<<<<<< TREE
270=======
271
272>>>>>>> MERGE-SOURCE
269 view_->AboutToShow();273 view_->AboutToShow();
270274
271 window_->ShowWindow(true);275 window_->ShowWindow(true);
272276
=== modified file 'dash/DashView.cpp'
=== modified file 'dash/LensBar.cpp'
=== modified file 'dash/LensBarIcon.cpp'
=== modified file 'dash/PlacesGroup.cpp'
=== modified file 'dash/ResultRendererTile.cpp'
=== modified file 'dash/ResultView.cpp'
=== modified file 'dash/ResultViewGrid.cpp'
=== modified file 'dash/ResultViewGrid.h'
=== modified file 'hud/HudController.cpp'
=== modified file 'hud/HudController.h'
=== modified file 'hud/HudIcon.h'
=== modified file 'hud/HudView.cpp'
=== modified file 'hud/HudView.h'
=== modified file 'launcher/AbstractLauncherIcon.h'
=== modified file 'launcher/BFBLauncherIcon.cpp'
=== modified file 'launcher/BamfLauncherIcon.cpp'
=== modified file 'launcher/DesktopLauncherIcon.cpp'
=== modified file 'launcher/DeviceLauncherIcon.cpp'
=== modified file 'launcher/HudLauncherIcon.cpp'
=== modified file 'launcher/Launcher.cpp'
=== modified file 'launcher/Launcher.h'
=== modified file 'launcher/LauncherController.cpp'
=== modified file 'launcher/LauncherIcon.cpp'
=== modified file 'launcher/LauncherIcon.h'
=== modified file 'launcher/QuicklistMenuItem.cpp'
=== modified file 'launcher/QuicklistMenuItem.h'
=== modified file 'launcher/QuicklistMenuItemSeparator.cpp'
=== modified file 'launcher/QuicklistView.cpp'
=== modified file 'launcher/QuicklistView.h'
=== modified file 'launcher/StandaloneLauncher.cpp'
--- launcher/StandaloneLauncher.cpp 2012-05-07 19:52:54 +0000
+++ launcher/StandaloneLauncher.cpp 2012-05-24 17:16:22 +0000
@@ -31,12 +31,22 @@
31#include "NuxGraphics/GraphicsEngine.h"31#include "NuxGraphics/GraphicsEngine.h"
32#include <gtk/gtk.h>32#include <gtk/gtk.h>
3333
34<<<<<<< TREE
34#include "unity-shared/BackgroundEffectHelper.h"35#include "unity-shared/BackgroundEffectHelper.h"
35#include "FavoriteStoreGSettings.h"36#include "FavoriteStoreGSettings.h"
37=======
38#include "BackgroundEffectHelper.h"
39#include "FavoriteStoreGSettings.h"
40>>>>>>> MERGE-SOURCE
36#include "LauncherController.h"41#include "LauncherController.h"
37#include "Launcher.h"42#include "Launcher.h"
43<<<<<<< TREE
38#include "unity-shared/PanelStyle.h"44#include "unity-shared/PanelStyle.h"
3945
46=======
47#include "PanelStyle.h"
48
49>>>>>>> MERGE-SOURCE
40#include <dbus/dbus-glib.h>50#include <dbus/dbus-glib.h>
4151
42using namespace unity;52using namespace unity;
4353
=== modified file 'launcher/SwitcherController.cpp'
=== modified file 'launcher/SwitcherView.h'
--- launcher/SwitcherView.h 2012-05-17 11:52:32 +0000
+++ launcher/SwitcherView.h 2012-05-24 17:16:22 +0000
@@ -24,9 +24,15 @@
24#include "unity-shared/AbstractIconRenderer.h"24#include "unity-shared/AbstractIconRenderer.h"
25#include "unity-shared/StaticCairoText.h"25#include "unity-shared/StaticCairoText.h"
26#include "LayoutSystem.h"26#include "LayoutSystem.h"
27<<<<<<< TREE
27#include "unity-shared/BackgroundEffectHelper.h"28#include "unity-shared/BackgroundEffectHelper.h"
28#include "unity-shared/UnityWindowView.h"29#include "unity-shared/UnityWindowView.h"
2930
31=======
32#include "BackgroundEffectHelper.h"
33#include "UnityWindowView.h"
34
35>>>>>>> MERGE-SOURCE
30#include <boost/shared_ptr.hpp>36#include <boost/shared_ptr.hpp>
31#include <sigc++/sigc++.h>37#include <sigc++/sigc++.h>
3238
3339
=== modified file 'panel/PanelMenuView.cpp'
=== modified file 'panel/PanelView.cpp'
=== modified file 'panel/WindowButtons.cpp'
=== modified file 'plugins/unityshell/src/ScreenEffectFramebufferObject.cpp'
--- plugins/unityshell/src/ScreenEffectFramebufferObject.cpp 2012-05-24 07:23:12 +0000
+++ plugins/unityshell/src/ScreenEffectFramebufferObject.cpp 2012-05-24 17:16:22 +0000
@@ -101,6 +101,7 @@
101101
102void unity::ScreenEffectFramebufferObject::bind (const nux::Geometry &output)102void unity::ScreenEffectFramebufferObject::bind (const nux::Geometry &output)
103{103{
104<<<<<<< TREE
104 /* Very important!105 /* Very important!
105 * Don't bind unless BackgroundEffectHelper says it's necessary.106 * Don't bind unless BackgroundEffectHelper says it's necessary.
106 * Because binding has a severe impact on graphics performance and we107 * Because binding has a severe impact on graphics performance and we
@@ -109,6 +110,11 @@
109 if (!BackgroundEffectHelper::HasDirtyHelpers())110 if (!BackgroundEffectHelper::HasDirtyHelpers())
110 return;111 return;
111112
113=======
114 if (!BackgroundEffectHelper::HasDirtyHelpers())
115 return;
116
117>>>>>>> MERGE-SOURCE
112 /* Clear the error bit */118 /* Clear the error bit */
113 glGetError ();119 glGetError ();
114120
115121
=== modified file 'plugins/unityshell/src/unitya11y.cpp'
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2012-04-24 21:26:55 +0000
+++ plugins/unityshell/src/unityshell.cpp 2012-05-24 17:16:22 +0000
@@ -1449,8 +1449,11 @@
1449 ShowdesktopHandler::InhibitLeaveShowdesktopMode (event->xmaprequest.window);1449 ShowdesktopHandler::InhibitLeaveShowdesktopMode (event->xmaprequest.window);
1450 break;1450 break;
1451 case PropertyNotify:1451 case PropertyNotify:
1452 if (event->xproperty.window == GDK_ROOT_WINDOW())1452 if (event->xproperty.window == GDK_ROOT_WINDOW() &&
1453 event->xproperty.atom == gdk_x11_get_xatom_by_name("_GNOME_BACKGROUND_REPRESENTATIVE_COLORS"))
1454 {
1453 _bghash.RefreshColor();1455 _bghash.RefreshColor();
1456 }
1454 break;1457 break;
1455 default:1458 default:
1456 if (screen->shapeEvent () + ShapeNotify == event->type)1459 if (screen->shapeEvent () + ShapeNotify == event->type)
14571460
=== modified file 'plugins/unityshell/src/unityshell.h'
=== modified file 'shortcuts/ShortcutController.cpp'
=== modified file 'shortcuts/ShortcutView.cpp'
=== modified file 'shortcuts/ShortcutView.h'
=== added directory 'standalone-clients'
=== added file 'standalone-clients/CMakeLists.txt.OTHER'
--- standalone-clients/CMakeLists.txt.OTHER 1970-01-01 00:00:00 +0000
+++ standalone-clients/CMakeLists.txt.OTHER 2012-05-24 17:16:22 +0000
@@ -0,0 +1,574 @@
1set(UNITY_SRC ../plugins/unityshell/src)
2
3#
4# Data
5#
6
7#
8# Unit tests
9#
10find_package (PkgConfig)
11set (TEST_DEPS "${UNITY_PLUGIN_DEPS};unity>=4.0.0 xtst")
12pkg_check_modules (TEST_UNIT_DEPS REQUIRED ${TEST_DEPS})
13
14set (TESTDATADIR "${CMAKE_CURRENT_SOURCE_DIR}/data")
15
16set (CFLAGS
17 ${TEST_UNIT_DEPS_CFLAGS}
18 ${TEST_UNIT_DEPS_CFLAGS_OTHER}
19 ${MAINTAINER_CFLAGS}
20 "-g"
21 "-DTESTDATADIR=\"${TESTDATADIR}\""
22 "-DGETTEXT_PACKAGE=\"unity\""
23 "-DINDICATORDIR=\"${CMAKE_BINARY_DIR}/tests\""
24 "-DINDICATORICONDIR=\"${CMAKE_BINARY_DIR}/tests\""
25 "-I${CMAKE_CURRENT_BINARY_DIR}"
26 )
27add_definitions (${CFLAGS})
28
29set (LIBS ${TEST_UNIT_DEPS_LIBRARIES} "-lunity-core-${UNITY_API_VERSION} -lm -lGL -lGLU -lXtst")
30link_libraries (${LIBS})
31
32set (LIB_PATHS ${TEST_UNIT_DEPS_LIBRARY_DIRS})
33link_directories (${CMAKE_BINARY_DIR}/UnityCore ${LIB_PATHS})
34
35include_directories (. .. ../services ../UnityCore ${UNITY_SRC} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
36
37# We can't have convenience libs so we need to rebuild with what we need
38# Please keep actual test files alphabetically at top and then files
39# from ../${UNITY_SRC} or ../../services in alphabetically after that
40
41#
42# Standalone tests
43#
44add_executable (dash
45 standalone_dash.cpp
46 ${UNITY_SRC}/AbstractPlacesGroup.cpp
47 ${UNITY_SRC}/AbstractPlacesGroup.h
48 ${UNITY_SRC}/AbstractSeparator.h
49 ${UNITY_SRC}/AbstractSeparator.cpp
50 ${UNITY_SRC}/BackgroundEffectHelper.cpp
51 ${UNITY_SRC}/BackgroundEffectHelper.h
52 ${UNITY_SRC}/BGHash.cpp
53 ${UNITY_SRC}/BGHash.h
54 ${UNITY_SRC}/SearchBar.cpp
55 ${UNITY_SRC}/SearchBar.h
56 ${UNITY_SRC}/SearchBarSpinner.cpp
57 ${UNITY_SRC}/SearchBarSpinner.h
58 ${UNITY_SRC}/DashView.cpp
59 ${UNITY_SRC}/DashView.h
60 ${UNITY_SRC}/DashViewPrivate.cpp
61 ${UNITY_SRC}/DashViewPrivate.h
62 ${UNITY_SRC}/DashSettings.cpp
63 ${UNITY_SRC}/DashSettings.h
64 ${UNITY_SRC}/FilterAllButton.cpp
65 ${UNITY_SRC}/FilterAllButton.h
66 ${UNITY_SRC}/FilterExpanderLabel.cpp
67 ${UNITY_SRC}/FilterFactory.cpp
68 ${UNITY_SRC}/FilterAllButton.cpp
69 ${UNITY_SRC}/FilterBasicButton.cpp
70 ${UNITY_SRC}/FilterRatingsButton.cpp
71 ${UNITY_SRC}/FilterRatingsWidget.cpp
72 ${UNITY_SRC}/FilterMultiRangeWidget.cpp
73 ${UNITY_SRC}/FilterMultiRangeButton.cpp
74 ${UNITY_SRC}/FilterGenreButton.cpp
75 ${UNITY_SRC}/FilterGenreWidget.cpp
76 ${UNITY_SRC}/FilterBar.cpp
77 ${UNITY_SRC}/FontSettings.cpp
78 ${UNITY_SRC}/FontSettings.h
79 ${UNITY_SRC}/IMTextEntry.cpp
80 ${UNITY_SRC}/IMTextEntry.h
81 ${UNITY_SRC}/IntrospectableWrappers.cpp
82 ${UNITY_SRC}/PlacesGroup.cpp
83 ${UNITY_SRC}/PlacesGroup.h
84 ${UNITY_SRC}/PlacesTile.cpp
85 ${UNITY_SRC}/PlacesTile.h
86 ${UNITY_SRC}/PlacesSimpleTile.cpp
87 ${UNITY_SRC}/PlacesSimpleTile.h
88 ${UNITY_SRC}/PlacesVScrollBar.cpp
89 ${UNITY_SRC}/PlacesVScrollBar.h
90 ${UNITY_SRC}/DashView.cpp
91 ${UNITY_SRC}/DashView.h
92 ${UNITY_SRC}/DashViewPrivate.cpp
93 ${UNITY_SRC}/DashViewPrivate.h
94 ${UNITY_SRC}/DashStyle.cpp
95 ${UNITY_SRC}/IconLoader.cpp
96 ${UNITY_SRC}/IconLoader.h
97 ${UNITY_SRC}/IconTexture.cpp
98 ${UNITY_SRC}/IconTexture.h
99 ${UNITY_SRC}/Introspectable.cpp
100 ${UNITY_SRC}/Introspectable.h
101 ${UNITY_SRC}/JSONParser.cpp
102 ${UNITY_SRC}/LensBar.cpp
103 ${UNITY_SRC}/LensBar.h
104 ${UNITY_SRC}/LensBarIcon.cpp
105 ${UNITY_SRC}/LensBarIcon.h
106 ${UNITY_SRC}/LensView.cpp
107 ${UNITY_SRC}/LensView.h
108 ${UNITY_SRC}/LensViewPrivate.cpp
109 ${UNITY_SRC}/LensViewPrivate.h
110 ${UNITY_SRC}/LineSeparator.cpp
111 ${UNITY_SRC}/LineSeparator.h
112 ${UNITY_SRC}/OverlayRenderer.cpp
113 ${UNITY_SRC}/PreviewApplications.cpp
114 ${UNITY_SRC}/PreviewBase.cpp
115 ${UNITY_SRC}/PreviewBasicButton.cpp
116 ${UNITY_SRC}/ResultView.cpp
117 ${UNITY_SRC}/ResultViewGrid.cpp
118 ${UNITY_SRC}/ResultRenderer.cpp
119 ${UNITY_SRC}/ResultRendererTile.cpp
120 ${UNITY_SRC}/ResultRendererHorizontalTile.cpp
121 ${UNITY_SRC}/TextureCache.h
122 ${UNITY_SRC}/TextureCache.cpp
123 ${UNITY_SRC}/Timer.cpp
124 ${UNITY_SRC}/Timer.h
125 ${UNITY_SRC}/StaticCairoText.cpp
126 ${UNITY_SRC}/StaticCairoText.h
127 ${UNITY_SRC}/UBusMessages.h
128 ${UNITY_SRC}/UBusWrapper.cpp
129 ${UNITY_SRC}/UBusWrapper.h
130 ${UNITY_SRC}/ubus-server.cpp
131 ${UNITY_SRC}/ubus-server.h
132 ${UNITY_SRC}/UScreen.cpp
133 ${UNITY_SRC}/UScreen.h
134 )
135add_dependencies (dash unity-core-${UNITY_API_VERSION})
136
137add_executable (panel
138 TestPanel.cpp
139 ${UNITY_SRC}/Animator.cpp
140 ${UNITY_SRC}/Animator.h
141 ${UNITY_SRC}/BackgroundEffectHelper.cpp
142 ${UNITY_SRC}/BackgroundEffectHelper.h
143 ${UNITY_SRC}/DashSettings.cpp
144 ${UNITY_SRC}/DashSettings.h
145 ${UNITY_SRC}/PanelStyle.cpp
146 ${UNITY_SRC}/PanelStyle.h
147 ${UNITY_SRC}/PanelView.cpp
148 ${UNITY_SRC}/PanelView.h
149 ${UNITY_SRC}/PanelIndicatorsView.cpp
150 ${UNITY_SRC}/PanelIndicatorsView.h
151 ${UNITY_SRC}/PanelIndicatorEntryView.cpp
152 ${UNITY_SRC}/PanelIndicatorEntryView.h
153 ${UNITY_SRC}/PanelTitlebarGrabAreaView.h
154 ${UNITY_SRC}/PanelTitlebarGrabAreaView.cpp
155 ${UNITY_SRC}/PanelTray.cpp
156 ${UNITY_SRC}/PanelTray.h
157 ${UNITY_SRC}/Introspectable.cpp
158 ${UNITY_SRC}/Introspectable.h
159 ${UNITY_SRC}/PanelMenuView.cpp
160 ${UNITY_SRC}/PanelMenuView.h
161 ${UNITY_SRC}/Timer.cpp
162 ${UNITY_SRC}/Timer.h
163 ${UNITY_SRC}/StaticCairoText.cpp
164 ${UNITY_SRC}/StaticCairoText.h
165 ${UNITY_SRC}/WindowButtons.cpp
166 ${UNITY_SRC}/WindowButtons.h
167 ${UNITY_SRC}/WindowManager.cpp
168 ${UNITY_SRC}/WindowManager.h
169 ${UNITY_SRC}/UScreen.cpp
170 ${UNITY_SRC}/UScreen.h
171 ${UNITY_SRC}/ubus-server.cpp
172 ${UNITY_SRC}/ubus-server.h
173 )
174add_dependencies (panel unity-core-${UNITY_API_VERSION})
175
176add_executable (switcher
177 TestSwitcher.cpp
178 ${UNITY_SRC}/AbstractLauncherIcon.h
179 ${UNITY_SRC}/AbstractIconRenderer.h
180 ${UNITY_SRC}/SwitcherController.cpp
181 ${UNITY_SRC}/SwitcherController.h
182 ${UNITY_SRC}/SwitcherModel.cpp
183 ${UNITY_SRC}/SwitcherModel.h
184 ${UNITY_SRC}/SwitcherView.cpp
185 ${UNITY_SRC}/SwitcherView.h
186 ${UNITY_SRC}/LayoutSystem.h
187 ${UNITY_SRC}/LayoutSystem.cpp
188 ${UNITY_SRC}/WindowManager.h
189 ${UNITY_SRC}/WindowManager.cpp
190 ${UNITY_SRC}/IconRenderer.cpp
191 ${UNITY_SRC}/IconRenderer.h
192 ${UNITY_SRC}/Introspectable.cpp
193 ${UNITY_SRC}/Introspectable.h
194 ${UNITY_SRC}/MockLauncherIcon.h
195 ${UNITY_SRC}/BackgroundEffectHelper.h
196 ${UNITY_SRC}/BackgroundEffectHelper.cpp
197 ${UNITY_SRC}/StaticCairoText.cpp
198 ${UNITY_SRC}/StaticCairoText.h
199 ${UNITY_SRC}/UBusMessages.h
200 ${UNITY_SRC}/ubus-server.cpp
201 ${UNITY_SRC}/ubus-server.h
202 )
203add_dependencies (switcher unity-core-${UNITY_API_VERSION})
204
205add_executable (launcher
206 TestLauncher.cpp
207 ${UNITY_SRC}/CairoBaseWindow.cpp
208 ${UNITY_SRC}/AbstractLauncherIcon.h
209 ${UNITY_SRC}/AbstractLauncherIcon.cpp
210 ${UNITY_SRC}/AbstractIconRenderer.h
211 ${UNITY_SRC}/LauncherIcon.cpp
212 ${UNITY_SRC}/LauncherIcon.h
213 ${UNITY_SRC}/SimpleLauncherIcon.cpp
214 ${UNITY_SRC}/SimpleLauncherIcon.h
215 ${UNITY_SRC}/BamfLauncherIcon.cpp
216 ${UNITY_SRC}/BamfLauncherIcon.h
217 ${UNITY_SRC}/BFBLauncherIcon.cpp
218 ${UNITY_SRC}/BFBLauncherIcon.h
219 ${UNITY_SRC}/SpacerLauncherIcon.cpp
220 ${UNITY_SRC}/SpacerLauncherIcon.h
221 ${UNITY_SRC}/DndData.cpp
222 ${UNITY_SRC}/DndData.h
223 ${UNITY_SRC}/TrashLauncherIcon.cpp
224 ${UNITY_SRC}/TrashLauncherIcon.h
225 ${UNITY_SRC}/Decaymulator.cpp
226 ${UNITY_SRC}/Decaymulator.h
227 ${UNITY_SRC}/DesktopLauncherIcon.cpp
228 ${UNITY_SRC}/DesktopLauncherIcon.h
229 ${UNITY_SRC}/DNDCollectionWindow.cpp
230 ${UNITY_SRC}/DNDCollectionWindow.h
231 ${UNITY_SRC}/DeviceLauncherIcon.cpp
232 ${UNITY_SRC}/DeviceLauncherIcon.h
233 ${UNITY_SRC}/DeviceLauncherSection.cpp
234 ${UNITY_SRC}/DeviceLauncherSection.h
235 ${UNITY_SRC}/DevicesSettings.cpp
236 ${UNITY_SRC}/DevicesSettings.h
237 ${UNITY_SRC}/EdgeBarrierController.h
238 ${UNITY_SRC}/EdgeBarrierController.cpp
239 ${UNITY_SRC}/FavoriteStore.cpp
240 ${UNITY_SRC}/FavoriteStore.h
241 ${UNITY_SRC}/FavoriteStoreGSettings.cpp
242 ${UNITY_SRC}/FavoriteStoreGSettings.h
243 ${UNITY_SRC}/FavoriteStorePrivate.cpp
244 ${UNITY_SRC}/FavoriteStorePrivate.h
245 ${UNITY_SRC}/HudLauncherIcon.cpp
246 ${UNITY_SRC}/HudLauncherIcon.h
247 ${UNITY_SRC}/IconLoader.cpp
248 ${UNITY_SRC}/IconLoader.h
249 ${UNITY_SRC}/IconTextureSource.h
250 ${UNITY_SRC}/IconTextureSource.cpp
251 ${UNITY_SRC}/LauncherOptions.cpp
252 ${UNITY_SRC}/LauncherOptions.h
253 ${UNITY_SRC}/LauncherEntryRemoteModel.cpp
254 ${UNITY_SRC}/LauncherEntryRemoteModel.h
255 ${UNITY_SRC}/LauncherEntryRemote.cpp
256 ${UNITY_SRC}/LauncherEntryRemote.h
257 ${UNITY_SRC}/LauncherController.cpp
258 ${UNITY_SRC}/LauncherController.h
259 ${UNITY_SRC}/LauncherModel.cpp
260 ${UNITY_SRC}/LauncherModel.h
261 ${UNITY_SRC}/Launcher.cpp
262 ${UNITY_SRC}/Launcher.h
263 ${UNITY_SRC}/LauncherHideMachine.cpp
264 ${UNITY_SRC}/LauncherHideMachine.h
265 ${UNITY_SRC}/LauncherHoverMachine.cpp
266 ${UNITY_SRC}/LauncherHoverMachine.h
267 ${UNITY_SRC}/LauncherDragWindow.cpp
268 ${UNITY_SRC}/LauncherDragWindow.h
269 ${UNITY_SRC}/GeisAdapter.cpp
270 ${UNITY_SRC}/GeisAdapter.h
271 ${UNITY_SRC}/WindowManager.h
272 ${UNITY_SRC}/WindowManager.cpp
273 ${UNITY_SRC}/IconRenderer.cpp
274 ${UNITY_SRC}/IconRenderer.h
275 ${UNITY_SRC}/Tooltip.cpp
276 ${UNITY_SRC}/Tooltip.h
277 ${UNITY_SRC}/BackgroundEffectHelper.h
278 ${UNITY_SRC}/BackgroundEffectHelper.cpp
279 ${UNITY_SRC}/StaticCairoText.cpp
280 ${UNITY_SRC}/StaticCairoText.h
281 ${UNITY_SRC}/SingleMonitorLauncherIcon.cpp
282 ${UNITY_SRC}/SingleMonitorLauncherIcon.h
283 ${UNITY_SRC}/SoftwareCenterLauncherIcon.cpp
284 ${UNITY_SRC}/SoftwareCenterLauncherIcon.h
285 ${UNITY_SRC}/Introspectable.cpp
286 ${UNITY_SRC}/Introspectable.h
287 ${UNITY_SRC}/PanelStyle.cpp
288 ${UNITY_SRC}/PanelStyle.h
289 ${UNITY_SRC}/PointerBarrier.cpp
290 ${UNITY_SRC}/PointerBarrier.h
291 ${UNITY_SRC}/QuicklistMenuItem.cpp
292 ${UNITY_SRC}/QuicklistMenuItem.h
293 ${UNITY_SRC}/QuicklistMenuItemCheckmark.cpp
294 ${UNITY_SRC}/QuicklistMenuItemCheckmark.h
295 ${UNITY_SRC}/QuicklistMenuItemLabel.cpp
296 ${UNITY_SRC}/QuicklistMenuItemLabel.h
297 ${UNITY_SRC}/QuicklistMenuItemRadio.cpp
298 ${UNITY_SRC}/QuicklistMenuItemRadio.h
299 ${UNITY_SRC}/QuicklistMenuItemSeparator.cpp
300 ${UNITY_SRC}/QuicklistMenuItemSeparator.h
301 ${UNITY_SRC}/QuicklistView.cpp
302 ${UNITY_SRC}/QuicklistView.h
303 ${UNITY_SRC}/QuicklistManager.cpp
304 ${UNITY_SRC}/QuicklistManager.h
305 ${UNITY_SRC}/TextureCache.cpp
306 ${UNITY_SRC}/TextureCache.h
307 ${UNITY_SRC}/Timer.cpp
308 ${UNITY_SRC}/Timer.h
309 ${UNITY_SRC}/UBusMessages.h
310 ${UNITY_SRC}/UBusWrapper.cpp
311 ${UNITY_SRC}/UBusWrapper.h
312 ${UNITY_SRC}/ubus-server.cpp
313 ${UNITY_SRC}/ubus-server.h
314 ${UNITY_SRC}/UScreen.cpp
315 ${UNITY_SRC}/UScreen.h
316 )
317add_dependencies (launcher unity-core-${UNITY_API_VERSION})
318
319add_executable (keyutil
320 TestKeyboardUtil.cpp
321 ${UNITY_SRC}/KeyboardUtil.h
322 ${UNITY_SRC}/KeyboardUtil.cpp
323 )
324add_dependencies (keyutil unity-core-${UNITY_API_VERSION})
325
326add_executable (quicklist
327 ui/TestQuicklist.cpp
328 nux_test_framework.cpp
329 nux_test_framework.h
330 nux_automated_test_framework.cpp
331 nux_automated_test_framework.h
332 ${UNITY_SRC}/CairoBaseWindow.cpp
333 ${UNITY_SRC}/Introspectable.cpp
334 ${UNITY_SRC}/QuicklistMenuItem.cpp
335 ${UNITY_SRC}/QuicklistMenuItemCheckmark.cpp
336 ${UNITY_SRC}/QuicklistMenuItemLabel.cpp
337 ${UNITY_SRC}/QuicklistMenuItemRadio.cpp
338 ${UNITY_SRC}/QuicklistMenuItemSeparator.cpp
339 ${UNITY_SRC}/QuicklistView.cpp
340 ${UNITY_SRC}/ubus-server.cpp
341 )
342add_dependencies(quicklist unity-core-${UNITY_API_VERSION})
343
344add_executable (quicklist-visuals
345 ui/TestQuicklistVisuals.cpp
346 ui/EventFaker.cpp
347 ui/EventFaker.h
348 ${UNITY_SRC}/CairoBaseWindow.cpp
349 ${UNITY_SRC}/Introspectable.cpp
350 ${UNITY_SRC}/QuicklistMenuItem.cpp
351 ${UNITY_SRC}/QuicklistMenuItemCheckmark.cpp
352 ${UNITY_SRC}/QuicklistMenuItemLabel.cpp
353 ${UNITY_SRC}/QuicklistMenuItemRadio.cpp
354 ${UNITY_SRC}/QuicklistMenuItemSeparator.cpp
355 ${UNITY_SRC}/QuicklistView.cpp
356 ${UNITY_SRC}/ubus-server.cpp
357 )
358add_dependencies(quicklist-visuals unity-core-${UNITY_API_VERSION})
359
360add_executable (filters
361 TestFilters.cpp
362 ${UNITY_SRC}/FilterExpanderLabel.cpp
363 ${UNITY_SRC}/FilterBasicButton.cpp
364 ${UNITY_SRC}/FilterRatingsButton.cpp
365 ${UNITY_SRC}/FilterRatingsWidget.cpp
366 ${UNITY_SRC}/FilterGenreButton.cpp
367 ${UNITY_SRC}/FilterGenreWidget.cpp
368 ${UNITY_SRC}/FilterMultiRangeButton.cpp
369 ${UNITY_SRC}/FilterMultiRangeWidget.cpp
370 ${UNITY_SRC}/DashStyle.cpp
371 ${UNITY_SRC}/JSONParser.cpp
372 )
373add_dependencies(filters unity-core-${UNITY_API_VERSION})
374
375add_executable (filter-bar
376 TestFilterBar.cpp
377 ${UNITY_SRC}/FilterAllButton.cpp
378 ${UNITY_SRC}/FilterBar.cpp
379 ${UNITY_SRC}/FilterBasicButton.cpp
380 ${UNITY_SRC}/FilterExpanderLabel.cpp
381 ${UNITY_SRC}/FilterFactory.cpp
382 ${UNITY_SRC}/FilterMultiRangeWidget.cpp
383 ${UNITY_SRC}/FilterMultiRangeButton.cpp
384 ${UNITY_SRC}/FilterGenreButton.cpp
385 ${UNITY_SRC}/FilterGenreWidget.cpp
386 ${UNITY_SRC}/FilterRatingsButton.cpp
387 ${UNITY_SRC}/FilterRatingsWidget.cpp
388 ${UNITY_SRC}/DashStyle.cpp
389 ${UNITY_SRC}/JSONParser.cpp
390 )
391add_dependencies(filter-bar unity-core-${UNITY_API_VERSION})
392
393add_executable (preview-applicaiton
394 TestPreviewApplications.cpp
395 ${UNITY_SRC}/PreviewApplications.cpp
396 ${UNITY_SRC}/PreviewBase.cpp
397 ${UNITY_SRC}/PreviewBasicButton.cpp
398 ${UNITY_SRC}/IconTexture.cpp
399 ${UNITY_SRC}/IconLoader.cpp
400 ${UNITY_SRC}/Introspectable.cpp
401 ${UNITY_SRC}/StaticCairoText.cpp
402 ${UNITY_SRC}/TextureCache.cpp
403 ${UNITY_SRC}/DashStyle.cpp
404 ${UNITY_SRC}/JSONParser.cpp
405 ${UNITY_SRC}/Timer.cpp
406 )
407add_dependencies(preview-applicaiton unity-core-${UNITY_API_VERSION})
408
409add_executable (preview-generic
410 TestPreviewGeneric.cpp
411 ${UNITY_SRC}/PreviewGeneric.cpp
412 ${UNITY_SRC}/PreviewBase.cpp
413 ${UNITY_SRC}/PreviewBasicButton.cpp
414 ${UNITY_SRC}/IconTexture.cpp
415 ${UNITY_SRC}/IconLoader.cpp
416 ${UNITY_SRC}/Introspectable.cpp
417 ${UNITY_SRC}/StaticCairoText.cpp
418 ${UNITY_SRC}/TextureCache.cpp
419 ${UNITY_SRC}/DashStyle.cpp
420 ${UNITY_SRC}/JSONParser.cpp
421 ${UNITY_SRC}/Timer.cpp
422 )
423add_dependencies(preview-generic unity-core-${UNITY_API_VERSION})
424
425add_executable (preview-music
426 TestPreviewMusic.cpp
427 ${UNITY_SRC}/PreviewBase.cpp
428 ${UNITY_SRC}/PreviewBasicButton.cpp
429 ${UNITY_SRC}/PreviewMusic.cpp
430 ${UNITY_SRC}/PreviewMusicTrack.cpp
431 ${UNITY_SRC}/PreviewMusicTrackWidget.cpp
432 ${UNITY_SRC}/IconTexture.cpp
433 ${UNITY_SRC}/IconLoader.cpp
434 ${UNITY_SRC}/Introspectable.cpp
435 ${UNITY_SRC}/StaticCairoText.cpp
436 ${UNITY_SRC}/TextureCache.cpp
437 ${UNITY_SRC}/DashStyle.cpp
438 ${UNITY_SRC}/JSONParser.cpp
439 ${UNITY_SRC}/Timer.cpp
440 )
441add_dependencies(preview-music unity-core-${UNITY_API_VERSION})
442
443add_executable (result-view
444 TestResultView.cpp
445 ${UNITY_SRC}/PreviewApplications.cpp
446 ${UNITY_SRC}/PreviewBase.cpp
447 ${UNITY_SRC}/PreviewBasicButton.cpp
448 ${UNITY_SRC}/ResultView.cpp
449 ${UNITY_SRC}/ResultViewGrid.cpp
450 ${UNITY_SRC}/ResultRenderer.cpp
451 ${UNITY_SRC}/ResultRendererTile.cpp
452 ${UNITY_SRC}/ResultRendererHorizontalTile.cpp
453 ${UNITY_SRC}/IconTexture.cpp
454 ${UNITY_SRC}/IconLoader.cpp
455 ${UNITY_SRC}/Introspectable.cpp
456 ${UNITY_SRC}/StaticCairoText.cpp
457 ${UNITY_SRC}/TextureCache.cpp
458 ${UNITY_SRC}/Timer.cpp
459 ${UNITY_SRC}/DashStyle.cpp
460 ${UNITY_SRC}/JSONParser.cpp
461 ${UNITY_SRC}/UBusMessages.h
462 ${UNITY_SRC}/UBusWrapper.cpp
463 ${UNITY_SRC}/UBusWrapper.h
464 ${UNITY_SRC}/ubus-server.cpp
465 ${UNITY_SRC}/ubus-server.h
466 )
467add_dependencies(result-view unity-core-${UNITY_API_VERSION})
468
469add_executable (dash-style
470 TestDashStyle.cpp
471 ${UNITY_SRC}/DashStyle.cpp
472 ${UNITY_SRC}/DashStyle.h
473 ${UNITY_SRC}/JSONParser.cpp
474 ${PLACES_COMMON_SOURCE}
475 )
476add_dependencies(dash-style unity-core-${UNITY_API_VERSION})
477
478add_executable (bg-hash
479 TestBGHash.cpp
480 ${UNITY_SRC}/BGHash.cpp
481 ${UNITY_SRC}/BGHash.h
482 ${UNITY_SRC}/ubus-server.cpp
483 ${UNITY_SRC}/ubus-server.h
484 )
485add_dependencies (bg-hash unity-core-${UNITY_API_VERSION})
486
487add_executable (hud
488 StandaloneHud.cpp
489 ${UNITY_SRC}/BackgroundEffectHelper.cpp
490 ${UNITY_SRC}/BackgroundEffectHelper.h
491 ${UNITY_SRC}/DashSettings.cpp
492 ${UNITY_SRC}/DashSettings.h
493 ${UNITY_SRC}/DashStyle.cpp
494 ${UNITY_SRC}/HudButton.cpp
495 ${UNITY_SRC}/HudIcon.cpp
496 ${UNITY_SRC}/HudIcon.h
497 ${UNITY_SRC}/HudIconTextureSource.cpp
498 ${UNITY_SRC}/HudIconTextureSource.h
499 ${UNITY_SRC}/HudView.cpp
500 ${UNITY_SRC}/IMTextEntry.cpp
501 ${UNITY_SRC}/Introspectable.cpp
502 ${UNITY_SRC}/IconTexture.cpp
503 ${UNITY_SRC}/IconLoader.cpp
504 ${UNITY_SRC}/IconRenderer.cpp
505 ${UNITY_SRC}/IconTextureSource.cpp
506 ${UNITY_SRC}/JSONParser.cpp
507 ${UNITY_SRC}/OverlayRenderer.cpp
508 ${UNITY_SRC}/SearchBar.cpp
509 ${UNITY_SRC}/SearchBarSpinner.cpp
510 ${UNITY_SRC}/StaticCairoText.cpp
511 ${UNITY_SRC}/TextureCache.cpp
512 ${UNITY_SRC}/Timer.cpp
513 ${UNITY_SRC}/UBusWrapper.cpp
514 ${UNITY_SRC}/ubus-server.cpp
515 ${UNITY_SRC}/UScreen.cpp
516 ${UNITY_SRC}/UScreen.h
517 )
518add_dependencies (hud unity-core-${UNITY_API_VERSION})
519
520add_executable (test-shortcut
521 TestShortcut.cpp
522 ${UNITY_SRC}/AbstractSeparator.cpp
523 ${UNITY_SRC}/AbstractSeparator.h
524 ${UNITY_SRC}/AbstractShortcutHint.h
525 ${UNITY_SRC}/Animator.cpp
526 ${UNITY_SRC}/Animator.h
527 ${UNITY_SRC}/BackgroundEffectHelper.cpp
528 ${UNITY_SRC}/BackgroundEffectHelper.h
529 ${UNITY_SRC}/LineSeparator.cpp
530 ${UNITY_SRC}/LineSeparator.h
531 ${UNITY_SRC}/MockShortcutHint.h
532 ${UNITY_SRC}/ShortcutController.cpp
533 ${UNITY_SRC}/ShortcutController.h
534 ${UNITY_SRC}/ShortcutModel.cpp
535 ${UNITY_SRC}/ShortcutModel.h
536 ${UNITY_SRC}/ShortcutView.cpp
537 ${UNITY_SRC}/ShortcutView.h
538 ${UNITY_SRC}/StaticCairoText.cpp
539 ${UNITY_SRC}/StaticCairoText.h
540 ${UNITY_SRC}/UBusMessages.h
541 ${UNITY_SRC}/ubus-server.cpp
542 ${UNITY_SRC}/ubus-server.h
543 )
544
545add_executable (tooltip
546 ui/TestTooltip.cpp
547 ${UNITY_SRC}/Introspectable.cpp
548 ${UNITY_SRC}/CairoBaseWindow.cpp
549 ${UNITY_SRC}/StaticCairoText.cpp
550 ${UNITY_SRC}/Tooltip.cpp
551 ${UNITY_SRC}/ubus-server.cpp
552 )
553add_dependencies(quicklist unity-core-${UNITY_API_VERSION})
554
555find_package (OpenGL)
556include_directories (${OPENGL_gl_INCDIRS})
557add_library (glfuncloader SHARED
558 ${CMAKE_CURRENT_SOURCE_DIR}/GLFuncLoader.cpp)
559add_dependencies (glfuncloader unity-core-${UNITY_API_VERSION})
560target_link_libraries (glfuncloader dl ${OPENGL_gl_LIBRARY})
561add_executable (screen-effect-fbo
562 TestScreenEffectFramebufferObject.cpp
563 ${UNITY_SRC}/ScreenEffectFramebufferObject.cpp
564 ${UNITY_SRC}/BackgroundEffectHelper.cpp)
565
566target_link_libraries (screen-effect-fbo glfuncloader ${OPENGL_gl_LIBRARY})
567add_dependencies (screen-effect-fbo ${UNITY_API_VERSION})
568
569# Custom target to make all the other targets here, add your test to this list
570add_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)
571
572
573
574
0575
=== modified file 'tests/CMakeLists.txt'
--- tests/CMakeLists.txt 2012-05-22 15:48:31 +0000
+++ tests/CMakeLists.txt 2012-05-24 17:16:22 +0000
@@ -205,6 +205,7 @@
205 test_single_monitor_launcher_icon.cpp205 test_single_monitor_launcher_icon.cpp
206 test_switcher_controller.cpp206 test_switcher_controller.cpp
207 test_switcher_model.cpp207 test_switcher_model.cpp
208<<<<<<< TREE
208 ${CMAKE_SOURCE_DIR}/dash/AbstractPlacesGroup.cpp209 ${CMAKE_SOURCE_DIR}/dash/AbstractPlacesGroup.cpp
209 ${CMAKE_SOURCE_DIR}/dash/DashViewPrivate.cpp210 ${CMAKE_SOURCE_DIR}/dash/DashViewPrivate.cpp
210 ${CMAKE_SOURCE_DIR}/dash/LensViewPrivate.cpp211 ${CMAKE_SOURCE_DIR}/dash/LensViewPrivate.cpp
@@ -257,6 +258,59 @@
257 ${CMAKE_SOURCE_DIR}/unity-shared/UnityWindowView.cpp258 ${CMAKE_SOURCE_DIR}/unity-shared/UnityWindowView.cpp
258 ${CMAKE_SOURCE_DIR}/unity-shared/WindowManager.cpp259 ${CMAKE_SOURCE_DIR}/unity-shared/WindowManager.cpp
259 ${CMAKE_SOURCE_DIR}/unity-shared/ubus-server.cpp260 ${CMAKE_SOURCE_DIR}/unity-shared/ubus-server.cpp
261=======
262 ${UNITY_SRC}/AbstractLauncherIcon.cpp
263 ${UNITY_SRC}/AbstractPlacesGroup.cpp
264 ${UNITY_SRC}/BackgroundEffectHelper.cpp
265 ${UNITY_SRC}/CairoBaseWindow.cpp
266 ${UNITY_SRC}/DashViewPrivate.cpp
267 ${UNITY_SRC}/Decaymulator.cpp
268 ${UNITY_SRC}/DNDCollectionWindow.cpp
269 ${UNITY_SRC}/DndData.cpp
270 ${UNITY_SRC}/GeisAdapter.cpp
271 ${UNITY_SRC}/IconLoader.cpp
272 ${UNITY_SRC}/IconRenderer.cpp
273 ${UNITY_SRC}/IconTextureSource.cpp
274 ${UNITY_SRC}/Introspectable.cpp
275 ${UNITY_SRC}/LayoutSystem.cpp
276 ${UNITY_SRC}/Launcher.cpp
277 ${UNITY_SRC}/LauncherDragWindow.cpp
278 ${UNITY_SRC}/LauncherEntryRemote.cpp
279 ${UNITY_SRC}/LauncherHideMachine.cpp
280 ${UNITY_SRC}/LauncherHoverMachine.cpp
281 ${UNITY_SRC}/LauncherIcon.cpp
282 ${UNITY_SRC}/LauncherModel.cpp
283 ${UNITY_SRC}/SimpleLauncherIcon.cpp
284 ${UNITY_SRC}/SingleMonitorLauncherIcon.cpp
285 ${UNITY_SRC}/LensViewPrivate.cpp
286 ${UNITY_SRC}/StaticCairoText.cpp
287 ${UNITY_SRC}/SwitcherController.cpp
288 ${UNITY_SRC}/SwitcherModel.cpp
289 ${UNITY_SRC}/SwitcherView.cpp
290 ${UNITY_SRC}/Timer.cpp
291 ${UNITY_SRC}/Tooltip.cpp
292 ${UNITY_SRC}/PanelStyle.cpp
293 ${UNITY_SRC}/PointerBarrier.cpp
294 ${UNITY_SRC}/QuicklistView.cpp
295 ${UNITY_SRC}/QuicklistManager.cpp
296 ${UNITY_SRC}/QuicklistMenuItem.cpp
297 ${UNITY_SRC}/QuicklistMenuItemCheckmark.cpp
298 ${UNITY_SRC}/QuicklistMenuItemLabel.cpp
299 ${UNITY_SRC}/QuicklistMenuItemRadio.cpp
300 ${UNITY_SRC}/QuicklistMenuItemSeparator.cpp
301 ${UNITY_SRC}/SpacerLauncherIcon.cpp
302 ${UNITY_SRC}/TextureCache.cpp
303 ${UNITY_SRC}/UBusWrapper.cpp
304 ${UNITY_SRC}/UnityWindowStyle.cpp
305 ${UNITY_SRC}/UnityWindowView.cpp
306 ${UNITY_SRC}/ubus-server.cpp
307 ${UNITY_SRC}/UScreen.cpp
308 ${UNITY_SRC}/WindowManager.cpp
309 ${UNITY_SRC}/ResultView.cpp
310 ${UNITY_SRC}/ResultViewGrid.cpp
311 ${UNITY_SRC}/ResultRenderer.cpp
312 ${UNITY_SRC}/IntrospectableWrappers.cpp
313>>>>>>> MERGE-SOURCE
260 )314 )
261 target_link_libraries(test-gtest gtest gmock ${LIBS})315 target_link_libraries(test-gtest gtest gmock ${LIBS})
262 add_test(UnityGTest test-gtest)316 add_test(UnityGTest test-gtest)
263317
=== added directory 'tests/autopilot/autopilot'
=== added directory 'tests/autopilot/autopilot/emulators'
=== added file 'tests/autopilot/autopilot/emulators/bamf.py.OTHER'
--- tests/autopilot/autopilot/emulators/bamf.py.OTHER 1970-01-01 00:00:00 +0000
+++ tests/autopilot/autopilot/emulators/bamf.py.OTHER 2012-05-24 17:16:22 +0000
@@ -0,0 +1,411 @@
1# Copyright 2011 Canonical
2# Author: Thomi Richards
3#
4# This program is free software: you can redistribute it and/or modify it
5# under the terms of the GNU General Public License version 3, as published
6# by the Free Software Foundation.
7
8"Various classes for interacting with BAMF."
9
10import dbus
11import dbus.glib
12import gio
13import gobject
14import os
15from Xlib import display, X, protocol
16from gtk import gdk
17
18from autopilot.emulators.dbus_handler import session_bus
19
20__all__ = [
21 "Bamf",
22 "BamfApplication",
23 "BamfWindow",
24 ]
25
26_BAMF_BUS_NAME = 'org.ayatana.bamf'
27_X_DISPLAY = display.Display()
28
29
30def _filter_user_visible(win):
31 """Filter out non-user-visible objects.
32
33 In some cases the DBus method we need to call hasn't been registered yet,
34 in which case we do the safe thing and return False.
35
36 """
37 try:
38 return win.user_visible
39 except dbus.DBusException:
40 return False
41
42
43class Bamf(object):
44 """High-level class for interacting with Bamf from within a test.
45
46 Use this class to inspect the state of running applications and open
47 windows.
48
49 """
50
51 def __init__(self):
52 matcher_path = '/org/ayatana/bamf/matcher'
53 self.matcher_interface_name = 'org.ayatana.bamf.matcher'
54 self.matcher_proxy = session_bus.get_object(_BAMF_BUS_NAME, matcher_path)
55 self.matcher_interface = dbus.Interface(self.matcher_proxy, self.matcher_interface_name)
56
57 def get_running_applications(self, user_visible_only=True):
58 """Get a list of the currently running applications.
59
60 If user_visible_only is True (the default), only applications
61 visible to the user in the switcher will be returned.
62
63 """
64 apps = [BamfApplication(p) for p in self.matcher_interface.RunningApplications()]
65 if user_visible_only:
66 return filter(_filter_user_visible, apps)
67 return apps
68
69 def get_running_applications_by_desktop_file(self, desktop_file):
70 """Return a list of applications that have the desktop file 'desktop_file'`.
71
72 This method may return an empty list, if no applications
73 are found with the specified desktop file.
74
75 """
76 return [a for a in self.get_running_applications() if a.desktop_file == desktop_file]
77
78 def get_application_by_xid(self, xid):
79 """Return the application that has a child with the requested xid or None."""
80
81 app_path = self.matcher_interface.ApplicationForXid(xid)
82 if len(app_path):
83 return BamfApplication(app_path)
84 return None
85
86 def get_open_windows(self, user_visible_only=True):
87 """Get a list of currently open windows.
88
89 If user_visible_only is True (the default), only applications
90 visible to the user in the switcher will be returned.
91
92 The result is sorted to be in stacking order.
93
94 """
95
96 windows = [BamfWindow(w) for w in self.matcher_interface.WindowStackForMonitor(-1)]
97 if user_visible_only:
98 windows = filter(_filter_user_visible, windows)
99 # Now sort on stacking order.
100 return reversed(windows)
101
102 def get_window_by_xid(self, xid):
103 """Get the BamfWindow that matches the provided 'xid'."""
104 windows = [BamfWindow(w) for w in self.matcher_interface.WindowPaths() if BamfWindow(w).x_id == xid]
105 return windows[0] if windows else None
106
107 def wait_until_application_is_running(self, desktop_file, timeout):
108 """Wait until a given application is running.
109
110 'desktop_file' is the name of the application desktop file.
111 'timeout' is the maximum time to wait, in seconds. If set to
112 something less than 0, this method will wait forever.
113
114 This method returns true once the application is found, or false
115 if the application was not found until the timeout was reached.
116 """
117 desktop_file = os.path.split(desktop_file)[1]
118 # python workaround since you can't assign to variables in the enclosing scope:
119 # see on_timeout_reached below...
120 found_app = [True]
121
122 # maybe the app is running already?
123 if len(self.get_running_applications_by_desktop_file(desktop_file)) == 0:
124 wait_forever = timeout < 0
125 gobject_loop = gobject.MainLoop()
126
127 # No, so define a callback to watch the ViewOpened signal:
128 def on_view_added(bamf_path, name):
129 if bamf_path.split('/')[-1].startswith('application'):
130 app = BamfApplication(bamf_path)
131 if desktop_file == os.path.split(app.desktop_file)[1]:
132 gobject_loop.quit()
133
134 # ...and one for when the user-defined timeout has been reached:
135 def on_timeout_reached():
136 gobject_loop.quit()
137 found_app[0] = False
138 return False
139
140 # need a timeout? if so, connect it:
141 if not wait_forever:
142 gobject.timeout_add(timeout * 1000, on_timeout_reached)
143 # connect signal handler:
144 session_bus.add_signal_receiver(on_view_added, 'ViewOpened')
145 # pump the gobject main loop until either the correct signal is emitted, or the
146 # timeout happens.
147 gobject_loop.run()
148
149 return found_app[0]
150
151 def launch_application(self, desktop_file, files=[], wait=True):
152 """Launch an application by specifying a desktop file.
153
154 `files` is a list of files to pass to the application. Not all apps support this.
155
156 If `wait` is True, this method will block until the application has launched.
157
158 Returns the Gobject process object. if wait is True (the default),
159 this method will not return until an instance of this application
160 appears in the BAMF application list.
161 """
162 if type(files) is not list:
163 raise TypeError("files must be a list.")
164 proc = gio.unix.DesktopAppInfo(desktop_file)
165 proc.launch_uris(files)
166 if wait:
167 self.wait_until_application_is_running(desktop_file, -1)
168 return proc
169
170
171class BamfApplication(object):
172 """Represents an application, with information as returned by Bamf.
173
174 Don't instantiate this class yourself. instead, use the methods as
175 provided by the Bamf class.
176
177 """
178 def __init__(self, bamf_app_path):
179 self.bamf_app_path = bamf_app_path
180 try:
181 self._app_proxy = session_bus.get_object(_BAMF_BUS_NAME, bamf_app_path)
182 self._view_iface = dbus.Interface(self._app_proxy, 'org.ayatana.bamf.view')
183 self._app_iface = dbus.Interface(self._app_proxy, 'org.ayatana.bamf.application')
184 except dbus.DBusException, e:
185 e.message += 'bamf_app_path=%r' % (bamf_app_path)
186 raise
187
188 @property
189 def desktop_file(self):
190 """Get the application desktop file"""
191 return os.path.split(self._app_iface.DesktopFile())[1]
192
193 @property
194 def name(self):
195 """Get the application name.
196
197 Note: This may change according to the current locale. If you want a unique
198 string to match applications against, use the desktop_file instead.
199
200 """
201 return self._view_iface.Name()
202
203 @property
204 def icon(self):
205 """Get the application icon."""
206 return self._view_iface.Icon()
207
208 @property
209 def is_active(self):
210 """Is the application active (i.e.- has keyboard focus)?"""
211 return self._view_iface.IsActive()
212
213 @property
214 def is_urgent(self):
215 """Is the application currently signalling urgency?"""
216 return self._view_iface.IsUrgent()
217
218 @property
219 def user_visible(self):
220 """Is this application visible to the user?
221
222 Some applications (such as the panel) are hidden to the user but will
223 still be returned by bamf.
224
225 """
226 return self._view_iface.UserVisible()
227
228 def get_windows(self):
229 """Get a list of the application windows."""
230 return [BamfWindow(w) for w in self._view_iface.Children()]
231
232 def __repr__(self):
233 return "<BamfApplication '%s'>" % (self.name)
234
235
236class BamfWindow(object):
237 """Represents an application window, as returned by Bamf.
238
239 Don't instantiate this class yourself. Instead, use the appropriate methods
240 in BamfApplication.
241
242 """
243 def __init__(self, window_path):
244 self._bamf_win_path = window_path
245 self._app_proxy = session_bus.get_object(_BAMF_BUS_NAME, window_path)
246 self._window_iface = dbus.Interface(self._app_proxy, 'org.ayatana.bamf.window')
247 self._view_iface = dbus.Interface(self._app_proxy, 'org.ayatana.bamf.view')
248
249 self._xid = int(self._window_iface.GetXid())
250 self._x_root_win = _X_DISPLAY.screen().root
251 self._x_win = _X_DISPLAY.create_resource_object('window', self._xid)
252
253 @property
254 def x_id(self):
255 """Get the X11 Window Id."""
256 return self._xid
257
258 @property
259 def x_win(self):
260 """Get the X11 window object of the underlying window."""
261 return self._x_win
262
263 @property
264 def name(self):
265 """Get the window name.
266
267 Note: This may change according to the current locale. If you want a unique
268 string to match windows against, use the x_id instead.
269
270 """
271 return self._view_iface.Name()
272
273 @property
274 def title(self):
275 """Get the window title.
276
277 This may be different from the application name.
278
279 Note that this may change depending on the current locale.
280
281 """
282 return self._getProperty('_NET_WM_NAME')
283
284 @property
285 def geometry(self):
286 """Get the geometry for this window.
287
288 Returns a tuple containing (x, y, width, height).
289
290 """
291 # FIXME: We need to use the gdk window here to get the real coordinates
292 geometry = self._x_win.get_geometry()
293 origin = gdk.window_foreign_new(self._xid).get_origin()
294 return (origin[0], origin[1], geometry.width, geometry.height)
295
296 @property
297 def is_maximized(self):
298 """Is the window maximized?
299
300 Maximized in this case means both maximized
301 vertically and horizontally. If a window is only maximized in one
302 direction it is not considered maximized.
303
304 """
305 win_state = self._get_window_states()
306 return '_NET_WM_STATE_MAXIMIZED_VERT' in win_state and \
307 '_NET_WM_STATE_MAXIMIZED_HORZ' in win_state
308
309 @property
310 def application(self):
311 """Get the application that owns this window.
312
313 This method may return None if the window does not have an associated
314 application. The 'desktop' window is one such example.
315
316 """
317 # BAMF returns a list of parents since some windows don't have an
318 # associated application. For these windows we return none.
319 parents = self._view_iface.Parents()
320 if parents:
321 return BamfApplication(parents[0])
322 else:
323 return None
324
325 @property
326 def user_visible(self):
327 """Is this window visible to the user in the switcher?"""
328 return self._view_iface.UserVisible()
329
330 @property
331 def is_hidden(self):
332 """Is this window hidden?
333
334 Windows are hidden when the 'Show Desktop' mode is activated.
335
336 """
337 win_state = self._get_window_states()
338 return '_NET_WM_STATE_HIDDEN' in win_state
339
340 @property
341 def is_focused(self):
342 """Is this window focused?"""
343 win_state = self._get_window_states()
344 return '_NET_WM_STATE_FOCUSED' in win_state
345
346 @property
347 def is_valid(self):
348 """Is this window object valid?
349
350 Invalid windows are caused by windows closing during the construction of
351 this object instance.
352
353 """
354 return not self._x_win is None
355
356 @property
357 def monitor(self):
358 """Returns the monitor to which the windows belongs to"""
359 return self._window_iface.Monitor()
360
361 @property
362 def closed(self):
363 """Returns True if the window has been closed"""
364 # This will return False when the window is closed and then removed from BUS
365 try:
366 return (self._window_iface.GetXid() != self.x_id)
367 except:
368 return True
369
370 def close(self):
371 """Close the window."""
372
373 self._setProperty('_NET_CLOSE_WINDOW', [0, 0])
374
375 def set_focus(self):
376 self._x_win.set_input_focus(X.RevertToParent, X.CurrentTime)
377 self._x_win.configure(stack_mode=X.Above)
378
379 def __repr__(self):
380 return "<BamfWindow '%s'>" % (self.title if self._x_win else str(self._xid))
381
382 def _getProperty(self, _type):
383 """Get an X11 property.
384
385 _type is a string naming the property type. win is the X11 window object.
386
387 """
388 atom = self._x_win.get_full_property(_X_DISPLAY.get_atom(_type), X.AnyPropertyType)
389 if atom:
390 return atom.value
391
392 def _setProperty(self, _type, data, mask=None):
393 if type(data) is str:
394 dataSize = 8
395 else:
396 # data length must be 5 - pad with 0's if it's short, truncate otherwise.
397 data = (data + [0] * (5 - len(data)))[:5]
398 dataSize = 32
399
400 ev = protocol.event.ClientMessage(window=self._x_win, client_type=_X_DISPLAY.get_atom(_type), data=(dataSize, data))
401
402 if not mask:
403 mask = (X.SubstructureRedirectMask | X.SubstructureNotifyMask)
404 self._x_root_win.send_event(ev, event_mask=mask)
405 _X_DISPLAY.sync()
406
407 def _get_window_states(self):
408 """Return a list of strings representing the current window state."""
409
410 _X_DISPLAY.sync()
411 return map(_X_DISPLAY.get_atom_name, self._getProperty('_NET_WM_STATE'))
0412
=== added file 'tests/autopilot/autopilot/keybindings.py.OTHER'
--- tests/autopilot/autopilot/keybindings.py.OTHER 1970-01-01 00:00:00 +0000
+++ tests/autopilot/autopilot/keybindings.py.OTHER 2012-05-24 17:16:22 +0000
@@ -0,0 +1,259 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2# Copyright 2012 Canonical
3# Author: Thomi Richards
4#
5# This program is free software: you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 3, as published
7# by the Free Software Foundation.
8
9"""Utility functions to get shortcut keybindings for various parts of Unity.
10
11Inside autopilot we deal with keybindings by naming them with unique names. For
12example, instead of hard-coding the fact that 'Alt+F2' opens the command lens, we
13might call:
14
15>>> keybindings.get('lens_reveal/command')
16'Alt+F2'
17
18Keybindings come from two different places:
19 1) Keybindings from compiz. We can get these if we have the plugin name and
20 setting name.
21 2) Elsewhere. Right now we're hard-coding these in a separate dictionary.
22"""
23
24from compizconfig import Plugin, Setting
25import logging
26from types import NoneType
27import re
28
29from autopilot.emulators.X11 import Keyboard
30from autopilot.globals import global_context
31
32
33logger = logging.getLogger(__name__)
34
35
36#
37# Fill this dictionary with keybindings we want to store.
38#
39# If keybindings are from compizconfig, the value should be a 2-value tuple
40# containging (plugin_name, setting_name).
41#
42# If keybindings are elsewhere, just store the keybinding string.
43_keys = {
44 # Launcher:
45 "launcher/reveal": ('unityshell', 'show_launcher'),
46 "launcher/keynav": ('unityshell', 'keyboard_focus'),
47 "launcher/keynav/next": "Down",
48 "launcher/keynav/prev": "Up",
49 "launcher/keynav/activate": "Enter",
50 "launcher/keynav/exit": "Escape",
51 "launcher/keynav/open-quicklist": "Right",
52 "launcher/keynav/close-quicklist": "Left",
53 "launcher/switcher": ('unityshell', 'launcher_switcher_forward'),
54 "launcher/switcher/exit": "Escape",
55 "launcher/switcher/next": "Tab",
56 "launcher/switcher/prev": "Shift+Tab",
57 "launcher/switcher/down": "Down",
58 "launcher/switcher/up": "Up",
59 # Quicklist:
60 "quicklist/keynav/first": "Home",
61 "quicklist/keynav/last": "End",
62 "quicklist/keynav/next": "Down",
63 "quicklist/keynav/prev": "Up",
64 "quicklist/keynav/activate": "Enter",
65 "quicklist/keynav/exit": "Escape",
66 # Panel:
67 "panel/show_menus": "Alt",
68 "panel/open_first_menu": ('unityshell', 'panel_first_menu'),
69 "panel/next_indicator": "Right",
70 "panel/prev_indicator": "Left",
71 # Dash:
72 "dash/reveal": "Super",
73 "dash/lens/next": "Ctrl+Tab",
74 "dash/lens/prev": "Ctrl+Shift+Tab",
75 # Lenses:
76 "lens_reveal/command": ("unityshell", "execute_command"),
77 "lens_reveal/apps": "Super+a",
78 "lens_reveal/files": "Super+f",
79 "lens_reveal/music": "Super+m",
80 # Hud:
81 "hud/reveal": ("unityshell", "show_hud"),
82 # Switcher:
83 "switcher/reveal_normal": ("unityshell", "alt_tab_forward"),
84 "switcher/reveal_impropper": "Alt+Right",
85 "switcher/reveal_details": "Alt+`",
86 "switcher/reveal_all": ("unityshell", "alt_tab_forward_all"),
87 "switcher/cancel": "Escape",
88 # Shortcut Hint:
89 "shortcuthint/reveal": ('unityshell', 'show_launcher'),
90 "shortcuthint/cancel": "Escape",
91 # These are in compiz as 'Alt+Right' and 'Alt+Left', but the fact that it
92 # lists the Alt key won't work for us, so I'm defining them manually.
93 "switcher/next": "Tab",
94 "switcher/prev": "Shift+Tab",
95 "switcher/right": "Right",
96 "switcher/left": "Left",
97 "switcher/detail_start": "Down",
98 "switcher/detail_stop": "Up",
99 "switcher/detail_next": "`",
100 "switcher/detail_prev": "`",
101 # Workspace switcher (wall):
102 "workspace/move_left": ("wall", "left_key"),
103 "workspace/move_right": ("wall", "right_key"),
104 "workspace/move_up": ("wall", "up_key"),
105 "workspace/move_down": ("wall", "down_key"),
106 # Window management:
107 "window/show_desktop" : ("core", "show_desktop_key"),
108 "window/minimize": ("core", "minimize_window_key"),
109 "window/maximize": ("core", "maximize_window_key"),
110 "window/restore": ("core", "unmaximize_window_key"),
111 "window/close": ("core", "close_window_key"),
112 # expo plugin:
113 "expo/start": ("expo", "expo_key"),
114 "expo/cancel": "Escape",
115 # spread (scale) plugin:
116 "spread/start": ("scale", "initiate_all_key"),
117 "spread/cancel": "Escape",
118}
119
120
121
122def get(binding_name):
123 """Get a keybinding, given its well-known name.
124
125 binding_name must be a string, or a TypeError will be raised.
126
127 If binding_name cannot be found in the bindings dictionaries, a ValueError
128 will be raised.
129
130 """
131 if not isinstance(binding_name, basestring):
132 raise TypeError("binding_name must be a string.")
133 if binding_name not in _keys:
134 raise ValueError("Unknown binding name '%s'." % (binding_name))
135 v = _keys[binding_name]
136 if isinstance(v, basestring):
137 return v
138 else:
139 return _get_compiz_keybinding(v)
140
141
142def get_hold_part(binding_name):
143 """Returns the part of a keybinding that must be held permenantly.
144
145 Use this function to split bindings like "Alt+Tab" into the part that must be
146 held down. See get_tap_part for the part that must be tapped.
147
148 Raises a ValueError if the binding specified does not have multiple parts.
149
150 """
151 binding = get(binding_name)
152 parts = binding.split('+')
153 if len(parts) == 1:
154 logger.warning("Key binding '%s' does not have a hold part.", binding_name)
155 return parts[0]
156 return '+'.join(parts[:-1])
157
158
159def get_tap_part(binding_name):
160 """Returns the part of a keybinding that must be tapped.
161
162 Use this function to split bindings like "Alt+Tab" into the part that must be
163 held tapped. See get_hold_part for the part that must be held down.
164
165 Raises a ValueError if the binding specified does not have multiple parts.
166
167 """
168 binding = get(binding_name)
169 parts = binding.split('+')
170 if len(parts) == 1:
171 logger.warning("Key binding '%s' does not have a tap part.", binding_name)
172 return parts[0]
173 return parts[-1]
174
175
176def _get_compiz_keybinding(compiz_tuple):
177 """Given a keybinding name, get the keybinding string from the compiz option.
178
179 Raises ValueError if the compiz setting described does not hold a keybinding.
180 Raises RuntimeError if the compiz keybinding has been disabled.
181
182 """
183 plugin_name, setting_name = compiz_tuple
184 plugin = Plugin(global_context, plugin_name)
185 setting = Setting(plugin, setting_name)
186 if setting.Type != 'Key':
187 raise ValueError("Key binding maps to a compiz option that does not hold a keybinding.")
188 if not plugin.Enabled:
189 logger.warning("Returning keybinding for '%s' which is in un-enabled plugin '%s'",
190 setting.ShortDesc,
191 plugin.ShortDesc)
192 if setting.Value == "Disabled":
193 raise RuntimeError("Keybinding '%s' in compiz plugin '%s' has been disabled." %
194 (setting.ShortDesc, plugin.ShortDesc))
195
196 return _translate_compiz_keystroke_string(setting.Value)
197
198
199def _translate_compiz_keystroke_string(keystroke_string):
200 """Get a string representing the keystroke stored in `keystroke_string`.
201
202 `keystroke_string` is a compizconfig-style keystroke string.
203
204 The returned value is suitable for passing into the Keyboard emulator.
205
206 """
207 if not isinstance(keystroke_string, basestring):
208 raise TypeError("keystroke string must be a string.")
209
210 translations = {
211 'Control': 'Ctrl',
212 'Primary': 'Ctrl',
213 }
214 regex = re.compile('[<>]')
215 parts = regex.split(keystroke_string)
216 result = []
217 for part in parts:
218 part = part.strip()
219 if part != "" and not part.isspace():
220 translated = translations.get(part, part)
221 if translated not in result:
222 result.append(translated)
223
224 return '+'.join(result)
225
226
227class KeybindingsHelper(object):
228 """A helper class that makes it easier to use unity keybindings."""
229 _keyboard = Keyboard()
230
231 def keybinding(self, binding_name, delay=None):
232 """Press and release the keybinding with the given name.
233
234 If set, the delay parameter will override the default delay set by the
235 keyboard emulator.
236
237 """
238 if type(delay) not in (float, NoneType):
239 raise TypeError("delay parameter must be a float if it is defined.")
240 if delay:
241 self._keyboard.press_and_release(get(binding_name), delay)
242 else:
243 self._keyboard.press_and_release(get(binding_name))
244
245 def keybinding_hold(self, binding_name):
246 """Hold down the hold-part of a keybinding."""
247 self._keyboard.press(get_hold_part(binding_name))
248
249 def keybinding_release(self, binding_name):
250 """Release the hold-part of a keybinding."""
251 self._keyboard.release(get_hold_part(binding_name))
252
253 def keybinding_tap(self, binding_name):
254 """Tap the tap-part of a keybinding."""
255 self._keyboard.press_and_release(get_tap_part(binding_name))
256
257 def keybinding_hold_part_then_tap(self, binding_name):
258 self.keybinding_hold(binding_name)
259 self.keybinding_tap(binding_name)
0260
=== added directory 'tests/autopilot/autopilot/matchers'
=== added file 'tests/autopilot/autopilot/matchers/__init__.py'
--- tests/autopilot/autopilot/matchers/__init__.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/autopilot/matchers/__init__.py 2012-05-24 17:16:22 +0000
@@ -0,0 +1,31 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2# Copyright 2012 Canonical
3# Author: Thomi Richards
4#
5# This program is free software: you can redistribute it and/or modify it
6# under the terms of the GNU General Public License version 3, as published
7# by the Free Software Foundation.
8
9"Autopilot-specific matchers."
10
11from testtools.matchers import Matcher
12
13
14class Eventually(Matcher):
15 """Asserts that a value will eventually equal a given Matcher object."""
16
17 def __init__(self, matcher):
18 super(Eventually, self).__init__()
19 match_fun = getattr(matcher, 'match', None)
20 if match_fun is None or not callable(match_fun):
21 raise TypeError("Eventually must be called with a testtools matcher argument.")
22 self.matcher = matcher
23
24 def match(self, value):
25 wait_fun = getattr(value, 'wait_for', None)
26 if wait_fun is None or not callable(wait_fun):
27 raise TypeError("Eventually can only be used against autopilot attributes that have a wait_for funtion.")
28 wait_fun(self.matcher)
29
30 def __str__(self):
31 return "Eventually " + str(self.matcher)
032
=== modified file 'tests/autopilot/unity/emulators/__init__.py'
--- tests/autopilot/unity/emulators/__init__.py 2012-05-08 16:13:17 +0000
+++ tests/autopilot/unity/emulators/__init__.py 2012-05-24 17:16:22 +0000
@@ -7,4 +7,293 @@
7# by the Free Software Foundation.7# by the Free Software Foundation.
8#8#
99
10<<<<<<< TREE
10"""A collection of Unity-specific emulators."""11"""A collection of Unity-specific emulators."""
12=======
13from dbus import Interface
14import logging
15from testtools.matchers import Equals
16from time import sleep
17
18from autopilot.emulators.dbus_handler import session_bus
19
20_object_registry = {}
21logger = logging.getLogger(__name__)
22
23
24class StateNotFoundError(RuntimeError):
25 """Raised when a piece of state information from unity is not found."""
26
27 message = "State not found for class with name '{}' and id '{}'."
28
29 def __init__(self, class_name, class_id):
30 super(StateNotFoundError, self).__init__(self.message.format(class_name, class_id))
31
32
33class IntrospectableObjectMetaclass(type):
34 """Metaclass to insert appropriate classes into the object registry."""
35
36 def __new__(cls, classname, bases, classdict):
37 """Add class name to type registry."""
38 class_object = type.__new__(cls, classname, bases, classdict)
39 _object_registry[classname] = class_object
40 return class_object
41
42
43# acquire the debugging dbus object
44UNITY_BUS_NAME = 'com.canonical.Unity'
45DEBUG_PATH = '/com/canonical/Unity/Debug'
46INTROSPECTION_IFACE = 'com.canonical.Unity.Debug.Introspection'
47
48
49_debug_proxy_obj = session_bus.get_object(UNITY_BUS_NAME, DEBUG_PATH)
50_introspection_iface = Interface(_debug_proxy_obj, INTROSPECTION_IFACE)
51
52
53def get_state_by_path(piece='/Unity'):
54 """Returns a full dump of unity's state."""
55 return _introspection_iface.GetState(piece)
56
57
58def get_state_by_name_and_id(class_name, unique_id):
59 """Get a state dictionary from unity given a class name and id.
60
61 raises StateNotFoundError if the state is not found.
62
63 Returns a dictionary of information. Unlike get_state_by_path, this
64 method can never return state for more than one object.
65 """
66 try:
67 query = "//%(class_name)s[id=%(unique_id)d]" % (dict(
68 class_name=class_name,
69 unique_id=unique_id))
70 return get_state_by_path(query)[0]
71 except IndexError:
72 raise StateNotFoundError(class_name, unique_id)
73
74
75def make_introspection_object(dbus_tuple):
76 """Make an introspection object given a DBus tuple of (name, state_dict).
77
78 This only works for classes that derive from UnityIntrospectionObject.
79 """
80 name, state = dbus_tuple
81 try:
82 class_type = _object_registry[name]
83 except KeyError:
84 print name, "is not a valid introspection type!"
85 return None
86 return class_type(state)
87
88
89def start_log_to_file(file_path):
90 """Instruct Unity to start logging to the given file."""
91 _introspection_iface.StartLogToFile(file_path)
92
93
94def reset_logging():
95 """Instruct Unity to stop logging to a file."""
96 _introspection_iface.ResetLogging()
97
98
99def set_log_severity(component, severity):
100 """Instruct Unity to set a log component's severity.
101
102 'component' is the unity logging component name.
103
104 'severity' is the severity name (like 'DEBUG', 'INFO' etc.)
105
106 """
107 _introspection_iface.SetLogSeverity(component, severity)
108
109
110def log_unity_message(severity, message):
111 """Instruct unity to log a message for us.
112
113 severity: one of ('TRACE', 'DEBUG', 'INFO', 'WARNING', 'ERROR').
114
115 message: The message to log.
116
117 For debugging purposes only! If you want to log a message during an autopilot
118 test, use the python logging framework instead.
119
120 """
121 _introspection_iface.LogMessage(severity, message)
122
123
124def translate_state_keys(state_dict):
125 """Translates the state_dict passed in so the keys are usable as python attributes."""
126 return {k.replace('-','_'):v for k,v in state_dict.iteritems() }
127
128
129class UnityIntrospectionObject(object):
130 """A class that can be created using a dictionary of state from Unity."""
131 __metaclass__ = IntrospectableObjectMetaclass
132
133 def __init__(self, state_dict):
134 self.__state = {}
135 self.set_properties(state_dict)
136
137 def set_properties(self, state_dict):
138 """Creates and set attributes of `self` based on contents of `state_dict`.
139
140 Translates '-' to '_', so a key of 'icon-type' for example becomes 'icon_type'.
141
142 """
143 self.__state = {}
144 for key, value in translate_state_keys(state_dict).iteritems():
145 # don't store id in state dictionary -make it a proper instance attribute
146 if key == 'id':
147 self.id = value
148 self.__state[key] = self._make_attribute(key, value)
149
150 def _make_attribute(self, name, value):
151 """Make an attribute for 'value', patched with the wait_for function."""
152
153 def wait_for(self, expected_value):
154 """Wait up to 10 seconds for our value to change to 'expected_value'.
155
156 expected_value can be a testtools.matcher.Matcher subclass (like
157 LessThan, for example), or an ordinary value.
158
159 This works by refreshing the value using repeated dbus calls.
160
161 Raises RuntimeError if the attribute was not equal to the expected value
162 after 10 seconds.
163
164 """
165 # It's guaranteed that our value is up to date, since __getattr__ calls
166 # refresh_state. This if statement stops us waiting if the value is
167 # already what we expect:
168 if self == expected_value:
169 return
170
171 # unfortunately not all testtools matchers derive from the Matcher
172 # class, so we can't use issubclass, isinstance for this:
173 match_fun = getattr(expected_value, 'match', None)
174 is_matcher = match_fun and callable(match_fun)
175 if not is_matcher:
176 expected_value = Equals(expected_value)
177
178 for i in range(11):
179 new_state = translate_state_keys(get_state_by_name_and_id(
180 self.parent.__class__.__name__,
181 self.parent.id)
182 )
183 new_value = new_state[self.name]
184 # Support for testtools.matcher classes:
185 mismatch = expected_value.match(new_value)
186 if mismatch:
187 failure_msg = mismatch.describe()
188 else:
189 self.parent.set_properties(new_state)
190 return
191
192 sleep(1)
193
194 raise AssertionError("After 10 seconds test on %s.%s failed: %s"
195 % (self.parent.__class__.__name__, self.name, failure_msg))
196
197 # This looks like magic, but it's really not. We're creating a new type
198 # on the fly that derives from the type of 'value' with a couple of
199 # extra attributes: wait_for is the wait_for method above. 'parent' and
200 # 'name' are needed by the wait_for method.
201 #
202 # We can't use traditional meta-classes here, since the type we're
203 # deriving from is only known at call time, not at parse time (we could
204 # override __call__ in the meta class, but that doesn't buy us anything
205 # extra).
206 #
207 # A better way to do this would be with functools.partial, which I tried
208 # initially, but doesn't work well with bound methods.
209 t = type(value)
210 attrs = {'wait_for': wait_for, 'parent':self, 'name':name}
211 return type(t.__name__, (t,), attrs)(value)
212
213 def _get_child_tuples_by_type(self, desired_type):
214 """Get a list of (name,dict) pairs from children of the specified type.
215
216 desired_type must be a subclass of UnityIntrospectionObject.
217
218 """
219 if not issubclass(desired_type, UnityIntrospectionObject):
220 raise TypeError("%r must be a subclass of %r" % (desired_type,
221 UnityIntrospectionObject))
222
223 children = getattr(self, 'Children', [])
224 results = []
225 # loop through all children, and try find one that matches the type the
226 # user wants.
227 for child_type, child_state in children:
228 try:
229 if issubclass(_object_registry[child_type], desired_type):
230 results.append((child_type, child_state))
231 except KeyError:
232 pass
233 return results
234
235 def get_children_by_type(self, desired_type, **kwargs):
236 """Get a list of children of the specified type.
237
238 desired_type must be a subclass of UnityIntrospectionObject.
239
240 Keyword arguments can be used to restrict returned instances. For example:
241
242 >>> get_children_by_type(Launcher, monitor=1)
243
244 ... will return only LauncherInstances that have an attribute 'monitor'
245 that is equal to 1.
246
247 """
248 self.refresh_state()
249 result = []
250 for child in self._get_child_tuples_by_type(desired_type):
251 instance = make_introspection_object(child)
252 filters_passed = True
253 for attr, val in kwargs.iteritems():
254 if not hasattr(instance, attr) or getattr(instance, attr) != val:
255 # Either attribute is not present, or is present but with
256 # the wrong value - don't add this instance to the results list.
257 filters_passed = False
258 break
259 if filters_passed:
260 result.append(instance)
261 return result
262
263 def refresh_state(self):
264 """Refreshes the object's state from unity.
265
266 raises StateNotFound if the object in unity has been destroyed.
267
268 """
269 # need to get name from class object.
270 new_state = get_state_by_name_and_id(self.__class__.__name__, self.id)
271 self.set_properties(new_state)
272
273 @classmethod
274 def get_all_instances(cls):
275 """Get all instances of this class that exist within the Unity state tree.
276
277 For example, to get all the BamfLauncherIcons:
278
279 icons = BamfLauncherIcons.get_all_instances()
280
281 The return value is a list (possibly empty) of class instances.
282
283 """
284 cls_name = cls.__name__
285 instances = get_state_by_path("//%s" % (cls_name))
286 return [make_introspection_object((cls_name,i)) for i in instances]
287
288 def __getattr__(self, name):
289 # avoid recursion if for some reason we have no state set (should never)
290 # happen.
291 if name == '__state':
292 raise AttributeError()
293
294 if name in self.__state:
295 self.refresh_state()
296 return self.__state[name]
297 # attribute not found.
298 raise AttributeError("Attribute '%s' not found." % (name))
299>>>>>>> MERGE-SOURCE
11300
=== modified file 'tests/autopilot/unity/emulators/dash.py'
--- tests/autopilot/unity/emulators/dash.py 2012-05-08 16:13:17 +0000
+++ tests/autopilot/unity/emulators/dash.py 2012-05-24 17:16:22 +0000
@@ -7,9 +7,13 @@
7# by the Free Software Foundation.7# by the Free Software Foundation.
8#8#
99
10<<<<<<< TREE
10from __future__ import absolute_import11from __future__ import absolute_import
1112
12from autopilot.introspection.unity import (13from autopilot.introspection.unity import (
14=======
15from autopilot.emulators.unity import (
16>>>>>>> MERGE-SOURCE
13 get_state_by_path,17 get_state_by_path,
14 make_introspection_object,18 make_introspection_object,
15 UnityIntrospectionObject,19 UnityIntrospectionObject,
1620
=== modified file 'tests/autopilot/unity/emulators/hud.py'
=== modified file 'tests/autopilot/unity/emulators/icons.py'
--- tests/autopilot/unity/emulators/icons.py 2012-05-16 02:57:25 +0000
+++ tests/autopilot/unity/emulators/icons.py 2012-05-24 17:16:22 +0000
@@ -7,11 +7,17 @@
7# by the Free Software Foundation.7# by the Free Software Foundation.
8#8#
99
10<<<<<<< TREE
10from __future__ import absolute_import11from __future__ import absolute_import
1112
12from autopilot.introspection.unity import UnityIntrospectionObject13from autopilot.introspection.unity import UnityIntrospectionObject
13from unity.emulators.quicklist import Quicklist14from unity.emulators.quicklist import Quicklist
14from unity.emulators.tooltip import ToolTip15from unity.emulators.tooltip import ToolTip
16=======
17from autopilot.emulators.unity import UnityIntrospectionObject
18from autopilot.emulators.unity.quicklist import Quicklist
19from autopilot.emulators.unity.tooltip import ToolTip
20>>>>>>> MERGE-SOURCE
1521
16class SimpleLauncherIcon(UnityIntrospectionObject):22class SimpleLauncherIcon(UnityIntrospectionObject):
17 """Holds information about a simple launcher icon.23 """Holds information about a simple launcher icon.
1824
=== modified file 'tests/autopilot/unity/emulators/launcher.py'
=== modified file 'tests/autopilot/unity/emulators/quicklist.py'
=== modified file 'tests/autopilot/unity/emulators/shortcut_hint.py'
=== modified file 'tests/autopilot/unity/emulators/tooltip.py'
--- tests/autopilot/unity/emulators/tooltip.py 2012-05-16 02:57:25 +0000
+++ tests/autopilot/unity/emulators/tooltip.py 2012-05-24 17:16:22 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
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 -*-
2# Copyright 2012 Canonical3# Copyright 2012 Canonical
3# Author: Andrea Azzarone4# Author: Andrea Azzarone
@@ -18,3 +19,25 @@
1819
19class ToolTip(UnityIntrospectionObject):20class ToolTip(UnityIntrospectionObject):
20 """Represents a tooltip."""21 """Represents a tooltip."""
22=======
23# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
24# Copyright 2012 Canonical
25# Author: Andrea Azzarone
26#
27# This program is free software: you can redistribute it and/or modify it
28# under the terms of the GNU General Public License version 3, as published
29# by the Free Software Foundation.
30#
31
32import logging
33from time import sleep
34
35from autopilot.emulators.unity import UnityIntrospectionObject
36
37
38logger = logging.getLogger(__name__)
39
40
41class ToolTip(UnityIntrospectionObject):
42 """Represents a tooltip."""
43>>>>>>> MERGE-SOURCE
2144
=== modified file 'tests/autopilot/unity/emulators/window_manager.py'
--- tests/autopilot/unity/emulators/window_manager.py 2012-05-08 16:13:17 +0000
+++ tests/autopilot/unity/emulators/window_manager.py 2012-05-24 17:16:22 +0000
@@ -1,3 +1,4 @@
1<<<<<<< TREE
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 -*-
2# Copyright 2012 Canonical3# Copyright 2012 Canonical
3# Author: Marco Trevisan (Treviño)4# Author: Marco Trevisan (Treviño)
@@ -22,3 +23,27 @@
22 def screen_geometry(self):23 def screen_geometry(self):
23 """Returns a tuple of (x,y,w,h) for the screen."""24 """Returns a tuple of (x,y,w,h) for the screen."""
24 return (self.x, self.y, self.width, self.height)25 return (self.x, self.y, self.width, self.height)
26=======
27# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
28# Copyright 2012 Canonical
29# Author: Marco Trevisan (Treviño)
30#
31# This program is free software: you can redistribute it and/or modify it
32# under the terms of the GNU General Public License version 3, as published
33# by the Free Software Foundation.
34#
35
36import logging
37from autopilot.emulators.unity import UnityIntrospectionObject
38
39logger = logging.getLogger(__name__)
40
41
42class WindowManager(UnityIntrospectionObject):
43 """The WindowManager class."""
44
45 @property
46 def screen_geometry(self):
47 """Returns a tuple of (x,y,w,h) for the screen."""
48 return (self.x, self.y, self.width, self.height)
49>>>>>>> MERGE-SOURCE
2550
=== modified file 'tests/autopilot/unity/tests/__init__.py'
--- tests/autopilot/unity/tests/__init__.py 2012-05-16 23:02:38 +0000
+++ tests/autopilot/unity/tests/__init__.py 2012-05-24 17:16:22 +0000
@@ -29,6 +29,7 @@
29 start_log_to_file,29 start_log_to_file,
30 reset_logging,30 reset_logging,
31 )31 )
32<<<<<<< TREE
3233
3334
3435
@@ -94,6 +95,95 @@
94 managers = WindowManager.get_all_instances()95 managers = WindowManager.get_all_instances()
95 self.assertThat(len(managers), Equals(1))96 self.assertThat(len(managers), Equals(1))
96 return managers[0]97 return managers[0]
98=======
99from autopilot.emulators.unity.dash import Dash
100from autopilot.emulators.unity.hud import Hud
101from autopilot.emulators.unity.launcher import LauncherController
102from autopilot.emulators.unity.panel import PanelController
103from autopilot.emulators.unity.switcher import Switcher
104from autopilot.emulators.unity.window_manager import WindowManager
105from autopilot.emulators.unity.workspace import WorkspaceManager
106from autopilot.emulators.X11 import ScreenGeometry, Keyboard, Mouse, reset_display
107from autopilot.glibrunner import GlibRunner
108from autopilot.globals import (global_context,
109 video_recording_enabled,
110 video_record_directory,
111 )
112from autopilot.keybindings import KeybindingsHelper
113
114
115logger = logging.getLogger(__name__)
116
117
118try:
119 from testscenarios.scenarios import multiply_scenarios
120except ImportError:
121 from itertools import product
122 def multiply_scenarios(*scenarios):
123 """Multiply two or more iterables of scenarios.
124
125 It is safe to pass scenario generators or iterators.
126
127 :returns: A list of compound scenarios: the cross-product of all
128 scenarios, with the names concatenated and the parameters
129 merged together.
130 """
131 result = []
132 scenario_lists = map(list, scenarios)
133 for combination in product(*scenario_lists):
134 names, parameters = zip(*combination)
135 scenario_name = ','.join(names)
136 scenario_parameters = {}
137 for parameter in parameters:
138 scenario_parameters.update(parameter)
139 result.append((scenario_name, scenario_parameters))
140 return result
141
142
143class LoggedTestCase(TestWithScenarios, TestCase):
144 """Initialize the logging for the test case."""
145
146 def setUp(self):
147 self._setUpTestLogging()
148 self._setUpUnityLogging()
149 # The reason that the super setup is done here is due to making sure
150 # that the logging is properly set up prior to calling it.
151 super(LoggedTestCase, self).setUp()
152
153 def _setUpTestLogging(self):
154 class MyFormatter(logging.Formatter):
155
156 def formatTime(self, record, datefmt=None):
157 ct = self.converter(record.created)
158 if datefmt:
159 s = time.strftime(datefmt, ct)
160 else:
161 t = time.strftime("%H:%M:%S", ct)
162 s = "%s.%03d" % (t, record.msecs)
163 return s
164
165 self._log_buffer = StringIO()
166 root_logger = logging.getLogger()
167 root_logger.setLevel(logging.DEBUG)
168 handler = logging.StreamHandler(stream=self._log_buffer)
169 log_format = "%(asctime)s %(levelname)s %(module)s:%(lineno)d - %(message)s"
170 handler.setFormatter(MyFormatter(log_format))
171 root_logger.addHandler(handler)
172 #Tear down logging in a cleanUp handler, so it's done after all other
173 # tearDown() calls and cleanup handlers.
174 self.addCleanup(self._tearDownLogging)
175
176 def _tearDownLogging(self):
177 logger = logging.getLogger()
178 for handler in logger.handlers:
179 handler.flush()
180 self._log_buffer.seek(0)
181 self.addDetail('test-log', text_content(self._log_buffer.getvalue()))
182 logger.removeHandler(handler)
183 # Calling del to remove the handler and flush the buffer. We are
184 # abusing the log handlers here a little.
185 del self._log_buffer
186>>>>>>> MERGE-SOURCE
97187
98 def _setUpUnityLogging(self):188 def _setUpUnityLogging(self):
99 self._unity_log_file_name = mktemp(prefix=self.shortDescription())189 self._unity_log_file_name = mktemp(prefix=self.shortDescription())
@@ -122,3 +212,228 @@
122 """212 """
123 set_log_severity(component, level)213 set_log_severity(component, level)
124214
215<<<<<<< TREE
216=======
217
218class VideoCapturedTestCase(LoggedTestCase):
219 """Video capture autopilot tests, saving the results if the test failed."""
220
221 _recording_app = '/usr/bin/recordmydesktop'
222 _recording_opts = ['--no-sound', '--no-frame', '-o',]
223
224 def setUp(self):
225 super(VideoCapturedTestCase, self).setUp()
226 global video_recording_enabled
227 if video_recording_enabled and not self._have_recording_app():
228 video_recording_enabled = False
229 logger.warning("Disabling video capture since '%s' is not present", self._recording_app)
230
231 if video_recording_enabled:
232 self._test_passed = True
233 self.addOnException(self._on_test_failed)
234 self.addCleanup(self._stop_video_capture)
235 self._start_video_capture()
236
237 def _have_recording_app(self):
238 return os.path.exists(self._recording_app)
239
240 def _start_video_capture(self):
241 args = self._get_capture_command_line()
242 self._capture_file = self._get_capture_output_file()
243 self._ensure_directory_exists_but_not_file(self._capture_file)
244 args.append(self._capture_file)
245 logger.debug("Starting: %r", args)
246 self._capture_process = Popen(args, stdout=PIPE, stderr=STDOUT)
247
248 def _stop_video_capture(self):
249 """Stop the video capture. If the test failed, save the resulting file."""
250
251 if self._test_passed:
252 # We use kill here because we don't want the recording app to start
253 # encoding the video file (since we're removing it anyway.)
254 self._capture_process.kill()
255 self._capture_process.wait()
256 else:
257 self._capture_process.terminate()
258 self._capture_process.wait()
259 if self._capture_process.returncode != 0:
260 self.addDetail('video capture log', text_content(self._capture_process.stdout.read()))
261 self._capture_process = None
262
263 def _get_capture_command_line(self):
264 return [self._recording_app] + self._recording_opts
265
266 def _get_capture_output_file(self):
267 return os.path.join(video_record_directory, '%s.ogv' % (self.shortDescription()))
268
269 def _ensure_directory_exists_but_not_file(self, file_path):
270 dirpath = os.path.dirname(file_path)
271 if not os.path.exists(dirpath):
272 os.makedirs(dirpath)
273 elif os.path.exists(file_path):
274 logger.warning("Video capture file '%s' already exists, deleting.", file_path)
275 os.remove(file_path)
276
277 def _on_test_failed(self, ex_info):
278 """Called when a test fails."""
279 self._test_passed = False
280
281
282class AutopilotTestCase(VideoCapturedTestCase, KeybindingsHelper):
283 """Wrapper around testtools.TestCase that takes care of some cleaning."""
284
285 run_test_with = GlibRunner
286
287 KNOWN_APPS = {
288 'Character Map' : {
289 'desktop-file': 'gucharmap.desktop',
290 'process-name': 'gucharmap',
291 },
292 'Calculator' : {
293 'desktop-file': 'gcalctool.desktop',
294 'process-name': 'gcalctool',
295 },
296 'Mahjongg' : {
297 'desktop-file': 'mahjongg.desktop',
298 'process-name': 'mahjongg',
299 },
300 'Remmina' : {
301 'desktop-file': 'remmina.desktop',
302 'process-name': 'remmina',
303 },
304 'System Settings' : {
305 'desktop-file': 'gnome-control-center.desktop',
306 'process-name': 'gnome-control-center',
307 },
308 'Text Editor' : {
309 'desktop-file': 'gedit.desktop',
310 'process-name': 'gedit',
311 },
312 }
313
314 def setUp(self):
315 super(AutopilotTestCase, self).setUp()
316 self.bamf = Bamf()
317 self.keyboard = Keyboard()
318 self.mouse = Mouse()
319 self.dash = Dash()
320 self.hud = Hud()
321 self.launcher = self._get_launcher_controller()
322 self.panels = self._get_panel_controller()
323 self.switcher = Switcher()
324 self.window_manager = self._get_window_manager()
325 self.workspace = WorkspaceManager()
326 self.screen_geo = ScreenGeometry()
327 self.addCleanup(self.workspace.switch_to, self.workspace.current_workspace)
328 self.addCleanup(Keyboard.cleanup)
329 self.addCleanup(Mouse.cleanup)
330
331 def start_app(self, app_name, files=[], locale=None):
332 """Start one of the known apps, and kill it on tear down.
333
334 If files is specified, start the application with the specified files.
335 If locale is specified, the locale will be set when the application is launched.
336
337 The method returns the BamfApplication instance.
338
339 """
340 if locale:
341 os.putenv("LC_ALL", locale)
342 self.addCleanup(os.unsetenv, "LC_ALL")
343 logger.info("Starting application '%s' with files %r in locale %s", app_name, files, locale)
344 else:
345 logger.info("Starting application '%s' with files %r", app_name, files)
346
347 app = self.KNOWN_APPS[app_name]
348 self.bamf.launch_application(app['desktop-file'], files)
349 apps = self.bamf.get_running_applications_by_desktop_file(app['desktop-file'])
350 self.addCleanup(call, "kill `pidof %s`" % (app['process-name']), shell=True)
351 self.assertThat(len(apps), Equals(1))
352 return apps[0]
353
354 def close_all_app(self, app_name):
355 """Close all instances of the app_name."""
356 app = self.KNOWN_APPS[app_name]
357 pids = check_output(["pidof", app['process-name']]).split()
358 if len(pids):
359 call(["kill"] + pids)
360
361 def get_app_instances(self, app_name):
362 """Get BamfApplication instances for app_name."""
363 desktop_file = self.KNOWN_APPS[app_name]['desktop-file']
364 return self.bamf.get_running_applications_by_desktop_file(desktop_file)
365
366 def app_is_running(self, app_name):
367 """Returns true if an instance of the application is running."""
368 apps = self.get_app_instances(app_name)
369 return len(apps) > 0
370
371 def call_gsettings_cmd(self, command, schema, *args):
372 """Set a desktop wide gsettings option
373
374 Using the gsettings command because there's a bug with importing
375 from gobject introspection and pygtk2 simultaneously, and the Xlib
376 keyboard layout bits are very unweildy. This seems like the best
377 solution, even a little bit brutish.
378 """
379 cmd = ['gsettings', command, schema] + list(args)
380 # strip to remove the trailing \n.
381 ret = check_output(cmd).strip()
382 time.sleep(5)
383 reset_display()
384 return ret
385
386 def set_unity_option(self, option_name, option_value):
387 """Set an option in the unity compiz plugin options.
388
389 The value will be set for the current test only.
390
391 """
392 self.set_compiz_option("unityshell", option_name, option_value)
393
394 def set_compiz_option(self, plugin_name, setting_name, setting_value):
395 """Set setting `setting_name` in compiz plugin `plugin_name` to value `setting_value`
396 for one test only.
397 """
398 old_value = self._set_compiz_option(plugin_name, setting_name, setting_value)
399 self.addCleanup(self._set_compiz_option, plugin_name, setting_name, old_value)
400 # Allow unity time to respond to the new setting.
401 time.sleep(0.5)
402
403 def _set_compiz_option(self, plugin_name, option_name, option_value):
404 logger.info("Setting compiz option '%s' in plugin '%s' to %r",
405 option_name, plugin_name, option_value)
406 plugin = Plugin(global_context, plugin_name)
407 setting = Setting(plugin, option_name)
408 old_value = setting.Value
409 setting.Value = option_value
410 global_context.Write()
411 return old_value
412
413 def _get_launcher_controller(self):
414 controllers = LauncherController.get_all_instances()
415 self.assertThat(len(controllers), Equals(1))
416 return controllers[0]
417
418 def _get_panel_controller(self):
419 controllers = PanelController.get_all_instances()
420 self.assertThat(len(controllers), Equals(1))
421 return controllers[0]
422
423 def _get_window_manager(self):
424 managers = WindowManager.get_all_instances()
425 self.assertThat(len(managers), Equals(1))
426 return managers[0]
427
428 def assertVisibleWindowStack(self, stack_start):
429 """Check that the visible window stack starts with the windows passed in.
430
431 The start_stack is an iterable of BamfWindow objects.
432 Minimised windows are skipped.
433
434 """
435 stack = [win for win in self.bamf.get_open_windows() if not win.is_hidden]
436 for pos, win in enumerate(stack_start):
437 self.assertThat(stack[pos].x_id, Equals(win.x_id),
438 "%r at %d does not equal %r" % (stack[pos], pos, win))
439>>>>>>> MERGE-SOURCE
125440
=== modified file 'tests/autopilot/unity/tests/test_command_lens.py'
--- tests/autopilot/unity/tests/test_command_lens.py 2012-05-08 16:13:17 +0000
+++ tests/autopilot/unity/tests/test_command_lens.py 2012-05-24 17:16:22 +0000
@@ -12,10 +12,18 @@
12from testtools.matchers import Equals12from testtools.matchers import Equals
13from time import sleep13from time import sleep
1414
15<<<<<<< TREE
15from unity.tests import UnityTestCase16from unity.tests import UnityTestCase
1617
1718
18class CommandLensSearchTests(UnityTestCase):19class CommandLensSearchTests(UnityTestCase):
20=======
21from autopilot.tests import AutopilotTestCase
22from autopilot.matchers import Eventually
23
24
25class CommandLensSearchTests(AutopilotTestCase):
26>>>>>>> MERGE-SOURCE
19 """Test the command lense search bahavior."""27 """Test the command lense search bahavior."""
2028
21 def setUp(self):29 def setUp(self):
2230
=== modified file 'tests/autopilot/unity/tests/test_dash.py'
--- tests/autopilot/unity/tests/test_dash.py 2012-05-08 16:13:17 +0000
+++ tests/autopilot/unity/tests/test_dash.py 2012-05-24 17:16:22 +0000
@@ -12,12 +12,22 @@
1212
13from autopilot.matchers import Eventually13from autopilot.matchers import Eventually
14from gtk import Clipboard14from gtk import Clipboard
15<<<<<<< TREE
15from testtools.matchers import Equals, NotEquals16from testtools.matchers import Equals, NotEquals
1617
17from unity.tests import UnityTestCase18from unity.tests import UnityTestCase
1819
1920
20class DashTestCase(UnityTestCase):21class DashTestCase(UnityTestCase):
22=======
23from testtools.matchers import Equals, NotEquals
24
25from autopilot.matchers import Eventually
26from autopilot.tests import AutopilotTestCase
27
28
29class DashTestCase(AutopilotTestCase):
30>>>>>>> MERGE-SOURCE
21 def setUp(self):31 def setUp(self):
22 super(DashTestCase, self).setUp()32 super(DashTestCase, self).setUp()
23 self.set_unity_log_level("unity.shell", "DEBUG")33 self.set_unity_log_level("unity.shell", "DEBUG")
2434
=== modified file 'tests/autopilot/unity/tests/test_home_lens.py'
--- tests/autopilot/unity/tests/test_home_lens.py 2012-05-08 16:13:17 +0000
+++ tests/autopilot/unity/tests/test_home_lens.py 2012-05-24 17:16:22 +0000
@@ -6,16 +6,28 @@
6# under the terms of the GNU General Public License version 3, as published6# under the terms of the GNU General Public License version 3, as published
7# by the Free Software Foundation.7# by the Free Software Foundation.
88
9<<<<<<< TREE
9from __future__ import absolute_import10from __future__ import absolute_import
1011
11from autopilot.matchers import Eventually12from autopilot.matchers import Eventually
12from testtools.matchers import Equals13from testtools.matchers import Equals
14=======
15from testtools.matchers import Equals
16>>>>>>> MERGE-SOURCE
13from time import sleep17from time import sleep
1418
19<<<<<<< TREE
15from unity.tests import UnityTestCase20from unity.tests import UnityTestCase
1621
1722
18class HomeLensSearchTests(UnityTestCase):23class HomeLensSearchTests(UnityTestCase):
24=======
25from autopilot.matchers import Eventually
26from autopilot.tests import AutopilotTestCase
27
28
29class HomeLensSearchTests(AutopilotTestCase):
30>>>>>>> MERGE-SOURCE
19 """Test the command lense search bahavior."""31 """Test the command lense search bahavior."""
2032
21 def setUp(self):33 def setUp(self):
2234
=== modified file 'tests/autopilot/unity/tests/test_hud.py'
--- tests/autopilot/unity/tests/test_hud.py 2012-05-08 16:13:17 +0000
+++ tests/autopilot/unity/tests/test_hud.py 2012-05-24 17:16:22 +0000
@@ -7,6 +7,7 @@
7# under the terms of the GNU General Public License version 3, as published7# under the terms of the GNU General Public License version 3, as published
8# by the Free Software Foundation.8# by the Free Software Foundation.
99
10<<<<<<< TREE
10from __future__ import absolute_import11from __future__ import absolute_import
1112
12from autopilot.matchers import Eventually13from autopilot.matchers import Eventually
@@ -20,10 +21,28 @@
20 LessThan,21 LessThan,
21 NotEquals,22 NotEquals,
22 )23 )
24=======
25from os import remove
26from testtools.matchers import (
27 Equals,
28 EndsWith,
29 GreaterThan,
30 LessThan,
31 NotEquals,
32 )
33>>>>>>> MERGE-SOURCE
23from time import sleep34from time import sleep
2435
36<<<<<<< TREE
25from unity.emulators.icons import HudLauncherIcon37from unity.emulators.icons import HudLauncherIcon
26from unity.tests import UnityTestCase38from unity.tests import UnityTestCase
39=======
40from autopilot.emulators.unity.icons import HudLauncherIcon
41from autopilot.emulators.X11 import ScreenGeometry
42from autopilot.matchers import Eventually
43from autopilot.tests import AutopilotTestCase, multiply_scenarios
44
45>>>>>>> MERGE-SOURCE
2746
2847
29def _make_monitor_scenarios():48def _make_monitor_scenarios():
@@ -208,9 +227,15 @@
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."""
209 self.hud.ensure_visible()228 self.hud.ensure_visible()
210 self.dash.ensure_visible()229 self.dash.ensure_visible()
230<<<<<<< TREE
211 self.addCleanup(self.dash.ensure_hidden)231 self.addCleanup(self.dash.ensure_hidden)
212232
213 self.keybinding("launcher/keynav")233 self.keybinding("launcher/keynav")
234=======
235 self.addCleanup(self.dash.ensure_hidden)
236
237 self.keybinding("launcher/keynav")
238>>>>>>> MERGE-SOURCE
214 self.assertThat(self.launcher.key_nav_is_active, Equals(False))239 self.assertThat(self.launcher.key_nav_is_active, Equals(False))
215240
216 def test_hud_to_dash_has_key_focus(self):241 def test_hud_to_dash_has_key_focus(self):
217242
=== modified file 'tests/autopilot/unity/tests/test_ibus.py'
--- tests/autopilot/unity/tests/test_ibus.py 2012-05-16 02:57:25 +0000
+++ tests/autopilot/unity/tests/test_ibus.py 2012-05-24 17:16:22 +0000
@@ -8,13 +8,18 @@
88
9"""Tests to ensure unity is compatible with ibus input method."""9"""Tests to ensure unity is compatible with ibus input method."""
1010
11<<<<<<< TREE
11from __future__ import absolute_import12from __future__ import absolute_import
13=======
14from testtools.matchers import Equals, NotEquals
15>>>>>>> MERGE-SOURCE
1216
13from autopilot.emulators.ibus import (17from autopilot.emulators.ibus import (
14 get_active_input_engines,18 get_active_input_engines,
15 set_active_engines,19 set_active_engines,
16 get_available_input_engines,20 get_available_input_engines,
17 )21 )
22<<<<<<< TREE
18from autopilot.matchers import Eventually23from autopilot.matchers import Eventually
19from autopilot.testcase import multiply_scenarios24from autopilot.testcase import multiply_scenarios
20from testtools.matchers import Equals, NotEquals25from testtools.matchers import Equals, NotEquals
@@ -23,6 +28,13 @@
2328
2429
25class IBusTests(UnityTestCase):30class IBusTests(UnityTestCase):
31=======
32from autopilot.matchers import Eventually
33from autopilot.tests import AutopilotTestCase, multiply_scenarios
34
35
36class IBusTests(AutopilotTestCase):
37>>>>>>> MERGE-SOURCE
26 """Base class for IBus tests."""38 """Base class for IBus tests."""
2739
28 def setUp(self):40 def setUp(self):
@@ -31,6 +43,7 @@
31 def tearDown(self):43 def tearDown(self):
32 super(IBusTests, self).tearDown()44 super(IBusTests, self).tearDown()
3345
46<<<<<<< TREE
34 @classmethod47 @classmethod
35 def setUpClass(cls):48 def setUpClass(cls):
36 cls._old_engines = None49 cls._old_engines = None
@@ -41,11 +54,30 @@
41 set_active_engines(cls._old_engines)54 set_active_engines(cls._old_engines)
4255
43 def activate_input_engine_or_skip(self, engine_name):56 def activate_input_engine_or_skip(self, engine_name):
57=======
58 @classmethod
59 def setUpClass(cls):
60 cls._old_engines = None
61 cls.activate_input_engine_or_skip(cls.engine_name)
62
63 @classmethod
64 def tearDownClass(cls):
65 if cls._old_engines is not None:
66 set_active_engines(cls._old_engines)
67
68 @classmethod
69 def activate_input_engine_or_skip(cls, engine_name):
70>>>>>>> MERGE-SOURCE
44 available_engines = get_available_input_engines()71 available_engines = get_available_input_engines()
45 if engine_name in available_engines:72 if engine_name in available_engines:
73<<<<<<< TREE
46 if get_active_input_engines() != [engine_name]:74 if get_active_input_engines() != [engine_name]:
47 IBusTests._old_engines = set_active_engines([engine_name])75 IBusTests._old_engines = set_active_engines([engine_name])
76=======
77 cls._old_engines = set_active_engines([engine_name])
78>>>>>>> MERGE-SOURCE
48 else:79 else:
80<<<<<<< TREE
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))
5082
51 def activate_ibus(self, widget):83 def activate_ibus(self, widget):
@@ -81,6 +113,43 @@
81 self.keyboard.press_and_release(commit_key)113 self.keyboard.press_and_release(commit_key)
82 self.deactivate_ibus(self.hud.searchbar)114 self.deactivate_ibus(self.hud.searchbar)
83 self.assertThat(self.hud.search_string, Eventually(Equals(self.result)))115 self.assertThat(self.hud.search_string, Eventually(Equals(self.result)))
116=======
117 raise AutopilotTestCase.skipException("This test requires the '%s' engine to be installed." % (engine_name))
118
119 def activate_ibus(self, widget):
120 """Activate IBus, and wait till it's actived on 'widget'"""
121 self.assertThat(widget.im_active, Equals(False))
122 self.keyboard.press_and_release('Ctrl+Space', 0.05)
123 self.assertThat(widget.im_active, Eventually(Equals(True)))
124
125 def deactivate_ibus(self, widget):
126 """Deactivate ibus, and wait till it's inactive on 'widget'"""
127 self.assertThat(widget.im_active, Equals(True))
128 self.keyboard.press_and_release('Ctrl+Space', 0.05)
129 self.assertThat(widget.im_active, Eventually(Equals(False)))
130
131 def do_dash_test_with_engine(self):
132 self.dash.ensure_visible()
133 self.addCleanup(self.dash.ensure_hidden)
134 self.activate_ibus(self.dash.searchbar)
135 self.keyboard.type(self.input)
136 commit_key = getattr(self, 'commit_key', None)
137 if commit_key:
138 self.keyboard.press_and_release(commit_key)
139 self.deactivate_ibus(self.dash.searchbar)
140 self.assertThat(self.dash.search_string, Eventually(Equals(self.result)))
141
142 def do_hud_test_with_engine(self):
143 self.hud.ensure_visible()
144 self.addCleanup(self.hud.ensure_hidden)
145 self.activate_ibus(self.hud.searchbar)
146 self.keyboard.type(self.input)
147 commit_key = getattr(self, 'commit_key', None)
148 if commit_key:
149 self.keyboard.press_and_release(commit_key)
150 self.deactivate_ibus(self.hud.searchbar)
151 self.assertThat(self.hud.search_string, Eventually(Equals(self.result)))
152>>>>>>> MERGE-SOURCE
84153
85154
86class IBusTestsPinyin(IBusTests):155class IBusTestsPinyin(IBusTests):
@@ -160,12 +229,17 @@
160class IBusTestsPinyinIgnore(IBusTests):229class IBusTestsPinyinIgnore(IBusTests):
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."""
162231
232<<<<<<< TREE
163 engine_name = "pinyin"233 engine_name = "pinyin"
164234
165 def setUp(self):235 def setUp(self):
166 super(IBusTestsPinyinIgnore, self).setUp()236 super(IBusTestsPinyinIgnore, self).setUp()
167 self.activate_input_engine_or_skip(self.engine_name)237 self.activate_input_engine_or_skip(self.engine_name)
168238
239=======
240 engine_name = "pinyin"
241
242>>>>>>> MERGE-SOURCE
169 def test_ignore_key_events_on_dash(self):243 def test_ignore_key_events_on_dash(self):
170 self.dash.ensure_visible()244 self.dash.ensure_visible()
171 self.addCleanup(self.dash.ensure_hidden)245 self.addCleanup(self.dash.ensure_hidden)
@@ -194,12 +268,17 @@
194class IBusTestsAnthyIgnore(IBusTests):268class IBusTestsAnthyIgnore(IBusTests):
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."""
196270
271<<<<<<< TREE
197 engine_name = "anthy"272 engine_name = "anthy"
198273
199 def setUp(self):274 def setUp(self):
200 super(IBusTestsAnthyIgnore, self).setUp()275 super(IBusTestsAnthyIgnore, self).setUp()
201 self.activate_input_engine_or_skip(self.engine_name)276 self.activate_input_engine_or_skip(self.engine_name)
202277
278=======
279 engine_name = "anthy"
280
281>>>>>>> MERGE-SOURCE
203 def test_ignore_key_events_on_dash(self):282 def test_ignore_key_events_on_dash(self):
204 self.dash.ensure_visible()283 self.dash.ensure_visible()
205 self.addCleanup(self.dash.ensure_hidden)284 self.addCleanup(self.dash.ensure_hidden)
206285
=== modified file 'tests/autopilot/unity/tests/test_launcher.py'
--- tests/autopilot/unity/tests/test_launcher.py 2012-05-17 22:49:33 +0000
+++ tests/autopilot/unity/tests/test_launcher.py 2012-05-24 17:16:22 +0000
@@ -19,9 +19,17 @@
19from testtools.matchers import Equals, NotEquals, LessThan, GreaterThan19from testtools.matchers import Equals, NotEquals, LessThan, GreaterThan
20from time import sleep20from time import sleep
2121
22<<<<<<< TREE
22from unity.emulators.icons import BFBLauncherIcon23from unity.emulators.icons import BFBLauncherIcon
23from unity.emulators.switcher import SwitcherMode24from unity.emulators.switcher import SwitcherMode
24from unity.tests import UnityTestCase25from unity.tests import UnityTestCase
26=======
27from autopilot.emulators.bamf import Bamf
28from autopilot.emulators.unity.icons import BFBLauncherIcon
29from autopilot.emulators.X11 import ScreenGeometry
30from autopilot.matchers import Eventually
31from autopilot.tests import AutopilotTestCase, multiply_scenarios
32>>>>>>> MERGE-SOURCE
2533
26logger = logging.getLogger(__name__)34logger = logging.getLogger(__name__)
2735
@@ -41,8 +49,13 @@
41 ('launcher on all', {'only_primary': False})]49 ('launcher on all', {'only_primary': False})]
42 return multiply_scenarios(monitor_scenarios, launcher_mode_scenarios)50 return multiply_scenarios(monitor_scenarios, launcher_mode_scenarios)
4351
52<<<<<<< TREE
4453
45class LauncherTestCase(UnityTestCase):54class LauncherTestCase(UnityTestCase):
55=======
56
57class LauncherTestCase(AutopilotTestCase):
58>>>>>>> MERGE-SOURCE
46 """A base class for all launcher tests that uses scenarios to run on59 """A base class for all launcher tests that uses scenarios to run on
47 each launcher (for multi-monitor setups).60 each launcher (for multi-monitor setups).
48 """61 """
@@ -381,9 +394,15 @@
381 def test_launcher_keynav_alt_grave_quits(self):394 def test_launcher_keynav_alt_grave_quits(self):
382 """Tests that alt+` exits keynav mode."""395 """Tests that alt+` exits keynav mode."""
383396
397<<<<<<< TREE
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.
385 self.keybinding("switcher/reveal_details")399 self.keybinding("switcher/reveal_details")
386 self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False)))400 self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False)))
401=======
402 self.switcher.initiate_detail_mode()
403 self.addCleanup(self.switcher.terminate)
404 self.assertThat(self.launcher.key_nav_is_active, Eventually(Equals(False)))
405>>>>>>> MERGE-SOURCE
387406
388407
389class LauncherIconsBehaviorTests(LauncherTestCase):408class LauncherIconsBehaviorTests(LauncherTestCase):
@@ -586,6 +605,7 @@
586 self.mouse.move(x + w/2, y + h/2)605 self.mouse.move(x + w/2, y + h/2)
587 sleep(.5)606 sleep(.5)
588 for icon in self.launcher.model.get_launcher_icons():607 for icon in self.launcher.model.get_launcher_icons():
608<<<<<<< TREE
589 self.assertThat(icon.desaturated, Eventually(Equals(False)))609 self.assertThat(icon.desaturated, Eventually(Equals(False)))
590610
591class BamfDaemonTests(LauncherTestCase):611class BamfDaemonTests(LauncherTestCase):
@@ -685,6 +705,107 @@
685705
686706
687class LauncherCaptureTests(UnityTestCase):707class LauncherCaptureTests(UnityTestCase):
708=======
709 self.assertThat(icon.desaturated, Eventually(Equals(False)))
710
711class BamfDaemonTests(LauncherTestCase):
712 """Test interaction between the launcher and the BAMF Daemon."""
713
714 def start_test_apps(self):
715 """Starts some test applications."""
716 self.start_app("Calculator")
717 self.start_app("System Settings")
718
719 def start_desktopless_test_apps(self):
720 """Start test applications with no .desktop file associated."""
721 test_apps = ["xclock"]
722
723 for app in test_apps:
724 os.spawnlp(os.P_NOWAIT, app, app)
725 self.addCleanup(call, ["killall", app])
726 self.wait_for_process_started(app)
727
728 def get_test_apps(self):
729 """Return a tuple of test application instances.
730
731 We don't store these since when we kill the bamf daemon all references
732 to the old apps will die.
733
734 """
735 [calc] = self.get_app_instances("Calculator")
736 [sys_settings] = self.get_app_instances("System Settings")
737 return [calc, sys_settings]
738
739 def get_desktopless_test_apps(self):
740 """Return a tuple of test application with no .desktop files instances."""
741 [xclock_win] = [w for w in self.bamf.get_open_windows() if w.name == "xclock"]
742 return [xclock_win.application]
743
744 def assertOnlyOneLauncherIcon(self, **kwargs):
745 """Asserts that there is only one launcher icon with the given filter."""
746 icons = self.launcher.model.get_icons_by_filter(**kwargs)
747 self.assertThat(len(icons), Equals(1))
748
749 def wait_for_process_started(self, app):
750 """Wait until the application app has been started."""
751 for i in range(10):
752 sleep(1)
753 #pgrep returns 0 if it matched something:
754 if call(["pgrep", app]) == 0:
755 return
756
757 def wait_for_process_killed(self, app):
758 """Wait until the application app has been killed."""
759 for i in range(10):
760 #pgrep returns 0 if it matched something:
761 if call(["pgrep", app]) != 0:
762 return
763 sleep(1)
764
765 def kill_and_restart_bamfdaemon(self):
766 """Kills and resumes bamfdaemon."""
767 call(["pkill", "bamfdaemon"])
768 self.wait_for_process_killed("bamfdaemon")
769
770 # trigger the bamfdaemon to be reloaded again, and wait for it to appear:
771 self.bamf = Bamf()
772 self.wait_for_process_started("bamfdaemon")
773
774 def test_killing_bamfdaemon_does_not_duplicate_desktop_ids(self):
775 """Killing bamfdaemon should not duplicate any desktop ids in the model."""
776 self.start_test_apps()
777 self.kill_and_restart_bamfdaemon()
778
779 for test_app in self.get_test_apps():
780 logger.info("Checking for duplicated launcher icon for application %s", test_app.name)
781 self.assertOnlyOneLauncherIcon(desktop_id=test_app.desktop_file)
782
783 def test_killing_bamfdaemon_does_not_duplicate_application_xids(self):
784 """Killing bamfdaemon should not duplicate any xid in the model."""
785 self.start_test_apps()
786 self.start_desktopless_test_apps()
787 self.kill_and_restart_bamfdaemon()
788
789 test_apps = self.get_test_apps() + self.get_desktopless_test_apps()
790
791 for test_app in test_apps:
792 logger.info("Checking for duplicated launcher icon for application %s", test_app.name)
793 test_windows = [w.x_id for w in test_app.get_windows()]
794 self.assertOnlyOneLauncherIcon(xids=test_windows)
795
796 def test_killing_bamfdaemon_does_not_duplicate_any_icon_application_id(self):
797 """Killing bamfdaemon should not duplicate any application ids in the model."""
798 self.start_test_apps()
799 self.start_desktopless_test_apps()
800 self.kill_and_restart_bamfdaemon()
801
802 for icon in self.launcher.model.get_bamf_launcher_icons():
803 logger.info("Checking for duplicated launcher icon %s", icon.tooltip_text)
804 self.assertOnlyOneLauncherIcon(application_id=icon.application_id)
805
806
807class LauncherCaptureTests(AutopilotTestCase):
808>>>>>>> MERGE-SOURCE
688 """Test the launchers ability to capture/not capture the mouse."""809 """Test the launchers ability to capture/not capture the mouse."""
689810
690 screen_geo = ScreenGeometry()811 screen_geo = ScreenGeometry()
@@ -783,6 +904,7 @@
783 x_fin, y_fin = self.mouse.position()904 x_fin, y_fin = self.mouse.position()
784 # The launcher should have held the mouse a little bit905 # The launcher should have held the mouse a little bit
785 self.assertThat(x_fin, LessThan(x + width * 1.5))906 self.assertThat(x_fin, LessThan(x + width * 1.5))
907<<<<<<< TREE
786908
787909
788class LauncherTooltipTests(UnityTestCase):910class LauncherTooltipTests(UnityTestCase):
@@ -811,3 +933,33 @@
811 self.mouse.move(bfb.center_x, bfb.center_y)933 self.mouse.move(bfb.center_x, bfb.center_y)
812934
813 self.assertThat(bfb.get_tooltip().active, Eventually(Equals(False)))935 self.assertThat(bfb.get_tooltip().active, Eventually(Equals(False)))
936=======
937
938
939class LauncherTooltipTests(AutopilotTestCase):
940 """Test the launcher tooltips"""
941
942 def setUp(self):
943 super(LauncherTooltipTests, self).setUp()
944 self.set_unity_option('launcher_hide_mode', 0)
945
946 def test_bfb_tooltip_disappear_when_dash_is_opened(self):
947 """Tests that the bfb tooltip disappear when the dash is opened."""
948 bfb = self.launcher.model.get_bfb_icon()
949 self.mouse.move(bfb.center_x, bfb.center_y)
950
951 self.dash.ensure_visible()
952 self.addCleanup(self.dash.ensure_hidden)
953
954 self.assertThat(bfb.get_tooltip().active, Eventually(Equals(False)))
955
956 def test_bfb_tooltip_is_disabled_when_dash_is_open(self):
957 """Tests the that bfb tooltip is disabled when the dash is open."""
958 self.dash.ensure_visible()
959 self.addCleanup(self.dash.ensure_hidden)
960
961 bfb = self.launcher.model.get_bfb_icon()
962 self.mouse.move(bfb.center_x, bfb.center_y)
963
964 self.assertThat(bfb.get_tooltip().active, Eventually(Equals(False)))
965>>>>>>> MERGE-SOURCE
814966
=== modified file 'tests/autopilot/unity/tests/test_panel.py'
--- tests/autopilot/unity/tests/test_panel.py 2012-05-08 16:13:17 +0000
+++ tests/autopilot/unity/tests/test_panel.py 2012-05-24 17:16:22 +0000
@@ -19,6 +19,7 @@
19from unity.tests import UnityTestCase19from unity.tests import UnityTestCase
2020
2121
22
22logger = logging.getLogger(__name__)23logger = logging.getLogger(__name__)
2324
2425
2526
=== modified file 'tests/autopilot/unity/tests/test_quicklist.py'
--- tests/autopilot/unity/tests/test_quicklist.py 2012-05-17 23:16:25 +0000
+++ tests/autopilot/unity/tests/test_quicklist.py 2012-05-24 17:16:22 +0000
@@ -13,6 +13,7 @@
13import os.path13import os.path
14from testtools.matchers import Contains, Equals, NotEquals14from testtools.matchers import Contains, Equals, NotEquals
15from xdg.DesktopEntry import DesktopEntry15from xdg.DesktopEntry import DesktopEntry
16<<<<<<< TREE
16from time import sleep17from time import sleep
1718
18from unity.emulators.quicklist import QuicklistMenuItemLabel19from unity.emulators.quicklist import QuicklistMenuItemLabel
@@ -20,12 +21,23 @@
2021
2122
22class QuicklistActionTests(UnityTestCase):23class QuicklistActionTests(UnityTestCase):
24=======
25from time import sleep
26
27from autopilot.emulators.unity.quicklist import QuicklistMenuItemLabel
28from autopilot.matchers import Eventually
29from autopilot.tests import AutopilotTestCase
30
31
32class QuicklistActionTests(AutopilotTestCase):
33>>>>>>> MERGE-SOURCE
23 """Tests for quicklist actions."""34 """Tests for quicklist actions."""
2435
25 scenarios = [36 scenarios = [
26 ('remmina', {'app_name': 'Remmina'}),37 ('remmina', {'app_name': 'Remmina'}),
27 ]38 ]
2839
40<<<<<<< TREE
29 def open_quicklist_for_icon(self, launcher_icon):41 def open_quicklist_for_icon(self, launcher_icon):
30 """Open the quicklist for the given launcher icon.42 """Open the quicklist for the given launcher icon.
3143
@@ -41,6 +53,13 @@
41 return ql53 return ql
42 sleep(1)54 sleep(1)
4355
56=======
57 def open_quicklist_for_icon(self, launcher_icon):
58 launcher = self.launcher.get_launcher_for_monitor(0)
59 launcher.click_launcher_icon(launcher_icon, button=3)
60 self.addCleanup(self.keyboard.press_and_release, "Escape")
61
62>>>>>>> MERGE-SOURCE
44 def test_quicklist_actions(self):63 def test_quicklist_actions(self):
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."""
46 self.start_app(self.app_name)65 self.start_app(self.app_name)
@@ -54,7 +73,12 @@
54 self.assertThat(launcher_icon, NotEquals(None))73 self.assertThat(launcher_icon, NotEquals(None))
5574
56 # open the icon quicklist, and get all the text labels:75 # open the icon quicklist, and get all the text labels:
76<<<<<<< TREE
57 ql = self.open_quicklist_for_icon(launcher_icon)77 ql = self.open_quicklist_for_icon(launcher_icon)
78=======
79 self.open_quicklist_for_icon(launcher_icon)
80 ql = launcher_icon.get_quicklist()
81>>>>>>> MERGE-SOURCE
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]
5983
60 # iterate over all the actions from the desktop file, make sure they're84 # iterate over all the actions from the desktop file, make sure they're
@@ -67,6 +91,7 @@
67 name = de.content[key]['Name']91 name = de.content[key]['Name']
68 self.assertThat(ql_item_texts, Contains(name))92 self.assertThat(ql_item_texts, Contains(name))
6993
94<<<<<<< TREE
70 def test_quicklist_application_item_focus_last_active_window(self):95 def test_quicklist_application_item_focus_last_active_window(self):
71 """This tests shows that when you activate a quicklist application item96 """This tests shows that when you activate a quicklist application item
72 only the last focused instance of that application is rasied.97 only the last focused instance of that application is rasied.
@@ -335,3 +360,276 @@
335 mouse_item.mouse_move_to()360 mouse_item.mouse_move_to()
336 self.assertThat(mouse_item.selected, Eventually(Equals(True)))361 self.assertThat(mouse_item.selected, Eventually(Equals(True)))
337 self.assertThat(self.quicklist.selected_item.id, Equals(mouse_item.id))362 self.assertThat(self.quicklist.selected_item.id, Equals(mouse_item.id))
363=======
364 def test_quicklist_application_item_focus_last_active_window(self):
365 """This tests shows that when you activate a quicklist application item
366 only the last focused instance of that application is rasied.
367
368 This is tested by opening 2 Mahjongg and a Calculator.
369 Then we activate the Calculator quicklist item.
370 Then we actiavte the Mahjongg launcher icon.
371 """
372 mahj = self.start_app("Mahjongg")
373 [mah_win1] = mahj.get_windows()
374 self.assertTrue(mah_win1.is_focused)
375
376 calc = self.start_app("Calculator")
377 [calc_win] = calc.get_windows()
378 self.assertTrue(calc_win.is_focused)
379
380 self.start_app("Mahjongg")
381 # Sleeping due to the start_app only waiting for the bamf model to be
382 # updated with the application. Since the app has already started,
383 # and we are just waiting on a second window, however a defined sleep
384 # here is likely to be problematic.
385 # TODO: fix bamf emulator to enable waiting for new windows.
386 sleep(1)
387 [mah_win2] = [w for w in mahj.get_windows() if w.x_id != mah_win1.x_id]
388 self.assertTrue(mah_win2.is_focused)
389
390 self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1])
391
392 mahj_icon = self.launcher.model.get_icon_by_desktop_id(mahj.desktop_file)
393 calc_icon = self.launcher.model.get_icon_by_desktop_id(calc.desktop_file)
394
395 self.open_quicklist_for_icon(calc_icon)
396 calc_ql = calc_icon.get_quicklist()
397 calc_ql.get_quicklist_application_item(calc.name).mouse_click()
398 sleep(1)
399 self.assertTrue(calc_win.is_focused)
400 self.assertVisibleWindowStack([calc_win, mah_win2, mah_win1])
401
402 self.open_quicklist_for_icon(mahj_icon)
403 mahj_ql = mahj_icon.get_quicklist()
404 mahj_ql.get_quicklist_application_item(mahj.name).mouse_click()
405 sleep(1)
406 self.assertTrue(mah_win2.is_focused)
407 self.assertVisibleWindowStack([mah_win2, calc_win, mah_win1])
408
409 def test_quicklist_application_item_initiate_spread(self):
410 """This tests shows that when you activate a quicklist application item
411 when an application window is focused, the spread is initiated.
412 """
413 calc = self.start_app("Calculator")
414 [calc_win1] = calc.get_windows()
415 self.assertTrue(calc_win1.is_focused)
416
417 self.start_app("Calculator")
418 # Sleeping due to the start_app only waiting for the bamf model to be
419 # updated with the application. Since the app has already started,
420 # and we are just waiting on a second window, however a defined sleep
421 # here is likely to be problematic.
422 # TODO: fix bamf emulator to enable waiting for new windows.
423 sleep(1)
424 [calc_win2] = [w for w in calc.get_windows() if w.x_id != calc_win1.x_id]
425
426 self.assertVisibleWindowStack([calc_win2, calc_win1])
427 self.assertTrue(calc_win2.is_focused)
428
429 calc_icon = self.launcher.model.get_icon_by_desktop_id(calc.desktop_file)
430
431 self.open_quicklist_for_icon(calc_icon)
432 calc_ql = calc_icon.get_quicklist()
433 app_item = calc_ql.get_quicklist_application_item(calc.name)
434
435 self.addCleanup(self.keybinding, "spread/cancel")
436 app_item.mouse_click()
437 self.assertThat(self.window_manager.scale_active, Eventually(Equals(True)))
438 self.assertThat(self.window_manager.scale_active_for_group, Eventually(Equals(True)))
439
440
441class QuicklistKeyNavigationTests(AutopilotTestCase):
442 """Tests for the quicklist key navigation."""
443
444 def setUp(self):
445 super(QuicklistKeyNavigationTests, self).setUp()
446
447 self.ql_app = self.start_app("Text Editor")
448
449 self.ql_launcher_icon = self.launcher.model.get_icon_by_desktop_id(self.ql_app.desktop_file)
450 self.assertThat(self.ql_launcher_icon, NotEquals(None))
451
452 self.ql_launcher = self.launcher.get_launcher_for_monitor(0)
453
454 def open_quicklist_with_mouse(self):
455 """Opens a quicklist with the mouse."""
456 self.ql_launcher.click_launcher_icon(self.ql_launcher_icon, button=3)
457 self.addCleanup(self.keyboard.press_and_release, "Escape")
458 self.quicklist = self.ql_launcher_icon.get_quicklist()
459 self.assertThat(self.quicklist, NotEquals(None))
460 self.quicklist.move_mouse_to_right()
461 self.assertThat(self.quicklist.selected_item, Equals(None))
462
463 def open_quicklist_with_keyboard(self):
464 """Opens a quicklist using the keyboard."""
465 self.screen_geo.move_mouse_to_monitor(0)
466 self.ql_launcher.key_nav_start()
467 self.addCleanup(self.ql_launcher.key_nav_cancel)
468
469 for icon in self.launcher.model.get_launcher_icons():
470 if icon.tooltip_text != self.ql_app.name:
471 self.ql_launcher.key_nav_next()
472 else:
473 self.keybinding("launcher/keynav/open-quicklist")
474 self.addCleanup(self.keybinding, "launcher/keynav/close-quicklist")
475 break
476
477 self.quicklist = self.ql_launcher_icon.get_quicklist()
478 self.assertThat(self.quicklist, NotEquals(None))
479 self.assertThat(self.quicklist.selected_item, NotEquals(None))
480
481 def test_keynav_selects_first_item_when_unselected(self):
482 """Home key MUST select the first selectable item in a quicklist."""
483 self.open_quicklist_with_mouse()
484
485 self.keybinding("quicklist/keynav/first")
486
487 expected_item = self.quicklist.selectable_items[0]
488 self.assertThat(expected_item.selected, Eventually(Equals(True)))
489 self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id))
490
491 def test_keynav_selects_first_item_when_selected(self):
492 """Home key MUST select the first selectable item in a quicklist when
493 another item is selected.
494 """
495 self.open_quicklist_with_mouse()
496 mouse_item = self.quicklist.selectable_items[-1]
497 mouse_item.mouse_move_to()
498 self.assertThat(mouse_item.selected, Eventually(Equals(True)))
499
500 self.keybinding("quicklist/keynav/first")
501
502 expected_item = self.quicklist.selectable_items[0]
503 self.assertThat(expected_item.selected, Eventually(Equals(True)))
504 self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id))
505
506 def test_keynav_next_selects_first_item_when_unselected(self):
507 """Down key MUST select the first valid item when nothing is selected."""
508 self.open_quicklist_with_mouse()
509
510 self.keybinding("quicklist/keynav/next")
511
512 expected_item = self.quicklist.selectable_items[0]
513 self.assertThat(expected_item.selected, Eventually(Equals(True)))
514 self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id))
515
516 def test_keynav_selects_last_item_when_unselected(self):
517 """End key MUST select the last selectable item in a quicklist."""
518 self.open_quicklist_with_mouse()
519
520 self.keybinding("quicklist/keynav/last")
521
522 expected_item = self.quicklist.selectable_items[-1]
523 self.assertThat(expected_item.selected, Eventually(Equals(True)))
524 self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id))
525
526 def test_keynav_selects_last_item_when_selected(self):
527 """End key MUST select the last selectable item in a quicklist when
528 another item is selected.
529 """
530 self.open_quicklist_with_mouse()
531 mouse_item = self.quicklist.selectable_items[0]
532 mouse_item.mouse_move_to()
533 self.assertThat(mouse_item.selected, Eventually(Equals(True)))
534
535 self.keybinding("quicklist/keynav/last")
536
537 expected_item = self.quicklist.selectable_items[-1]
538 self.assertThat(expected_item.selected, Eventually(Equals(True)))
539 self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id))
540
541 def test_keynav_prev_selects_last_item_when_unselected(self):
542 """Up key MUST select the last valid item when nothing is selected."""
543 self.open_quicklist_with_mouse()
544
545 self.keybinding("quicklist/keynav/prev")
546
547 expected_item = self.quicklist.selectable_items[-1]
548 self.assertThat(expected_item.selected, Eventually(Equals(True)))
549 self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id))
550
551 def test_launcher_keynav_selects_first_item(self):
552 """The first selectable item of the quicklist must be selected when
553 opening the quicklist using the launcher key navigation.
554 """
555 self.open_quicklist_with_keyboard()
556
557 expected_item = self.quicklist.selectable_items[0]
558 self.assertThat(expected_item.selected, Eventually(Equals(True)))
559 self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id))
560
561 def test_keynav_next_selection_works(self):
562 """Down key MUST select the next valid item."""
563 self.open_quicklist_with_mouse()
564
565 for item in self.quicklist.selectable_items:
566 self.keybinding("quicklist/keynav/next")
567 self.assertThat(item.selected, Eventually(Equals(True)))
568 self.assertThat(self.quicklist.selected_item.id, Equals(item.id))
569
570 def test_keynav_prev_selection_works(self):
571 """Up key MUST select the previous valid item."""
572 self.open_quicklist_with_mouse()
573
574 for item in reversed(self.quicklist.selectable_items):
575 self.keybinding("quicklist/keynav/prev")
576 self.assertThat(item.selected, Eventually(Equals(True)))
577 self.assertThat(self.quicklist.selected_item.id, Equals(item.id))
578
579 def test_keynav_prev_is_cyclic(self):
580 """Up key MUST select the last item, when the first one is selected."""
581 self.open_quicklist_with_mouse()
582
583 mouse_item = self.quicklist.selectable_items[0]
584 mouse_item.mouse_move_to()
585 self.assertThat(mouse_item.selected, Eventually(Equals(True)))
586
587 self.keybinding("quicklist/keynav/prev")
588 expected_item = self.quicklist.selectable_items[-1]
589 self.assertThat(expected_item.selected, Eventually(Equals(True)))
590 self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id))
591
592 def test_keynav_next_is_cyclic(self):
593 """Down key MUST select the first item, when the last one is selected."""
594 self.open_quicklist_with_mouse()
595
596 mouse_item = self.quicklist.selectable_items[-1]
597 mouse_item.mouse_move_to()
598 self.assertThat(mouse_item.selected, Eventually(Equals(True)))
599
600 self.keybinding("quicklist/keynav/next")
601 expected_item = self.quicklist.selectable_items[0]
602 self.assertThat(expected_item.selected, Eventually(Equals(True)))
603 self.assertThat(self.quicklist.selected_item.id, Equals(expected_item.id))
604
605 def test_keynav_mouse_interaction(self):
606 """Tests that the interaction between key-navigation and mouse works as
607 expected. See bug #911561.
608 """
609 self.open_quicklist_with_mouse()
610 mouse_item = self.quicklist.selectable_items[-1]
611 mouse_item.mouse_move_to()
612 self.assertThat(mouse_item.selected, Eventually(Equals(True)))
613
614 self.keybinding("quicklist/keynav/prev")
615 sleep(.1)
616 self.keybinding("quicklist/keynav/prev")
617
618 key_item = self.quicklist.selectable_items[-3]
619 self.assertThat(key_item.selected, Eventually(Equals(True)))
620 self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id))
621
622 # Moving the mouse horizontally doesn't change the selection
623 self.mouse.move(mouse_item.x + mouse_item.width - 10, mouse_item.y + mouse_item.height / 2)
624 self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id))
625
626 # Moving the mouse outside doesn't change the selection
627 self.mouse.move(mouse_item.x + mouse_item.width + 50, mouse_item.y + mouse_item.height / 2)
628 self.assertThat(self.quicklist.selected_item.id, Equals(key_item.id))
629
630 # Moving the mouse to another entry, changes the selection
631 mouse_item = self.quicklist.selectable_items[-2]
632 mouse_item.mouse_move_to()
633 self.assertThat(mouse_item.selected, Eventually(Equals(True)))
634 self.assertThat(self.quicklist.selected_item.id, Equals(mouse_item.id))
635>>>>>>> MERGE-SOURCE
338636
=== modified file 'tests/autopilot/unity/tests/test_shortcut_hint.py'
--- tests/autopilot/unity/tests/test_shortcut_hint.py 2012-05-17 11:52:32 +0000
+++ tests/autopilot/unity/tests/test_shortcut_hint.py 2012-05-24 17:16:22 +0000
@@ -12,11 +12,21 @@
12from testtools.matchers import Equals12from testtools.matchers import Equals
13from time import sleep13from time import sleep
1414
15<<<<<<< TREE
15from unity.emulators.shortcut_hint import ShortcutController16from unity.emulators.shortcut_hint import ShortcutController
16from unity.tests import UnityTestCase17from unity.tests import UnityTestCase
1718
1819
19class BaseShortcutHintTests(UnityTestCase):20class BaseShortcutHintTests(UnityTestCase):
21=======
22from autopilot.emulators.unity.shortcut_hint import ShortcutController
23from autopilot.matchers import Eventually
24from autopilot.tests import AutopilotTestCase
25
26
27
28class BaseShortcutHintTests(AutopilotTestCase):
29>>>>>>> MERGE-SOURCE
20 """Base class for the shortcut hint tests"""30 """Base class for the shortcut hint tests"""
2131
22 def setUp(self):32 def setUp(self):
2333
=== modified file 'tests/test-gesture-engine/CMakeLists.txt'
=== added file 'tests/test_resultviewgrid.cpp'
--- tests/test_resultviewgrid.cpp 1970-01-01 00:00:00 +0000
+++ tests/test_resultviewgrid.cpp 2012-05-24 17:16:22 +0000
@@ -0,0 +1,103 @@
1// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2/*
3 * Copyright 2012 Canonical Ltd.
4 *
5 * This program is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU Lesser General Public License version 3, as
7 * published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranties of
11 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12 * PURPOSE. See the applicable version of the GNU Lesser General Public
13 * License for more details.
14 *
15 * You should have received a copy of both the GNU Lesser General Public
16 * License version 3 along with this program. If not, see
17 * <http://www.gnu.org/licenses/>
18 *
19 * Authored by: Andrea Azzarone <azzaronea@gmail.com>
20 *
21 */
22
23#include <gtest/gtest.h>
24#include <gmock/gmock.h>
25using namespace testing;
26
27#include "ResultViewGrid.h"
28using namespace unity;
29
30namespace
31{
32
33class MockResultViewGrid : public dash::ResultViewGrid
34{
35public:
36 MockResultViewGrid(NUX_FILE_LINE_DECL) : dash::ResultViewGrid(NUX_FILE_LINE_PARAM) {}
37
38 MOCK_METHOD0(QueueDraw, void());
39 MOCK_METHOD2(GetIndexAtPosition, uint(int x, int y));
40
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)
42 {
43 EmitMouseMoveSignal(x, y, dy, dy, mouse_button_state, special_keys_state);
44 }
45};
46
47class TestResultViewGrid : public Test
48{
49public:
50 virtual void SetUp()
51 {
52 view.Adopt(new MockResultViewGrid(NUX_TRACKER_LOCATION));
53 renderer.Adopt(new dash::ResultRenderer(NUX_TRACKER_LOCATION));
54
55 view->SetModelRenderer(renderer.GetPointer());
56 nux::GetWindowCompositor().SetKeyFocusArea(view.GetPointer());
57 }
58
59 nux::ObjectPtr<MockResultViewGrid> view;
60 nux::ObjectPtr<dash::ResultRenderer> renderer;
61};
62
63
64TEST_F(TestResultViewGrid, TestQueueDrawMouseMoveInsideUnfocusedIcon)
65{
66 EXPECT_CALL(*view, QueueDraw())
67 .Times(1);
68
69 EXPECT_CALL(*view, GetIndexAtPosition(_, _))
70 .WillOnce(Return(7));
71
72 view->FakeMouseMoveSignal();
73}
74
75
76TEST_F(TestResultViewGrid, TestQueueDrawMouseMoveInsideFocusedIcon)
77{
78 EXPECT_CALL(*view, GetIndexAtPosition(_, _))
79 .WillRepeatedly(Return(7));
80
81 view->FakeMouseMoveSignal();
82
83 EXPECT_CALL(*view, QueueDraw())
84 .Times(0);
85
86 view->FakeMouseMoveSignal();
87}
88
89
90TEST_F(TestResultViewGrid, TestQueueDrawMouseMoveOutside)
91{
92 EXPECT_CALL(*view, GetIndexAtPosition(_, _))
93 .WillRepeatedly(Return(-1));
94
95 view->FakeMouseMoveSignal();
96
97 EXPECT_CALL(*view, QueueDraw())
98 .Times(0);
99
100 view->FakeMouseMoveSignal();
101}
102
103}
0104
=== renamed file 'tests/test_resultviewgrid.cpp' => 'tests/test_resultviewgrid.cpp.moved'
=== modified file 'unity-shared/DashStyle.cpp'
=== modified file 'unity-shared/DashStyle.h'
=== modified file 'unity-shared/IconTexture.h'
=== modified file 'unity-shared/OverlayRenderer.cpp'
--- unity-shared/OverlayRenderer.cpp 2012-05-22 10:15:47 +0000
+++ unity-shared/OverlayRenderer.cpp 2012-05-24 17:16:22 +0000
@@ -378,8 +378,13 @@
378 bool paint_blur = BackgroundEffectHelper::blur_type != BLUR_NONE;378 bool paint_blur = BackgroundEffectHelper::blur_type != BLUR_NONE;
379 nux::Geometry geo(content_geo);379 nux::Geometry geo(content_geo);
380380
381<<<<<<< TREE
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;
382383
384=======
385 int excess_border = (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK || force_edges) ? EXCESS_BORDER : 0;
386
387>>>>>>> MERGE-SOURCE
383 nux::Geometry larger_content_geo = content_geo;388 nux::Geometry larger_content_geo = content_geo;
384 larger_content_geo.OffsetSize(excess_border, excess_border);389 larger_content_geo.OffsetSize(excess_border, excess_border);
385390
@@ -767,8 +772,13 @@
767 nux::Geometry geo = geometry;772 nux::Geometry geo = geometry;
768 bgs = 0;773 bgs = 0;
769774
775<<<<<<< TREE
770 int excess_border = (Settings::Instance().GetFormFactor() != FormFactor::NETBOOK) ? EXCESS_BORDER : 0;776 int excess_border = (Settings::Instance().GetFormFactor() != FormFactor::NETBOOK) ? EXCESS_BORDER : 0;
771777
778=======
779 int excess_border = (dash::Settings::Instance().GetFormFactor() != dash::FormFactor::NETBOOK) ? EXCESS_BORDER : 0;
780
781>>>>>>> MERGE-SOURCE
772 nux::Geometry larger_content_geo = content_geo;782 nux::Geometry larger_content_geo = content_geo;
773 larger_content_geo.OffsetSize(excess_border, excess_border);783 larger_content_geo.OffsetSize(excess_border, excess_border);
774784
775785
=== modified file 'unity-shared/SearchBar.cpp'
=== modified file 'unity-shared/UnityWindowView.h'
--- unity-shared/UnityWindowView.h 2012-05-17 11:52:32 +0000
+++ unity-shared/UnityWindowView.h 2012-05-24 17:16:22 +0000
@@ -20,8 +20,13 @@
20#ifndef UNITYWINDOWVIEW_H20#ifndef UNITYWINDOWVIEW_H
21#define UNITYWINDOWVIEW_H21#define UNITYWINDOWVIEW_H
2222
23<<<<<<< TREE
23#include "unity-shared/BackgroundEffectHelper.h"24#include "unity-shared/BackgroundEffectHelper.h"
24#include "Introspectable.h"25#include "Introspectable.h"
26=======
27#include "BackgroundEffectHelper.h"
28#include "Introspectable.h"
29>>>>>>> MERGE-SOURCE
25#include "UnityWindowStyle.h"30#include "UnityWindowStyle.h"
26#include <sigc++/sigc++.h>31#include <sigc++/sigc++.h>
2732
2833
=== modified file 'unity-shared/WindowManager.h'
--- unity-shared/WindowManager.h 2012-05-07 00:49:31 +0000
+++ unity-shared/WindowManager.h 2012-05-24 17:16:22 +0000
@@ -23,9 +23,15 @@
23#include <gdk/gdkx.h>23#include <gdk/gdkx.h>
24#include <core/core.h>24#include <core/core.h>
2525
26<<<<<<< TREE
26#include "unity-shared/Introspectable.h"27#include "unity-shared/Introspectable.h"
2728
28class WindowManager : public unity::debug::Introspectable29class WindowManager : public unity::debug::Introspectable
30=======
31#include "Introspectable.h"
32
33class WindowManager : public unity::debug::Introspectable
34>>>>>>> MERGE-SOURCE
29{35{
30 // This is a glue interface that breaks the dependancy of Unity with Compiz36 // This is a glue interface that breaks the dependancy of Unity with Compiz
31 // Basically it has a default implementation that does nothing useful, but37 // Basically it has a default implementation that does nothing useful, but