Merge lp:~3v1n0/unity/launchers-resize-new into lp:unity
- launchers-resize-new
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Marco Trevisan (Treviño) |
Approved revision: | no longer in the source branch. |
Merged at revision: | 3051 |
Proposed branch: | lp:~3v1n0/unity/launchers-resize-new |
Merge into: | lp:unity |
Prerequisite: | lp:~3v1n0/unity/new-launcher-assets |
Diff against target: |
539 lines (+146/-75) 10 files modified
launcher/EdgeBarrierController.h (+1/-2) launcher/Launcher.cpp (+26/-34) launcher/Launcher.h (+2/-2) launcher/LauncherController.cpp (+24/-10) launcher/LauncherControllerPrivate.h (+1/-1) launcher/LauncherOptions.cpp (+3/-1) launcher/LauncherOptions.h (+2/-1) launcher/StandaloneLauncher.cpp (+58/-18) tests/test_launcher_controller.cpp (+24/-2) tests/test_uscreen_mock.h (+5/-4) |
To merge this branch: | bzr merge lp:~3v1n0/unity/launchers-resize-new |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Needs Fixing | |
Andrea Azzarone (community) | Approve | ||
Review via email: mp+135816@code.launchpad.net |
Commit message
Launcher: improve the monitor resizing and background color management, tune the standalone version.
Description of the change
Misc cleanup in Launcher, added a single property in options to manage the launcher background color, using the monitor property to handle monitor changes.
Improved the launcher standalone, so that the view now matches the window size.
Added new tests.
Andrea Azzarone (azzar1) wrote : | # |
*regressions :)
MC Return (mc-return) wrote : | # |
Approved on 2012-11-29.
Will this ever land ?
I guess something's wrong here :)
Martin Mrazik (mrazik) wrote : | # |
This is weird as I have a watchdog which is looking for approved but unmerged MPs. The watchdog noticed this MP only after you made the comment so I assume there was something wrong on the launchpad side.
Martin Mrazik (mrazik) wrote : | # |
Oh, now I actually see it. It didn't merge previously because the prerequisite was merged only a while ago.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Łukasz Zemczak (sil2100) wrote : | # |
This branch needs re-merging with trunk.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
Preview Diff
1 | === modified file 'launcher/EdgeBarrierController.h' |
2 | --- launcher/EdgeBarrierController.h 2012-07-25 23:18:17 +0000 |
3 | +++ launcher/EdgeBarrierController.h 2013-01-18 18:26:28 +0000 |
4 | @@ -26,9 +26,8 @@ |
5 | namespace unity { |
6 | namespace ui { |
7 | |
8 | -class EdgeBarrierSubscriber |
9 | +struct EdgeBarrierSubscriber |
10 | { |
11 | -public: |
12 | virtual bool HandleBarrierEvent(PointerBarrierWrapper* owner, BarrierEvent::Ptr event) = 0; |
13 | }; |
14 | |
15 | |
16 | === modified file 'launcher/Launcher.cpp' |
17 | --- launcher/Launcher.cpp 2013-01-17 23:44:13 +0000 |
18 | +++ launcher/Launcher.cpp 2013-01-18 18:26:28 +0000 |
19 | @@ -144,7 +144,7 @@ |
20 | , _drag_gesture_ongoing(false) |
21 | , _last_reveal_progress(0.0f) |
22 | , _selection_atom(0) |
23 | - , _background_color(nux::color::DimGray) |
24 | + , icon_renderer(std::make_shared<ui::IconRenderer>()) |
25 | { |
26 | m_Layout = new nux::HLayout(NUX_TRACKER_LOCATION); |
27 | |
28 | @@ -190,13 +190,8 @@ |
29 | |
30 | ubus_.RegisterInterest(UBUS_OVERLAY_SHOWN, sigc::mem_fun(this, &Launcher::OnOverlayShown)); |
31 | ubus_.RegisterInterest(UBUS_OVERLAY_HIDDEN, sigc::mem_fun(this, &Launcher::OnOverlayHidden)); |
32 | - ubus_.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED, sigc::mem_fun(this, &Launcher::OnBGColorChanged)); |
33 | ubus_.RegisterInterest(UBUS_LAUNCHER_LOCK_HIDE, sigc::mem_fun(this, &Launcher::OnLockHideChanged)); |
34 | |
35 | - // request the latest colour from bghash |
36 | - ubus_.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT); |
37 | - |
38 | - icon_renderer = ui::AbstractIconRenderer::Ptr(new ui::IconRenderer()); |
39 | icon_renderer->SetTargetSize(_icon_size, _icon_image_size, _space_between_icons); |
40 | |
41 | TextureCache& cache = TextureCache::GetDefault(); |
42 | @@ -208,6 +203,7 @@ |
43 | launcher_pressure_effect_ = cache.FindTexture("launcher_pressure_effect", 0, 0, cb); |
44 | |
45 | options.changed.connect(sigc::mem_fun(this, &Launcher::OnOptionsChanged)); |
46 | + monitor.changed.connect(sigc::mem_fun(this, &Launcher::OnMonitorChanged)); |
47 | } |
48 | |
49 | /* Introspection */ |
50 | @@ -989,7 +985,7 @@ |
51 | struct timespec current; |
52 | clock_gettime(CLOCK_MONOTONIC, ¤t); |
53 | |
54 | - nux::Color colorify = FullySaturateColor(_background_color); |
55 | + nux::Color const& colorify = FullySaturateColor(options()->background_color); |
56 | |
57 | float hover_progress = GetHoverProgress(current); |
58 | float folded_z_distance = _folded_z_distance * (1.0f - hover_progress); |
59 | @@ -1171,17 +1167,6 @@ |
60 | EnsureAnimation(); |
61 | } |
62 | |
63 | -void Launcher::OnBGColorChanged(GVariant *data) |
64 | -{ |
65 | - ui::IconRenderer::DestroyShortcutTextures(); |
66 | - |
67 | - double red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f; |
68 | - |
69 | - g_variant_get(data, "(dddd)", &red, &green, &blue, &alpha); |
70 | - _background_color = nux::Color(red, green, blue, alpha); |
71 | - QueueDraw(); |
72 | -} |
73 | - |
74 | void Launcher::OnLockHideChanged(GVariant *data) |
75 | { |
76 | gboolean enable_lock = FALSE; |
77 | @@ -1390,6 +1375,16 @@ |
78 | UpdateOptions(options()); |
79 | } |
80 | |
81 | +void Launcher::OnMonitorChanged(int new_monitor) |
82 | +{ |
83 | + UScreen* uscreen = UScreen::GetDefault(); |
84 | + auto monitor_geo = uscreen->GetMonitorGeometry(new_monitor); |
85 | + unity::panel::Style &panel_style = panel::Style::Instance(); |
86 | + |
87 | + Resize(nux::Point(monitor_geo.x, monitor_geo.y + panel_style.panel_height), |
88 | + monitor_geo.height - panel_style.panel_height); |
89 | +} |
90 | + |
91 | void Launcher::UpdateOptions(Options::Ptr options) |
92 | { |
93 | SetIconSize(options->tile_size, options->icon_size); |
94 | @@ -1574,24 +1569,21 @@ |
95 | |
96 | icon_renderer->SetTargetSize(_icon_size, _icon_image_size, _space_between_icons); |
97 | |
98 | - Resize(); |
99 | + nux::Geometry const& parent_geo = _parent->GetGeometry(); |
100 | + Resize(nux::Point(parent_geo.x, parent_geo.y), parent_geo.height); |
101 | } |
102 | |
103 | int Launcher::GetIconSize() const |
104 | { |
105 | - return _icon_size; |
106 | + return _icon_size; |
107 | } |
108 | |
109 | -void Launcher::Resize() |
110 | +void Launcher::Resize(nux::Point const& offset, int height) |
111 | { |
112 | - UScreen* uscreen = UScreen::GetDefault(); |
113 | - auto geo = uscreen->GetMonitorGeometry(monitor()); |
114 | - unity::panel::Style &panel_style = panel::Style::Instance(); |
115 | - int width = _icon_size + ICON_PADDING*2 + RIGHT_LINE_WIDTH - 2; |
116 | - nux::Geometry new_geometry(geo.x, geo.y + panel_style.panel_height, width, geo.height - panel_style.panel_height); |
117 | - SetMaximumHeight(new_geometry.height); |
118 | - _parent->SetGeometry(new_geometry); |
119 | - SetGeometry(nux::Geometry(0, 0, new_geometry.width, new_geometry.height)); |
120 | + unsigned width = _icon_size + ICON_PADDING * 2 + RIGHT_LINE_WIDTH - 2; |
121 | + _parent->SetGeometry(nux::Geometry(offset.x, offset.y, width, height)); |
122 | + SetGeometry(nux::Geometry(0, 0, width, height)); |
123 | + SetMaximumHeight(height); |
124 | |
125 | ConfigureBarrier(); |
126 | } |
127 | @@ -1722,7 +1714,7 @@ |
128 | |
129 | if (Settings::Instance().GetLowGfxMode()) |
130 | { |
131 | - clear_colour = _background_color; |
132 | + clear_colour = options()->background_color; |
133 | clear_colour.alpha = 1.0f; |
134 | } |
135 | |
136 | @@ -1796,7 +1788,7 @@ |
137 | blur_texture, |
138 | texxform_blur_bg, |
139 | nux::color::White, |
140 | - _background_color, nux::LAYER_BLEND_MODE_OVERLAY, |
141 | + options()->background_color, nux::LAYER_BLEND_MODE_OVERLAY, |
142 | true, ROP); |
143 | else |
144 | gPainter.PushDrawTextureLayer(GfxContext, base, |
145 | @@ -1810,7 +1802,7 @@ |
146 | blur_texture, |
147 | texxform_blur_bg, |
148 | nux::color::White, |
149 | - _background_color, nux::LAYER_BLEND_MODE_OVERLAY, |
150 | + options()->background_color, nux::LAYER_BLEND_MODE_OVERLAY, |
151 | true, ROP); |
152 | #endif |
153 | GfxContext.PopClippingRectangle(); |
154 | @@ -1829,7 +1821,7 @@ |
155 | // apply the bg colour |
156 | #ifndef NUX_OPENGLES_20 |
157 | if (GfxContext.UsingGLSLCodePath() == false) |
158 | - gPainter.Paint2DQuadColor(GfxContext, bkg_box, _background_color); |
159 | + gPainter.Paint2DQuadColor(GfxContext, bkg_box, options()->background_color); |
160 | #endif |
161 | |
162 | // apply the shine |
163 | @@ -1849,7 +1841,7 @@ |
164 | } |
165 | else |
166 | { |
167 | - nux::Color color = _background_color; |
168 | + nux::Color color = options()->background_color; |
169 | color.alpha = options()->background_alpha; |
170 | gPainter.Paint2DQuadColor(GfxContext, bkg_box, color); |
171 | } |
172 | |
173 | === modified file 'launcher/Launcher.h' |
174 | --- launcher/Launcher.h 2012-11-15 19:46:04 +0000 |
175 | +++ launcher/Launcher.h 2013-01-18 18:26:28 +0000 |
176 | @@ -121,7 +121,7 @@ |
177 | int GetMouseX() const; |
178 | int GetMouseY() const; |
179 | |
180 | - void Resize(); |
181 | + void Resize(nux::Point const& offset, int height); |
182 | |
183 | int GetDragDelta() const; |
184 | void SetHover(bool hovered); |
185 | @@ -196,6 +196,7 @@ |
186 | |
187 | void ConfigureBarrier(); |
188 | |
189 | + void OnMonitorChanged(int monitor); |
190 | void OnOptionsChanged(Options::Ptr options); |
191 | void OnOptionChanged(); |
192 | void UpdateOptions(Options::Ptr options); |
193 | @@ -392,7 +393,6 @@ |
194 | |
195 | struct timespec _times[TIME_LAST]; |
196 | |
197 | - nux::Color _background_color; |
198 | BaseTexturePtr launcher_sheen_; |
199 | BaseTexturePtr launcher_pressure_effect_; |
200 | |
201 | |
202 | === modified file 'launcher/LauncherController.cpp' |
203 | --- launcher/LauncherController.cpp 2013-01-08 11:47:00 +0000 |
204 | +++ launcher/LauncherController.cpp 2013-01-18 18:26:28 +0000 |
205 | @@ -40,6 +40,7 @@ |
206 | #include "ExpoLauncherIcon.h" |
207 | #include "TrashLauncherIcon.h" |
208 | #include "BFBLauncherIcon.h" |
209 | +#include "unity-shared/IconRenderer.h" |
210 | #include "unity-shared/UScreen.h" |
211 | #include "unity-shared/UBusMessages.h" |
212 | #include "unity-shared/TimeUtil.h" |
213 | @@ -119,6 +120,17 @@ |
214 | edge_barriers_.options = parent_->options(); |
215 | #endif |
216 | |
217 | + ubus.RegisterInterest(UBUS_BACKGROUND_COLOR_CHANGED, [this](GVariant * data) { |
218 | + ui::IconRenderer::DestroyShortcutTextures(); |
219 | + |
220 | + double red = 0.0f, green = 0.0f, blue = 0.0f, alpha = 0.0f; |
221 | + g_variant_get(data, "(dddd)", &red, &green, &blue, &alpha); |
222 | + parent_->options()->background_color = nux::Color(red, green, blue, alpha); |
223 | + }); |
224 | + |
225 | + // request the latest color from bghash |
226 | + ubus.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT); |
227 | + |
228 | UScreen* uscreen = UScreen::GetDefault(); |
229 | EnsureLaunchers(uscreen->GetPrimaryMonitor(), uscreen->GetMonitors()); |
230 | |
231 | @@ -148,7 +160,7 @@ |
232 | wm.window_focus_changed.connect(sigc::mem_fun(this, &Controller::Impl::OnWindowFocusChanged)); |
233 | wm.viewport_layout_changed.connect(sigc::group(sigc::mem_fun(this, &Controller::Impl::UpdateNumWorkspaces), sigc::_1 * sigc::_2)); |
234 | |
235 | - ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [&](GVariant * args) { |
236 | + ubus.RegisterInterest(UBUS_QUICKLIST_END_KEY_NAV, [this](GVariant * args) { |
237 | if (reactivate_keynav) |
238 | parent_->KeyNavGrab(); |
239 | |
240 | @@ -197,24 +209,27 @@ |
241 | { |
242 | if (i >= launchers_size) |
243 | { |
244 | - launchers.push_back(nux::ObjectPtr<Launcher>(CreateLauncher(i))); |
245 | + launchers.push_back(nux::ObjectPtr<Launcher>(CreateLauncher())); |
246 | } |
247 | else if (!launchers[i]) |
248 | { |
249 | - launchers[i] = nux::ObjectPtr<Launcher>(CreateLauncher(i)); |
250 | + launchers[i] = nux::ObjectPtr<Launcher>(CreateLauncher()); |
251 | } |
252 | |
253 | int monitor = (num_launchers == 1) ? primary : i; |
254 | |
255 | -#ifdef USE_X11 |
256 | if (launchers[i]->monitor() != monitor) |
257 | { |
258 | +#ifdef USE_X11 |
259 | edge_barriers_.Unsubscribe(launchers[i].GetPointer(), launchers[i]->monitor); |
260 | - } |
261 | #endif |
262 | + launchers[i]->monitor = monitor; |
263 | + } |
264 | + else |
265 | + { |
266 | + launchers[i]->monitor.changed(monitor); |
267 | + } |
268 | |
269 | - launchers[i]->monitor(monitor); |
270 | - launchers[i]->Resize(); |
271 | #ifdef USE_X11 |
272 | edge_barriers_.Subscribe(launchers[i].GetPointer(), launchers[i]->monitor); |
273 | #endif |
274 | @@ -222,7 +237,7 @@ |
275 | |
276 | for (unsigned int i = last_launcher; i < launchers_size; ++i) |
277 | { |
278 | - auto launcher = launchers[i]; |
279 | + auto const& launcher = launchers[i]; |
280 | if (launcher) |
281 | { |
282 | parent_->RemoveChild(launcher.GetPointer()); |
283 | @@ -297,12 +312,11 @@ |
284 | } |
285 | } |
286 | |
287 | -Launcher* Controller::Impl::CreateLauncher(int monitor) |
288 | +Launcher* Controller::Impl::CreateLauncher() |
289 | { |
290 | nux::BaseWindow* launcher_window = new nux::BaseWindow(TEXT("LauncherWindow")); |
291 | |
292 | Launcher* launcher = new Launcher(launcher_window); |
293 | - launcher->monitor = monitor; |
294 | launcher->options = parent_->options(); |
295 | launcher->SetModel(model_); |
296 | |
297 | |
298 | === modified file 'launcher/LauncherControllerPrivate.h' |
299 | --- launcher/LauncherControllerPrivate.h 2012-12-07 04:21:35 +0000 |
300 | +++ launcher/LauncherControllerPrivate.h 2013-01-18 18:26:28 +0000 |
301 | @@ -54,7 +54,7 @@ |
302 | |
303 | void UpdateNumWorkspaces(int workspaces); |
304 | |
305 | - Launcher* CreateLauncher(int monitor); |
306 | + Launcher* CreateLauncher(); |
307 | |
308 | void SaveIconsOrder(); |
309 | void SortAndUpdate(); |
310 | |
311 | === modified file 'launcher/LauncherOptions.cpp' |
312 | --- launcher/LauncherOptions.cpp 2012-12-14 18:12:52 +0000 |
313 | +++ launcher/LauncherOptions.cpp 2013-01-18 18:26:28 +0000 |
314 | @@ -33,9 +33,10 @@ |
315 | , auto_hide_animation(FADE_AND_SLIDE) |
316 | , backlight_mode(BACKLIGHT_NORMAL) |
317 | , reveal_trigger(RevealTrigger::EDGE) |
318 | + , background_color(nux::Color(95, 18, 45)) |
319 | + , background_alpha(0.6667) |
320 | , icon_size(48) |
321 | , tile_size(54) |
322 | - , background_alpha(0.6667) |
323 | , edge_decay_rate(1500) |
324 | , edge_overcome_pressure(2000) |
325 | , edge_stop_velocity(6500) |
326 | @@ -51,6 +52,7 @@ |
327 | |
328 | auto_hide_animation.changed.connect(sigc::hide(changed_lambda)); |
329 | background_alpha.changed.connect(sigc::hide(changed_lambda)); |
330 | + background_color.changed.connect(sigc::hide(changed_lambda)); |
331 | backlight_mode.changed.connect(sigc::hide(changed_lambda)); |
332 | edge_decay_rate.changed.connect(sigc::hide(changed_lambda)); |
333 | edge_overcome_pressure.changed.connect(sigc::hide(changed_lambda)); |
334 | |
335 | === modified file 'launcher/LauncherOptions.h' |
336 | --- launcher/LauncherOptions.h 2012-12-14 18:12:52 +0000 |
337 | +++ launcher/LauncherOptions.h 2013-01-18 18:26:28 +0000 |
338 | @@ -89,9 +89,10 @@ |
339 | nux::Property<AutoHideAnimation> auto_hide_animation; |
340 | nux::Property<BacklightMode> backlight_mode; |
341 | nux::Property<RevealTrigger> reveal_trigger; |
342 | + nux::Property<nux::Color> background_color; |
343 | + nux::Property<float> background_alpha; |
344 | nux::Property<int> icon_size; |
345 | nux::Property<int> tile_size; |
346 | - nux::Property<float> background_alpha; |
347 | nux::Property<int> edge_decay_rate; |
348 | nux::Property<int> edge_overcome_pressure; |
349 | nux::Property<int> edge_stop_velocity; |
350 | |
351 | === modified file 'launcher/StandaloneLauncher.cpp' |
352 | --- launcher/StandaloneLauncher.cpp 2013-01-17 14:09:35 +0000 |
353 | +++ launcher/StandaloneLauncher.cpp 2013-01-18 18:26:28 +0000 |
354 | @@ -27,35 +27,75 @@ |
355 | #include "Launcher.h" |
356 | #include "unity-shared/IconRenderer.h" |
357 | #include "unity-shared/PanelStyle.h" |
358 | +#include "unity-shared/UBusMessages.h" |
359 | #include "unity-shared/UnitySettings.h" |
360 | +#include "unity-shared/UScreen.h" |
361 | |
362 | using namespace unity; |
363 | |
364 | -static launcher::Controller::Ptr controller; |
365 | - |
366 | -void ThreadWidgetInit(nux::NThread* thread, void* InitData) |
367 | +namespace |
368 | { |
369 | - auto xdnd_manager = std::make_shared<XdndManager>(); |
370 | - controller = std::make_shared<launcher::Controller>(xdnd_manager); |
371 | +const nux::Size win_size(1024, 768); |
372 | +const nux::Color bg_color(95/255.0f, 18/255.0f, 45/255.0f, 1.0f); |
373 | } |
374 | |
375 | +struct LauncherWindow |
376 | +{ |
377 | + LauncherWindow() |
378 | + : wt(nux::CreateGUIThread("Unity Launcher", win_size.width, win_size.height, 0, &LauncherWindow::ThreadWidgetInit, this)) |
379 | + {} |
380 | + |
381 | + void Show() |
382 | + { |
383 | + wt->Run(nullptr); |
384 | + } |
385 | + |
386 | +private: |
387 | + void SetupBackground() |
388 | + { |
389 | + nux::ObjectPtr<nux::BaseTexture> background_tex; |
390 | + background_tex.Adopt(nux::CreateTextureFromFile("/usr/share/backgrounds/warty-final-ubuntu.png")); |
391 | + nux::TexCoordXForm texxform; |
392 | + auto tex_layer = std::make_shared<nux::TextureLayer>(background_tex->GetDeviceTexture(), texxform, nux::color::White); |
393 | + wt->SetWindowBackgroundPaintLayer(tex_layer.get()); |
394 | + } |
395 | + |
396 | + void Init() |
397 | + { |
398 | + SetupBackground(); |
399 | + controller.reset(new launcher::Controller(std::make_shared<XdndManager>())); |
400 | + controller->launcher().GetParent()->EnableInputWindow(false); |
401 | + |
402 | + UScreen* uscreen = UScreen::GetDefault(); |
403 | + std::vector<nux::Geometry> fake_monitor({nux::Geometry(0, 0, win_size.width, win_size.height)}); |
404 | + uscreen->changed.emit(0, fake_monitor); |
405 | + uscreen->changed.clear(); |
406 | + controller->launcher().Resize(nux::Point(), win_size.height); |
407 | + |
408 | + wt->window_configuration.connect([this] (int x, int y, int w, int h) { |
409 | + controller->launcher().Resize(nux::Point(), h); |
410 | + }); |
411 | + } |
412 | + |
413 | + static void ThreadWidgetInit(nux::NThread* thread, void* self) |
414 | + { |
415 | + static_cast<LauncherWindow*>(self)->Init(); |
416 | + } |
417 | + |
418 | + internal::FavoriteStoreGSettings favorite_store; |
419 | + unity::Settings settings; |
420 | + panel::Style panel_style; |
421 | + std::shared_ptr<nux::WindowThread> wt; |
422 | + launcher::Controller::Ptr controller; |
423 | +}; |
424 | + |
425 | int main(int argc, char** argv) |
426 | { |
427 | gtk_init(&argc, &argv); |
428 | nux::NuxInitialize(0); |
429 | |
430 | - unity::Settings settings; |
431 | - panel::Style panel_style; |
432 | - internal::FavoriteStoreGSettings favorite_store; |
433 | - |
434 | - BackgroundEffectHelper::blur_type = BLUR_NONE; |
435 | - nux::WindowThread* wt = nux::CreateGUIThread(TEXT("Unity Switcher"), 300, 800, 0, &ThreadWidgetInit, 0); |
436 | - |
437 | - wt->Run(NULL); |
438 | - // Make sure the controller is destroyed before the window thread. |
439 | - controller.reset(); |
440 | - ::unity::ui::IconRenderer::DestroyTextures(); |
441 | - |
442 | - delete wt; |
443 | + LauncherWindow lc; |
444 | + lc.Show(); |
445 | + |
446 | return 0; |
447 | } |
448 | |
449 | === modified file 'tests/test_launcher_controller.cpp' |
450 | --- tests/test_launcher_controller.cpp 2013-01-14 23:11:05 +0000 |
451 | +++ tests/test_launcher_controller.cpp 2013-01-18 18:26:28 +0000 |
452 | @@ -327,7 +327,7 @@ |
453 | |
454 | for (int i = 0; i < max_num_monitors; ++i) |
455 | { |
456 | - EXPECT_EQ(lc.launchers()[i]->monitor(), i); |
457 | + ASSERT_EQ(lc.launchers()[i]->monitor(), i); |
458 | } |
459 | } |
460 | |
461 | @@ -389,7 +389,7 @@ |
462 | ASSERT_EQ(lc.launchers().size(), max_num_monitors - 1); |
463 | |
464 | for (int i = 0; i < max_num_monitors - 1; ++i) |
465 | - EXPECT_EQ(lc.launchers()[i]->monitor(), i); |
466 | + ASSERT_EQ(lc.launchers()[i]->monitor(), i); |
467 | } |
468 | |
469 | TEST_F(TestLauncherController, SingleMonitorSwitchToMultimonitor) |
470 | @@ -436,6 +436,20 @@ |
471 | |
472 | #endif |
473 | |
474 | +TEST_F(TestLauncherController, MultimonitorGeometries) |
475 | +{ |
476 | + uscreen.SetupFakeMultiMonitor(); |
477 | + |
478 | + for (int i = 0; i < max_num_monitors; ++i) |
479 | + { |
480 | + auto const& monitor_geo = uscreen.GetMonitorGeometry(i); |
481 | + auto const& launcher_geo = lc.launchers()[i]->GetAbsoluteGeometry(); |
482 | + ASSERT_EQ(launcher_geo.x, monitor_geo.x); |
483 | + ASSERT_EQ(launcher_geo.y, monitor_geo.y + panel_style.panel_height); |
484 | + ASSERT_EQ(launcher_geo.height, monitor_geo.height - panel_style.panel_height); |
485 | + } |
486 | +} |
487 | + |
488 | TEST_F(TestLauncherController, OnlyUnstickIconOnFavoriteRemoval) |
489 | { |
490 | const std::string desktop = app::BZR_HANDLE_PATCH; |
491 | @@ -1555,6 +1569,14 @@ |
492 | ASSERT_EQ(lc.Impl()->model_->Selection()->tooltip_text(), last_selection_change); |
493 | } |
494 | |
495 | +TEST_F(TestLauncherController, UpdateLaunchersBackgroundColor) |
496 | +{ |
497 | + UBusManager().SendMessage(UBUS_BACKGROUND_COLOR_CHANGED, |
498 | + g_variant_new("(dddd)", 11/255.0f, 22/255.0f, 33/255.0f, 1.0f)); |
499 | + |
500 | + Utils::WaitUntil([this] { return lc.options()->background_color == nux::Color(11, 22, 33); }); |
501 | +} |
502 | + |
503 | // thumper: 2012-11-28 disabling the drag and drop tests as they are taking over 20s |
504 | // each, and that is not acceptable for unit tests. These sound more like functional |
505 | // tests. |
506 | |
507 | === modified file 'tests/test_uscreen_mock.h' |
508 | --- tests/test_uscreen_mock.h 2012-07-24 20:22:08 +0000 |
509 | +++ tests/test_uscreen_mock.h 2013-01-18 18:26:28 +0000 |
510 | @@ -44,16 +44,17 @@ |
511 | default_screen_ = nullptr; |
512 | } |
513 | |
514 | - void Reset(bool emit = true) |
515 | + void Reset(bool emit_change = true) |
516 | { |
517 | default_screen_ = this; |
518 | primary_ = 0; |
519 | monitors_ = {nux::Geometry(0, 0, MONITOR_WIDTH, MONITOR_HEIGHT)}; |
520 | |
521 | - changed.emit(primary_, monitors_); |
522 | + if (emit_change) |
523 | + changed.emit(primary_, monitors_); |
524 | } |
525 | |
526 | - void SetupFakeMultiMonitor(int primary = 0, bool emit_update = true) |
527 | + void SetupFakeMultiMonitor(int primary = 0, bool emit_change = true) |
528 | { |
529 | SetPrimary(primary, false); |
530 | monitors_.clear(); |
531 | @@ -63,7 +64,7 @@ |
532 | monitors_.push_back(nux::Geometry(MONITOR_WIDTH, MONITOR_HEIGHT, total_width, 0)); |
533 | total_width += MONITOR_WIDTH; |
534 | |
535 | - if (emit_update) |
536 | + if (emit_change) |
537 | changed.emit(GetPrimaryMonitor(), GetMonitors()); |
538 | } |
539 | } |
LGTM. Can't see any regression here and all tests pass.