Merge lp:~unity-team/unity/y-sru1 into lp:unity/yakkety

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 4195
Proposed branch: lp:~unity-team/unity/y-sru1
Merge into: lp:unity/yakkety
Diff against target: 602 lines (+370/-41)
13 files modified
UnityCore/GnomeSessionManager.cpp (+59/-26)
UnityCore/GnomeSessionManagerImpl.h (+2/-0)
UnityCore/Variant.cpp (+30/-0)
UnityCore/Variant.h (+1/-0)
debian/changelog (+17/-0)
decorations/DecorationsForceQuitDialog.cpp (+4/-2)
launcher/FileManagerLauncherIcon.cpp (+30/-0)
launcher/FileManagerLauncherIcon.h (+8/-0)
launcher/StorageLauncherIcon.cpp (+7/-12)
lockscreen/LockScreenController.cpp (+1/-0)
tests/CMakeLists.txt (+1/-0)
tests/test_file_manager_launcher_icon.cpp (+202/-0)
tests/test_gnome_session_manager.cpp (+8/-1)
To merge this branch: bzr merge lp:~unity-team/unity/y-sru1
Reviewer Review Type Date Requested Status
Andrea Azzarone (community) Approve
Review via email: mp+310650@code.launchpad.net

Commit message

Releasing SRU1 for yakkety

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

+1 Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UnityCore/GnomeSessionManager.cpp'
2--- UnityCore/GnomeSessionManager.cpp 2016-09-01 17:18:03 +0000
3+++ UnityCore/GnomeSessionManager.cpp 2016-11-11 14:53:10 +0000
4@@ -101,32 +101,37 @@
5 });
6
7 {
8- const char* session_id = test_mode_ ? "id0" : g_getenv("XDG_SESSION_ID");
9-
10- login_proxy_ = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.login1",
11- "/org/freedesktop/login1/session/" + glib::gchar_to_string(session_id),
12- "org.freedesktop.login1.Session",
13- test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
14- G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES);
15-
16- login_proxy_->Connect("Lock", [this](GVariant*){
17- manager_->PromptLockScreen();
18- });
19-
20- login_proxy_->Connect("Unlock", [this](GVariant*){
21- manager_->unlock_requested.emit();
22- });
23-
24- login_proxy_->ConnectProperty("Active", [this] (GVariant* variant) {
25- bool active = glib::Variant(variant).GetBool();
26- manager_->is_session_active.changed.emit(active);
27- if (active)
28- manager_->screensaver_requested.emit(false);
29- });
30-
31- manager_->is_session_active.SetGetterFunction([this] {
32- return login_proxy_->GetProperty("Active").GetBool();
33- });
34+ std::string session_id = test_mode_ ? "id0" : glib::gchar_to_string(g_getenv("XDG_SESSION_ID"));
35+
36+ if (!session_id.empty())
37+ {
38+ CallLogindMethod("GetSession", g_variant_new("(s)", session_id.c_str()), [this, session_id] (GVariant* variant, glib::Error const& err) {
39+ std::string session_path;
40+
41+ if (!err && variant)
42+ session_path = glib::Variant(variant).GetObjectPath();
43+
44+ if (session_path.empty())
45+ session_path = "/org/freedesktop/login1/session/" + session_id;
46+
47+ SetupLogin1Proxy(session_path);
48+ });
49+ }
50+ else
51+ {
52+ auto proxy = std::make_shared<glib::DBusProxy>("org.freedesktop.login1",
53+ "/org/freedesktop/login1/user/self",
54+ "org.freedesktop.login1.User",
55+ G_BUS_TYPE_SYSTEM);
56+
57+ proxy->GetProperty("Display", [this, proxy] (GVariant *variant) {
58+ if (!variant || g_variant_n_children(variant) < 2)
59+ return;
60+
61+ glib::Variant tmp(g_variant_get_child_value(variant, 1), glib::StealRef());
62+ SetupLogin1Proxy(tmp.GetObjectPath());
63+ });
64+ }
65 }
66
67 {
68@@ -221,6 +226,34 @@
69 ClosedDialog();
70 }
71
72+void GnomeManager::Impl::SetupLogin1Proxy(std::string const& session_path)
73+{
74+ login_proxy_ = std::make_shared<glib::DBusProxy>(test_mode_ ? testing::DBUS_NAME : "org.freedesktop.login1",
75+ session_path,
76+ "org.freedesktop.login1.Session",
77+ test_mode_ ? G_BUS_TYPE_SESSION : G_BUS_TYPE_SYSTEM,
78+ G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES);
79+
80+ login_proxy_->Connect("Lock", [this](GVariant*){
81+ manager_->PromptLockScreen();
82+ });
83+
84+ login_proxy_->Connect("Unlock", [this](GVariant*){
85+ manager_->unlock_requested.emit();
86+ });
87+
88+ login_proxy_->ConnectProperty("Active", [this] (GVariant* variant) {
89+ bool active = glib::Variant(variant).GetBool();
90+ manager_->is_session_active.changed.emit(active);
91+ if (active)
92+ manager_->screensaver_requested.emit(false);
93+ });
94+
95+ manager_->is_session_active.SetGetterFunction([this] {
96+ return login_proxy_->GetProperty("Active").GetBool();
97+ });
98+}
99+
100 bool GnomeManager::Impl::InteractiveMode()
101 {
102 bool schema_found = false;
103
104=== modified file 'UnityCore/GnomeSessionManagerImpl.h'
105--- UnityCore/GnomeSessionManagerImpl.h 2015-12-03 05:57:00 +0000
106+++ UnityCore/GnomeSessionManagerImpl.h 2016-11-11 14:53:10 +0000
107@@ -46,6 +46,8 @@
108 Impl(GnomeManager* parent, bool test_mode = false);
109 ~Impl();
110
111+ void SetupLogin1Proxy(std::string const& session_path);
112+
113 void ConfirmLogout();
114 void ConfirmReboot();
115 void ConfirmShutdown();
116
117=== modified file 'UnityCore/Variant.cpp'
118--- UnityCore/Variant.cpp 2013-11-19 20:28:13 +0000
119+++ UnityCore/Variant.cpp 2016-11-11 14:53:10 +0000
120@@ -174,6 +174,36 @@
121 return result ? result : "";
122 }
123
124+std::string Variant::GetObjectPath() const
125+{
126+ const gchar *result = nullptr;
127+
128+ if (!variant_)
129+ return "";
130+
131+ if (g_variant_is_of_type(variant_, G_VARIANT_TYPE_OBJECT_PATH))
132+ {
133+ // g_variant_get_string doesn't duplicate the string
134+ result = g_variant_get_string(variant_, nullptr);
135+ }
136+ else if (g_variant_is_of_type(variant_, G_VARIANT_TYPE("(o)")))
137+ {
138+ // As we're using the '&' prefix we don't need to free the string!
139+ g_variant_get(variant_, "(&o)", &result);
140+ }
141+ else
142+ {
143+ auto const& variant = get_variant(variant_);
144+ if (variant)
145+ return variant.GetObjectPath();
146+
147+ LOG_ERROR(logger) << "You're trying to extract a 'o' from a variant which is of type '"
148+ << g_variant_type_peek_string(g_variant_get_type(variant_)) << "'";
149+ }
150+
151+ return result ? result : "";
152+}
153+
154 template <typename TYPE, typename GTYPE>
155 TYPE get_numeric_value(GVariant *variant_, const char *type_str, const char *fallback_type_str)
156 {
157
158=== modified file 'UnityCore/Variant.h'
159--- UnityCore/Variant.h 2013-11-19 20:28:13 +0000
160+++ UnityCore/Variant.h 2016-11-11 14:53:10 +0000
161@@ -68,6 +68,7 @@
162 ~Variant();
163
164 std::string GetString() const;
165+ std::string GetObjectPath() const;
166 unsigned char GetByte() const;
167 int16_t GetInt16() const;
168 uint16_t GetUInt16() const;
169
170=== modified file 'debian/changelog'
171--- debian/changelog 2016-09-06 14:19:16 +0000
172+++ debian/changelog 2016-11-11 14:53:10 +0000
173@@ -1,3 +1,20 @@
174+unity (7.5.0+16.10.20160906.1-0ubuntu2) UNRELEASED; urgency=medium
175+
176+ [ Marco Trevisan (Treviño) ]
177+ * LockScreenController: ignore icon_paths_changed signal in
178+ menumanager for Lockscreen (LP: #1635625)
179+
180+ [ Andrea Azzarone ]
181+ * Properly handle the file manager copy dialog in
182+ FileManagerLauncherIcon and in StorageLauncherIcon. (LP: #1575452,
183+ LP: #1609845)
184+ * Correctly position the force quit dialog when scaling is different
185+ than 1.0 (LP: #1637991)
186+ * GnomeSession: Retrieve the session id using dbus if $XDG_SESSION_ID
187+ is not set (LP: #1633749)
188+
189+ -- Marco Trevisan (Treviño) <mail@3v1n0.net> Fri, 11 Nov 2016 14:45:03 +0100
190+
191 unity (7.5.0+16.10.20160906.1-0ubuntu1) yakkety; urgency=medium
192
193 [ Marco Trevisan (Treviño), Ted Gould ]
194
195=== modified file 'decorations/DecorationsForceQuitDialog.cpp'
196--- decorations/DecorationsForceQuitDialog.cpp 2016-08-06 16:24:55 +0000
197+++ decorations/DecorationsForceQuitDialog.cpp 2016-11-11 14:53:10 +0000
198@@ -478,9 +478,11 @@
199
200 void UpdateDialogPosition()
201 {
202+ gint scale = gtk_widget_get_scale_factor(dialog_);
203+ scale = std::max<gint>(1, scale);
204 auto const& win_geo = win_->inputRect();
205- nux::Size walloc(gtk_widget_get_allocated_width(dialog_), gtk_widget_get_allocated_height(dialog_));
206- gtk_window_move(GTK_WINDOW(dialog_), win_geo.centerX() - walloc.width/2, win_geo.centerY() - walloc.height/2);
207+ nux::Size walloc(gtk_widget_get_allocated_width(dialog_) * scale, gtk_widget_get_allocated_height(dialog_) * scale);
208+ gtk_window_move(GTK_WINDOW(dialog_), (win_geo.centerX() - walloc.width/2) / scale, (win_geo.centerY() - walloc.height/2) / scale);
209 }
210
211 ForceQuitDialog* parent_;
212
213=== modified file 'launcher/FileManagerLauncherIcon.cpp'
214--- launcher/FileManagerLauncherIcon.cpp 2016-07-05 13:35:56 +0000
215+++ launcher/FileManagerLauncherIcon.cpp 2016-11-11 14:53:10 +0000
216@@ -49,6 +49,11 @@
217 SetQuirk(Quirk::VISIBLE, false);
218 SkipQuirkAnimation(Quirk::VISIBLE);
219
220+ signals_conn_.Add(app_->window_opened.connect([this](ApplicationWindowPtr const& win) {
221+ signals_conn_.Add(win->monitor.changed.connect([this] (int) { UpdateStorageWindows(); }));
222+ UpdateStorageWindows();
223+ }));
224+
225 signals_conn_.Add(app_->desktop_file.changed.connect([this](std::string const& desktop_file) {
226 LOG_DEBUG(logger) << tooltip_text() << " desktop_file now " << desktop_file;
227 UpdateDesktopFile();
228@@ -134,5 +139,30 @@
229 return StorageLauncherIcon::OnShouldHighlightOnDrag(dnd_data);
230 }
231
232+bool FileManagerLauncherIcon::IsUserVisible() const
233+{
234+ return ApplicationLauncherIcon::IsUserVisible();
235+}
236+
237+WindowList FileManagerLauncherIcon::WindowsOnViewport()
238+{
239+ WindowFilterMask filter = 0;
240+ filter |= WindowFilter::MAPPED;
241+ filter |= WindowFilter::ON_CURRENT_DESKTOP;
242+ filter |= WindowFilter::ON_ALL_MONITORS;
243+
244+ return WindowedLauncherIcon::GetWindows(filter);
245+}
246+
247+WindowList FileManagerLauncherIcon::WindowsForMonitor(int monitor)
248+{
249+ WindowFilterMask filter = 0;
250+ filter |= WindowFilter::MAPPED;
251+ filter |= WindowFilter::ON_CURRENT_DESKTOP;
252+
253+ return WindowedLauncherIcon::GetWindows(filter, monitor);
254+}
255+
256+
257 } // namespace launcher
258 } // namespace unity
259
260=== modified file 'launcher/FileManagerLauncherIcon.h'
261--- launcher/FileManagerLauncherIcon.h 2015-12-09 12:02:48 +0000
262+++ launcher/FileManagerLauncherIcon.h 2016-11-11 14:53:10 +0000
263@@ -32,8 +32,16 @@
264 class FileManagerLauncherIcon : public ApplicationLauncherIcon, public StorageLauncherIcon
265 {
266 public:
267+ typedef nux::ObjectPtr<FileManagerLauncherIcon> Ptr;
268+
269 FileManagerLauncherIcon(ApplicationPtr const&, DeviceLauncherSection::Ptr const&, FileManager::Ptr const& = nullptr);
270
271+ bool IsUserVisible() const override;
272+
273+protected:
274+ WindowList WindowsOnViewport() override;
275+ WindowList WindowsForMonitor(int monitor) override;
276+
277 private:
278 WindowList GetManagedWindows() const override;
279 WindowList GetStorageWindows() const override;
280
281=== modified file 'launcher/StorageLauncherIcon.cpp'
282--- launcher/StorageLauncherIcon.cpp 2015-12-08 14:31:30 +0000
283+++ launcher/StorageLauncherIcon.cpp 2016-11-11 14:53:10 +0000
284@@ -36,7 +36,7 @@
285 bool active = false;
286 bool urgent = false;
287 bool check_visibility = (GetIconType() == IconType::APPLICATION);
288- bool visible = IsSticky();
289+ bool visible = false;
290
291 managed_windows_ = GetStorageWindows();
292 windows_connections_.Clear();
293@@ -54,13 +54,8 @@
294 if (!urgent && win->urgent())
295 urgent = true;
296
297- if (check_visibility)
298- {
299- windows_connections_.Add(win->visible.changed.connect([this] (bool) { OnWindowStateChanged(); }));
300-
301- if (!visible && win->visible())
302- visible = true;
303- }
304+ if (check_visibility && !visible)
305+ visible = true;
306 }
307
308 SetQuirk(Quirk::RUNNING, !managed_windows_.empty());
309@@ -68,7 +63,7 @@
310 SetQuirk(Quirk::URGENT, urgent);
311
312 if (check_visibility)
313- SetQuirk(Quirk::VISIBLE, visible);
314+ SetQuirk(Quirk::VISIBLE, visible || IsSticky());
315
316 EnsureWindowsLocation();
317 }
318@@ -83,7 +78,7 @@
319 bool active = false;
320 bool urgent = false;
321 bool check_visibility = (GetIconType() == IconType::APPLICATION);
322- bool visible = IsSticky();
323+ bool visible = false;
324
325 for (auto const& win : managed_windows_)
326 {
327@@ -93,7 +88,7 @@
328 if (!urgent && win->urgent())
329 urgent = true;
330
331- if (check_visibility && !visible && win->visible())
332+ if (check_visibility && !visible)
333 visible = true;
334 }
335
336@@ -101,7 +96,7 @@
337 SetQuirk(Quirk::URGENT, urgent);
338
339 if (check_visibility)
340- SetQuirk(Quirk::VISIBLE, visible);
341+ SetQuirk(Quirk::VISIBLE, visible || IsSticky());
342 }
343
344 bool StorageLauncherIcon::OnShouldHighlightOnDrag(DndData const& dnd_data)
345
346=== modified file 'lockscreen/LockScreenController.cpp'
347--- lockscreen/LockScreenController.cpp 2016-09-02 13:36:37 +0000
348+++ lockscreen/LockScreenController.cpp 2016-11-11 14:53:10 +0000
349@@ -467,6 +467,7 @@
350 void Controller::LockScreen()
351 {
352 menu_manager_ = std::make_shared<menu::Manager>(std::make_shared<indicator::LockScreenDBusIndicators>(), key_grabber_);
353+ menu_manager_->Indicators()->icon_paths_changed.clear(); // Ignore custom icon themes for lockscreen, see bug #1635625
354 upstart_wrapper_->Emit("desktop-lock");
355 systemd_wrapper_->Start(SYSTEMD_LOCK_TARGET);
356
357
358=== modified file 'tests/CMakeLists.txt'
359--- tests/CMakeLists.txt 2016-07-20 15:55:32 +0000
360+++ tests/CMakeLists.txt 2016-11-11 14:53:10 +0000
361@@ -224,6 +224,7 @@
362 test_error_preview.cpp
363 test_edge_barrier_controller.cpp
364 test_expo_launcher_icon.cpp
365+ test_file_manager_launcher_icon.cpp
366 test_filter_widgets.cpp
367 test_glib_dbus_server.cpp
368 test_gnome_session_manager.cpp
369
370=== added file 'tests/test_file_manager_launcher_icon.cpp'
371--- tests/test_file_manager_launcher_icon.cpp 1970-01-01 00:00:00 +0000
372+++ tests/test_file_manager_launcher_icon.cpp 2016-11-11 14:53:10 +0000
373@@ -0,0 +1,202 @@
374+/*
375+ * Copyright 2016 Canonical Ltd.
376+ *
377+ * This program is free software: you can redistribute it and/or modify it
378+ * under the terms of the GNU General Public License version 3, as published
379+ * by the Free Software Foundation.
380+ *
381+ * This program is distributed in the hope that it will be useful, but
382+ * WITHOUT ANY WARRANTY; without even the implied warranties of
383+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
384+ * PURPOSE. See the GNU General Public License for more details.
385+ *
386+ * You should have received a copy of the GNU General Public License
387+ * version 3 along with this program. If not, see
388+ * <http://www.gnu.org/licenses/>
389+ *
390+ * Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
391+ */
392+
393+#include <gmock/gmock.h>
394+using namespace testing;
395+
396+#include "FileManagerLauncherIcon.h"
397+#include "UnityCore/DesktopUtilities.h"
398+
399+#include "test_mock_devices.h"
400+#include "test_mock_filemanager.h"
401+#include "mock-application.h"
402+
403+using namespace unity;
404+using namespace unity::launcher;
405+using namespace testmocks;
406+
407+namespace
408+{
409+
410+const std::string TRASH_URI = "trash:";
411+const std::string TRASH_PATH = "file://" + DesktopUtilities::GetUserTrashDirectory();
412+
413+struct TestFileManagerLauncherIcon : public Test
414+{
415+ TestFileManagerLauncherIcon()
416+ : app_(std::make_shared<MockApplication::Nice>())
417+ , fm_(std::make_shared<MockFileManager::Nice>())
418+ , dev_ (std::make_shared<MockDeviceLauncherSection>(2))
419+ , icon_(new FileManagerLauncherIcon(app_, dev_, fm_))
420+ {
421+ }
422+
423+ MockApplication::Ptr app_;
424+ MockFileManager::Ptr fm_;
425+ DeviceLauncherSection::Ptr dev_;
426+ FileManagerLauncherIcon::Ptr icon_;
427+};
428+
429+TEST_F(TestFileManagerLauncherIcon, IconType)
430+{
431+ EXPECT_EQ(icon_->GetIconType(), AbstractLauncherIcon::IconType::APPLICATION);
432+}
433+
434+TEST_F(TestFileManagerLauncherIcon, NoWindow)
435+{
436+ EXPECT_FALSE(icon_->IsVisible());
437+}
438+
439+TEST_F(TestFileManagerLauncherIcon, NoManagedWindow_TrashUri)
440+{
441+ EXPECT_CALL(*fm_, LocationForWindow(_)).Times(1);
442+ ON_CALL(*fm_, LocationForWindow(_)).WillByDefault(Return(TRASH_URI));
443+
444+ auto win = std::make_shared<MockApplicationWindow::Nice>(g_random_int());
445+ app_->windows_ = { win };
446+ app_->window_opened.emit(win);
447+
448+ EXPECT_FALSE(icon_->IsVisible());
449+ EXPECT_FALSE(icon_->IsRunning());
450+}
451+
452+TEST_F(TestFileManagerLauncherIcon, NoManagedWindow_TrashPath)
453+{
454+ EXPECT_CALL(*fm_, LocationForWindow(_)).Times(1);
455+ ON_CALL(*fm_, LocationForWindow(_)).WillByDefault(Return(TRASH_PATH));
456+
457+ auto win = std::make_shared<MockApplicationWindow::Nice>(g_random_int());
458+ app_->windows_ = { win };
459+ app_->window_opened.emit(win);
460+
461+ EXPECT_FALSE(icon_->IsVisible());
462+ EXPECT_FALSE(icon_->IsRunning());
463+}
464+
465+TEST_F(TestFileManagerLauncherIcon, NoManagedWindow_Device)
466+{
467+ auto const& device_icons = dev_->GetIcons();
468+ ASSERT_EQ(2, device_icons.size());
469+
470+ device_icons.at(0)->Activate(ActionArg());
471+
472+ EXPECT_CALL(*fm_, LocationForWindow(_)).Times(1);
473+ ON_CALL(*fm_, LocationForWindow(_)).WillByDefault(Return(device_icons.at(0)->GetVolumeUri()));
474+
475+ auto win = std::make_shared<MockApplicationWindow::Nice>(g_random_int());
476+ app_->windows_ = { win };
477+ app_->window_opened.emit(win);
478+
479+ EXPECT_FALSE(icon_->IsVisible());
480+ EXPECT_FALSE(icon_->IsRunning());
481+}
482+
483+TEST_F(TestFileManagerLauncherIcon, ManagedWindows)
484+{
485+ EXPECT_CALL(*fm_, LocationForWindow(_)).Times(1);
486+ ON_CALL(*fm_, LocationForWindow(_)).WillByDefault(Return("/usr/bin"));
487+
488+ auto win = std::make_shared<MockApplicationWindow::Nice>(g_random_int());
489+ app_->windows_ = { win };
490+ app_->window_opened.emit(win);
491+
492+ EXPECT_TRUE(icon_->IsVisible());
493+ EXPECT_TRUE(icon_->IsRunning());
494+}
495+
496+TEST_F(TestFileManagerLauncherIcon, ManagedWindows_EmptyLocation)
497+{
498+ EXPECT_CALL(*fm_, LocationForWindow(_)).Times(1);
499+ ON_CALL(*fm_, LocationForWindow(_)).WillByDefault(Return(""));
500+
501+ auto win = std::make_shared<MockApplicationWindow::Nice>(g_random_int());
502+ app_->windows_ = { win };
503+ app_->window_opened.emit(win);
504+
505+ EXPECT_TRUE(icon_->IsVisible());
506+ EXPECT_TRUE(icon_->IsRunning());
507+}
508+
509+TEST_F(TestFileManagerLauncherIcon, ManagedWindows_CopyDialog)
510+{
511+ EXPECT_CALL(*fm_, LocationForWindow(_)).Times(1);
512+ ON_CALL(*fm_, LocationForWindow(_)).WillByDefault(Return(""));
513+
514+ auto win = std::make_shared<MockApplicationWindow::Nice>(g_random_int());
515+ win->visible_ = false;
516+ app_->windows_ = { win };
517+ app_->window_opened.emit(win);
518+
519+ EXPECT_TRUE(icon_->IsVisible());
520+ EXPECT_TRUE(icon_->IsRunning());
521+}
522+
523+
524+TEST_F(TestFileManagerLauncherIcon, ManagedWindows_CopyDialogAndManagedWindow)
525+{
526+ EXPECT_CALL(*fm_, LocationForWindow(_)).Times(3);
527+ ON_CALL(*fm_, LocationForWindow(_)).WillByDefault(Return(""));
528+
529+ auto win = std::make_shared<MockApplicationWindow::Nice>(g_random_int());
530+ app_->windows_ = { win };
531+ app_->window_opened.emit(win);
532+
533+ win = std::make_shared<MockApplicationWindow::Nice>(g_random_int());
534+ win->visible_ = false;
535+ app_->windows_.push_back(win);
536+ app_->window_opened.emit(win);
537+
538+ EXPECT_TRUE(icon_->IsVisible());
539+ EXPECT_TRUE(icon_->IsRunning());
540+ EXPECT_EQ(2, icon_->WindowsVisibleOnMonitor(0));
541+}
542+
543+TEST_F(TestFileManagerLauncherIcon, ManagedWindows_CopyDialogAndNoManagedWindow)
544+{
545+ {
546+ InSequence s;
547+
548+ EXPECT_CALL(*fm_, LocationForWindow(_))
549+ .Times(1)
550+ .WillOnce(Return(""));
551+
552+ EXPECT_CALL(*fm_, LocationForWindow(_))
553+ .Times(1)
554+ .WillOnce(Return(""));
555+
556+ EXPECT_CALL(*fm_, LocationForWindow(_))
557+ .Times(1)
558+ .WillOnce(Return(TRASH_PATH));
559+ }
560+
561+ auto win = std::make_shared<MockApplicationWindow::Nice>(g_random_int());
562+ app_->windows_ = { win };
563+ app_->window_opened.emit(win);
564+
565+ win = std::make_shared<MockApplicationWindow::Nice>(g_random_int());
566+ win->visible_ = false;
567+ app_->windows_.push_back(win);
568+ app_->window_opened.emit(win);
569+
570+ EXPECT_TRUE(icon_->IsVisible());
571+ EXPECT_TRUE(icon_->IsRunning());
572+ EXPECT_EQ(1, icon_->WindowsVisibleOnMonitor(0));
573+}
574+
575+}
576
577=== modified file 'tests/test_gnome_session_manager.cpp'
578--- tests/test_gnome_session_manager.cpp 2016-05-17 02:14:33 +0000
579+++ tests/test_gnome_session_manager.cpp 2016-11-11 14:53:10 +0000
580@@ -70,6 +70,9 @@
581 const std::string LOGIND_MANAGER =
582 R"(<node>
583 <interface name="org.freedesktop.login1.Manager">
584+ <method name="GetSession">
585+ <arg type="s" name="result" direction="out"/>
586+ </method>
587 <method name="CanSuspend">
588 <arg type="s" name="result" direction="out"/>
589 </method>
590@@ -186,7 +189,11 @@
591 logind_->AddObjects(introspection::LOGIND_MANAGER, LOGIND_MANAGER_PATH);
592 logind_->AddObjects(introspection::LOGIND_SESSION, LOGIND_SESSION_PATH);
593 logind_->GetObjects().front()->SetMethodsCallsHandler([&] (std::string const& method, GVariant*) -> GVariant* {
594- if (method == "CanSuspend")
595+ if (method == "GetSession")
596+ {
597+ return g_variant_new("(o)", "id0");
598+ }
599+ else if (method == "CanSuspend")
600 {
601 suspend_called = true;
602 return g_variant_new("(s)", can_suspend_ ? "yes" : "no");

Subscribers

People subscribed via source and target branches

to all changes: