Merge lp:~unity-2d-team/unity-2d/update-launcher-pips-shell into lp:~unity-2d-team/unity-2d/unity-2d-shell

Proposed by Lohith D Shivamurthy
Status: Merged
Approved by: Michał Sawicz
Approved revision: 934
Merged at revision: 934
Proposed branch: lp:~unity-2d-team/unity-2d/update-launcher-pips-shell
Merge into: lp:~unity-2d-team/unity-2d/unity-2d-shell
Diff against target: 571 lines (+408/-4)
9 files modified
libunity-2d-private/src/launcherapplication.cpp (+56/-2)
libunity-2d-private/src/launcherapplication.h (+4/-0)
libunity-2d-private/src/launcheritem.cpp (+6/-0)
libunity-2d-private/src/launcheritem.h (+2/-0)
libunity-2d-private/src/unity2ddeclarativeview.cpp (+1/-0)
libunity-2d-private/src/unity2ddeclarativeview.h (+1/-0)
shell/launcher/LauncherItem.qml (+1/-1)
shell/launcher/LauncherList.qml (+22/-1)
tests/launcher/update_pips_tests.rb (+315/-0)
To merge this branch: bzr merge lp:~unity-2d-team/unity-2d/update-launcher-pips-shell
Reviewer Review Type Date Requested Status
Michał Sawicz Approve
Gerry Boland (community) Needs Fixing
Review via email: mp+89679@code.launchpad.net

Description of the change

[shell][launcher] launcher pips indicate whether application windows belongs to current workspace or not

To post a comment you must log in.
Revision history for this message
Michał Sawicz (saviq) wrote :

Hey, the pips weren't updating when I changed workspaces, just when I launched / closed apps, can you please verify it behaves as expected when switching workspaces?

review: Needs Fixing (functional)
924. By Lohith D Shivamurthy

[shell][launcher] update pips when the user workspace changed. Also added tests for the same

Revision history for this message
Michał Sawicz (saviq) wrote :

Hey, any reason you're not using the TmpWindow class?

review: Needs Information
Revision history for this message
Gerry Boland (gerboland) wrote :

Yeah, since we run tests with a Terminal open already, he needed to start testing with a non-running application, checking no pips, run the app, check pip, etc.

Revision history for this message
Michał Sawicz (saviq) wrote :

Maybe take a look at autohide_show_tests.rb:549 then for a way to find a non-running app and use that instead?

review: Needs Fixing
Revision history for this message
Lohith D Shivamurthy (dyams) wrote :

Hey, The test application should take some parameter to identiy its xid accurately. In this case, a unique title is set to test application and then later we find the xid for that window.

Revision history for this message
Michał Sawicz (saviq) wrote :

OK then, lets merge that now and once we have a better way to test these lets revisit, can you please add a FIXME in the tests? I'm simply wary of the test being unreliable if you pre-launch xman anywhere.

review: Needs Fixing
Revision history for this message
Michał Sawicz (saviq) :
review: Approve
Revision history for this message
Michał Sawicz (saviq) wrote :

* what's the use of updateWindowWorkspaceChanged()? Can't you just emit the signal from the callback function?
* there's a tab instead of spaces in unity2ddeclarativeview.cpp:48
* updatePipSource updates both the source and pip count, please rename to updatePips
* pipSource should not be bound to updatePipSource, as it doesn't return anything - make it use the default value initially and the Connections will take care of updating it later
* there are tabs instead of spaces in LauncherList.qml:306
* change the puts() to comments in test startup and shutdown
* drop unneeded comment in test setup
* you have extra lines in test descriptions, please drop the lines only containing an asterisk
* Post-Conditions should not contain stuff that happens in teardown anyway, please drop the "Reset the current..." entries there
* again, tabs instead of spaces in the tests file
* test comments mentions calculator, please fix
* please don't "reuse" windows between tests as this will prevent running just one single test
* typos in "Test steps" - "reused", not "resued"
* typo in "Test steps" for "Update launcher pips to indicate an app with two windows on two different workspaces" - "along", not "alogn"
* typo in "Test steps" for "Update launcher pips to indicate an app completely belonging to different workspace." - missing "e" in "differnt"
* in some test objectives you say "Check for...", in others "Update...", please be consistent

review: Needs Fixing
925. By Lohith D Shivamurthy

[shell][launcher] Review comments fixed

926. By Lohith D Shivamurthy

[shell][launcher] Added a FIXME to choose a better test application

Revision history for this message
Michał Sawicz (saviq) wrote :

Gerry please take a look at the tests if you will.

And Gerry, Lohith some more things I'm not certain about:

1) the workspace-changed signals are connected in setIconGeometry? doesn't seem like the right place to do so?
2) shouldn't we also connect to workspace-changed signal in windowAdded()
3) do we really need to cast user_data to LauncherApplication*?

Please rename the callback to onWindowWorkspaceChanged

review: Needs Fixing
927. By Lohith D Shivamurthy

[shell][launcher] windows signal connection is moved to separate method

928. By Lohith D Shivamurthy

[shell] merge with trunk

Revision history for this message
Michał Sawicz (saviq) wrote :

You forgot:
* Please rename the callback to onWindowWorkspaceChanged

Please also fix the style in LauncherList.qml:292, move setIconGeometry() down one line.
There's also an extra blank line in launcherapplication.cpp:513

I'm not completely sure us going through QML just to proxy onRunningChanged() back into C++ is needed or required :/ Gerry, I'd like your opinion on that.

I'm not GObject-savvy enough to know whether we should disconnect from the workspace-changed signal when the window is removed / application stopped?

review: Needs Fixing
Revision history for this message
Gerry Boland (gerboland) wrote :

Functional problems:
1. I find when I launch shell, with existing applications open, that the pips are incorrect (they're all filled). Once I start navigating workspaces, the pips are corrected.

2. Set an application window to be "Always on Visible Workspace" (from window menu) - then its pips are always unfilled.

review: Needs Fixing
929. By Lohith D Shivamurthy

[launcher] update pips as soon as loading the launcher is completed

930. By Lohith D Shivamurthy

[launcher] Consider 'always on visible workspace' windows as always in the current workspace

Revision history for this message
Gerry Boland (gerboland) wrote :

Nice, those functional problems have been fixed.

Please update the tests to use $SUT.execute_shell_command

There is also a stray blank line in void LauncherApplication::connectWindowSignals() that you can remove.

And
+ onRunningChanged: { setIconGeometry()
+ item.connectWindowSignals()
+ }
is formatted strangely.

Fix those & I think we're good :)

review: Needs Fixing
931. By Lohith D Shivamurthy

[launcher] use sut global object, remove local object

932. By Lohith D Shivamurthy

[launcher] Replace 'system' with execute_shell_command

933. By Lohith D Shivamurthy

[launcher] remove extra line in cpp and add one line in qml

934. By Lohith D Shivamurthy

[launcher] replace 'CB' suffix with 'on' prefix for the callback

Revision history for this message
Michał Sawicz (saviq) wrote :

Yup, looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/launcherapplication.cpp'
2--- libunity-2d-private/src/launcherapplication.cpp 2012-01-18 11:50:32 +0000
3+++ libunity-2d-private/src/launcherapplication.cpp 2012-01-26 17:12:24 +0000
4@@ -505,10 +505,36 @@
5 }
6
7 void
8+LauncherApplication::connectWindowSignals()
9+{
10+ if (m_application == NULL || m_application->running() == false) {
11+ return;
12+ }
13+
14+ QScopedPointer<BamfUintList> xids(m_application->xids());
15+ int size = xids->size();
16+ if (size < 1) {
17+ return;
18+ }
19+
20+ WnckScreen* screen = wnck_screen_get_default();
21+ wnck_screen_force_update(screen);
22+
23+ for (int i = 0; i < size; ++i) {
24+ WnckWindow* window = wnck_window_get(xids->at(i));
25+ g_signal_connect(G_OBJECT(window), "workspace-changed",
26+ G_CALLBACK(LauncherApplication::onWindowWorkspaceChanged), this);
27+ }
28+}
29+
30+void
31 LauncherApplication::onWindowAdded(BamfWindow* window)
32 {
33 if (window != NULL) {
34 windowAdded(window->xid());
35+ WnckWindow* wnck_window = wnck_window_get(window->xid());
36+ g_signal_connect(G_OBJECT(wnck_window), "workspace-changed",
37+ G_CALLBACK(LauncherApplication::onWindowWorkspaceChanged), this);
38 }
39 }
40
41@@ -599,6 +625,11 @@
42 LauncherApplication::windowCountOnCurrentWorkspace()
43 {
44 int windowCount = 0;
45+
46+ if (!m_application) {
47+ return windowCount;
48+ }
49+
50 WnckWorkspace *current = wnck_screen_get_active_workspace(wnck_screen_get_default());
51
52 QScopedPointer<BamfWindowList> windows(m_application->windows());
53@@ -620,9 +651,13 @@
54 }
55 }
56
57- WnckWorkspace *workspace = wnck_window_get_workspace(wnck_window);
58- if (workspace == current) {
59+ if (wnck_window_is_pinned(wnck_window)) {
60 windowCount++;
61+ } else {
62+ WnckWorkspace *workspace = wnck_window_get_workspace(wnck_window);
63+ if (workspace == current) {
64+ windowCount++;
65+ }
66 }
67 }
68 return windowCount;
69@@ -937,6 +972,18 @@
70 }
71 }
72
73+bool
74+LauncherApplication::belongsToDifferentWorkspace()
75+{
76+ int totalWindows = windowCount();
77+ int windowsInCurrentWorkspace = windowCountOnCurrentWorkspace();
78+ if (totalWindows > 0 && windowsInCurrentWorkspace == 0) {
79+ return true;
80+ }
81+
82+ return false;
83+}
84+
85 void
86 LauncherApplication::onIndicatorMenuUpdated()
87 {
88@@ -1053,4 +1100,11 @@
89 setDynamicQuicklistImporter(newOwner);
90 }
91
92+void
93+LauncherApplication::onWindowWorkspaceChanged(WnckWindow *window, gpointer user_data)
94+{
95+ Q_UNUSED(window);
96+ ((LauncherApplication*)user_data)->windowWorkspaceChanged();
97+}
98+
99 #include "launcherapplication.moc"
100
101=== modified file 'libunity-2d-private/src/launcherapplication.h'
102--- libunity-2d-private/src/launcherapplication.h 2012-01-13 15:05:44 +0000
103+++ libunity-2d-private/src/launcherapplication.h 2012-01-26 17:12:24 +0000
104@@ -104,6 +104,8 @@
105 Q_INVOKABLE virtual void launchNewInstance();
106
107 Q_INVOKABLE virtual void createMenuActions();
108+ Q_INVOKABLE virtual bool belongsToDifferentWorkspace();
109+ Q_INVOKABLE void connectWindowSignals();
110
111 void updateOverlaysState(const QString& sender, const QMap<QString, QVariant>& properties);
112
113@@ -174,6 +176,8 @@
114 bool updateOverlayState(const QMap<QString, QVariant>& properties,
115 const QString& propertyName, T* member);
116
117+ static void onWindowWorkspaceChanged(WnckWindow *window, gpointer user_data);
118+
119 QString m_dynamicQuicklistPath;
120 QScopedPointer<DBusMenuImporter> m_dynamicQuicklistImporter;
121 QDBusServiceWatcher* m_dynamicQuicklistServiceWatcher;
122
123=== modified file 'libunity-2d-private/src/launcheritem.cpp'
124--- libunity-2d-private/src/launcheritem.cpp 2011-07-29 13:49:34 +0000
125+++ libunity-2d-private/src/launcheritem.cpp 2012-01-26 17:12:24 +0000
126@@ -87,6 +87,12 @@
127 }
128
129 bool
130+LauncherItem::belongsToDifferentWorkspace()
131+{
132+ return false;
133+}
134+
135+bool
136 LauncherItem::progressBarVisible() const
137 {
138 return false;
139
140=== modified file 'libunity-2d-private/src/launcheritem.h'
141--- libunity-2d-private/src/launcheritem.h 2011-07-29 13:49:34 +0000
142+++ libunity-2d-private/src/launcheritem.h 2012-01-26 17:12:24 +0000
143@@ -79,6 +79,7 @@
144 Q_INVOKABLE virtual void activate() = 0;
145 Q_INVOKABLE virtual void createMenuActions() = 0;
146 Q_INVOKABLE virtual void launchNewInstance();
147+ Q_INVOKABLE virtual bool belongsToDifferentWorkspace();
148
149 protected:
150 LauncherContextualMenu* m_menu;
151@@ -100,6 +101,7 @@
152 void counterChanged(int);
153 void emblemVisibleChanged(bool);
154 void emblemChanged(QString);
155+ void windowWorkspaceChanged();
156
157 public Q_SLOTS:
158 /* Default implementation of drag’n’drop handling, should be overridden in
159
160=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.cpp'
161--- libunity-2d-private/src/unity2ddeclarativeview.cpp 2012-01-19 15:06:15 +0000
162+++ libunity-2d-private/src/unity2ddeclarativeview.cpp 2012-01-26 17:12:24 +0000
163@@ -269,6 +269,7 @@
164 void Unity2DDeclarativeView::onActiveWorkspaceChanged()
165 {
166 m_last_focused_window = None;
167+ Q_EMIT activeWorkspaceChanged();
168 }
169
170 #include <unity2ddeclarativeview.moc>
171
172=== modified file 'libunity-2d-private/src/unity2ddeclarativeview.h'
173--- libunity-2d-private/src/unity2ddeclarativeview.h 2012-01-11 20:33:19 +0000
174+++ libunity-2d-private/src/unity2ddeclarativeview.h 2012-01-26 17:12:24 +0000
175@@ -45,6 +45,7 @@
176 void transparentBackgroundChanged(bool);
177 void globalPositionChanged(QPoint);
178 void shown();
179+ void activeWorkspaceChanged();
180
181 protected:
182 void setupViewport();
183
184=== modified file 'shell/launcher/LauncherItem.qml'
185--- shell/launcher/LauncherItem.qml 2012-01-19 14:40:22 +0000
186+++ shell/launcher/LauncherItem.qml 2012-01-26 17:12:24 +0000
187@@ -156,7 +156,7 @@
188 Repeater {
189 model: item.pips
190 delegate: Image {
191- objectName: "pips"
192+ objectName: "pips-" + index
193 /* FIXME: It seems that when the image is created (or re-used) by the Repeater
194 for a moment it doesn't have any parent, and therefore warnings are
195 printed for the following two anchor assignements. This fixes the
196
197=== modified file 'shell/launcher/LauncherList.qml'
198--- shell/launcher/LauncherList.qml 2012-01-19 14:40:22 +0000
199+++ shell/launcher/LauncherList.qml 2012-01-26 17:12:24 +0000
200@@ -92,6 +92,16 @@
201 }
202 }
203
204+ function updatePips() {
205+ if (item.belongsToDifferentWorkspace()) {
206+ launcherItem.pips = 1
207+ launcherItem.pipSource = "launcher/artwork/launcher_arrow_outline_ltr.png";
208+ } else {
209+ launcherItem.pips = Math.min(item.windowCount, 3)
210+ launcherItem.pipSource = ("launcher/artwork/launcher_" + ((pips <= 1) ? "arrow" : "pip") + "_ltr.png")
211+ }
212+ }
213+
214 Accessible.name: accessibleDescription()
215 name: item.name
216
217@@ -279,7 +289,10 @@
218 PropertyAction { target: launcherItem; property: "ListView.delayRemove"; value: false }
219 }
220
221- onRunningChanged: setIconGeometry()
222+ onRunningChanged: {
223+ setIconGeometry()
224+ item.connectWindowSignals()
225+ }
226 /* Note: this doesn’t work as expected for the first favorite
227 application in the list if it is already running when the
228 launcher is started, because its y property doesn’t change.
229@@ -292,6 +305,8 @@
230 onWindowAdded: item.setIconGeometry(x + declarativeView.globalPosition.x,
231 y + declarativeView.globalPosition.y,
232 width, height, xid)
233+ onWindowCountChanged: updatePips()
234+ onWindowWorkspaceChanged: updatePips()
235 /* Not all items are applications. */
236 ignoreUnknownSignals: true
237 }
238@@ -335,5 +350,11 @@
239 }
240 }
241 }
242+
243+ Connections {
244+ target: declarativeView
245+ onActiveWorkspaceChanged: updatePips()
246+ }
247+ Component.onCompleted: updatePips()
248 }
249 }
250
251=== added file 'shell/launcher/artwork/launcher_arrow_outline_ltr.png'
252Binary files shell/launcher/artwork/launcher_arrow_outline_ltr.png 1970-01-01 00:00:00 +0000 and shell/launcher/artwork/launcher_arrow_outline_ltr.png 2012-01-26 17:12:24 +0000 differ
253=== added file 'tests/launcher/update_pips_tests.rb'
254--- tests/launcher/update_pips_tests.rb 1970-01-01 00:00:00 +0000
255+++ tests/launcher/update_pips_tests.rb 2012-01-26 17:12:24 +0000
256@@ -0,0 +1,315 @@
257+#!/usr/bin/env ruby1.8
258+=begin
259+/*
260+ * This file is part of unity-2d
261+ *
262+ * Copyright 2011 Canonical Ltd.
263+ *
264+ * Authors:
265+ * - Lohith DS <lohith.shivamurthy@canonical.com>
266+ *
267+ * This program is free software; you can redistribute it and/or modify
268+ * it under the terms of the GNU General Public License as published by
269+ * the Free Software Foundation; version 3.
270+ *
271+ * This program is distributed in the hope that it will be useful,
272+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
273+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
274+ * GNU General Public License for more details.
275+ *
276+ * You should have received a copy of the GNU General Public License
277+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
278+ */
279+=end
280+
281+require '../run-tests.rb' unless $INIT_COMPLETED
282+require 'xdo/xwindow'
283+require 'xdo/keyboard'
284+require 'xdo/mouse'
285+require 'timeout'
286+require 'tmpdir'
287+
288+def open_window()
289+ # FIXME : Need to choose a better test application in future?
290+ window_id = -1
291+ o = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten;
292+ title_string = (0..50).map{ o[rand(o.length)] }.join;
293+ if (@@title_string.empty?)
294+ @@title_string = title_string
295+ end
296+ # Open xman with random title
297+ $SUT.execute_shell_command("xman -geometry 300x90+100+100 -title #{title_string}", :detached => true)
298+ Timeout.timeout(30){ window_id = XDo::XWindow.wait_for_window(title_string)}
299+ Kernel.raise(SystemCallError, "Unable to open xman") if window_id == -1
300+ return XDo::XWindow.new(window_id)
301+end
302+
303+def change_window_workspace(xid)
304+ new_workspace = 0
305+ if xid.desktop > 0
306+ new_workspace=0
307+ else
308+ new_workspace=1
309+ end
310+
311+ xid.desktop=new_workspace
312+ verify_true(3, 'Change window workspace failed') {
313+ xid.desktop==new_workspace
314+ }
315+end
316+
317+def reset_current_workspace
318+ XDo::XWindow.desktop=@@current_workspace
319+ verify_true(TIMEOUT, 'Reset active workspace failed') {
320+ XDo::XWindow.desktop==@@current_workspace
321+ }
322+end
323+
324+def change_user_workspace
325+ new_workspace = 0
326+ if @@current_workspace > 0
327+ new_workspace = 0
328+ else
329+ new_workspace = 1
330+ end
331+
332+ XDo::XWindow.desktop=new_workspace
333+ verify_true(TIMEOUT, 'Change user workspace failed') {
334+ XDo::XWindow.desktop==new_workspace
335+ }
336+end
337+
338+def close_all_test_windows
339+ @@xid_list.each {
340+ |xid|
341+ if (xid.exists?)
342+ xid.close!
343+ end
344+ }
345+end
346+
347+############################# Test Suite #############################
348+context "Launcher pips tests" do
349+ # Run once at the beginning of this test suite
350+ startup do
351+ $SUT.execute_shell_command 'killall unity-2d-launcher'
352+ $SUT.execute_shell_command 'killall unity-2d-shell'
353+ $SUT.execute_shell_command 'killall unity-2d-shell'
354+
355+ # Minimize all windows
356+ XDo::XWindow.toggle_minimize_all
357+
358+ @number_of_workspaces = XDo::XWindow.desktop_num
359+ @reset_num_workspaces = false
360+ if @number_of_workspaces < 2
361+ # Setting number of workspaces to minimum(two) to enable the test suite
362+ XDo::XWindow.desktop_num = 2
363+ @reset_num_workspaces = true
364+ end
365+
366+ $SUT.execute_shell_command 'killall xman'
367+ @@current_workspace = XDo::XWindow.desktop
368+ @@xid_list=Array.new
369+
370+ end
371+
372+ # Run once at the end of this test suite
373+ shutdown do
374+ if @reset_num_workspaces == true
375+ # Resetting number of workspaces to " + @number_of_workspaces.to_s
376+ XDo::XWindow.desktop_num=@number_of_workspaces
377+ end
378+ end
379+
380+ # Run before each test case begins
381+ setup do
382+ # Execute the application
383+ @app = $SUT.run( :name => UNITY_2D_SHELL,
384+ :arguments => "-testability",
385+ :sleeptime => 2 )
386+ @@title_string = ""
387+ end
388+
389+ # Run after each test case completes
390+ teardown do
391+ close_all_test_windows
392+ reset_current_workspace
393+ system "pkill -nf unity-2d-shell"
394+ end
395+
396+ #####################################################################################
397+ # Test cases
398+
399+ # Test case objectives:
400+ # * Check pips are updated properly when the app is in current workspace
401+ # Pre-conditions
402+ # * This test case assumes that the test app will have only one window
403+ # * For eg, xman is choosen
404+ # * To ensure there is no xman windows running, kill all the xman windows if any
405+ # Test steps
406+ # * Open a xman window
407+ # * Verify the launcher tile pip image matches with the expected one
408+ # Post-conditions
409+ # * None
410+ # References
411+ # * lp:#883172
412+ test "Check pips are updated properly when the app is in current workspace" do
413+ xid = open_window()
414+ @@xid_list << xid
415+
416+ expected_pip_image = 'image://blended/launcher/artwork/launcher_arrow_ltr.pngcolor=lightgreyalpha=1'
417+
418+ verify_equal(expected_pip_image, TIMEOUT, 'pip not matching with launcher_arrow_ltr.png'){
419+ @app.Launcher() \
420+ .LauncherList( :name => 'main' ) \
421+ .QDeclarativeItem( :name => @@title_string ) \
422+ .QDeclarativeImage( :name => 'pips-0')['source']
423+ }
424+ end
425+
426+
427+ # Test case objectives:
428+ # * Check pips are updated properly when the app is moved to different workspace
429+ # Pre-conditions
430+ # * None
431+ # Test steps
432+ # * Move the window to a different workspace
433+ # * Verify the launcher tile pip image matches with the expected one
434+ # Post-conditions
435+ # * None
436+ # References
437+ # * lp:#883172
438+ test "Check pips are updated properly when the app is moved to different workspace" do
439+ xid = open_window()
440+ @@xid_list << xid
441+
442+ change_window_workspace(xid)
443+
444+ expected_pip_image = 'image://blended/launcher/artwork/launcher_arrow_outline_ltr.pngcolor=lightgreyalpha=1'
445+
446+ verify_equal(expected_pip_image, TIMEOUT, 'pip not matching with launcher_arrow_outline_ltr.png'){
447+ @app.Launcher() \
448+ .LauncherList( :name => 'main' ) \
449+ .QDeclarativeItem( :name => @@title_string ) \
450+ .QDeclarativeImage( :name => 'pips-0')['source']
451+ }
452+ end
453+
454+
455+ # Test case objectives:
456+ # * Check launcher pips to indicate an app with two windows each on two different workspaces
457+ # Pre-conditions
458+ # * None
459+ # Test steps
460+ # * Open another window along with first window from the first testcase.
461+ # * Verify the launcher tile pip images matches with the expected one
462+ # Post-conditions
463+ # * None
464+ # References
465+ # * lp:#883172
466+ test "Check launcher pips to indicate an app with two windows each on two different workspaces" do
467+ xid = open_window()
468+ @@xid_list << xid
469+ xid = open_window()
470+ @@xid_list << xid
471+
472+ expected_pip_image = 'image://blended/launcher/artwork/launcher_pip_ltr.pngcolor=lightgreyalpha=1'
473+
474+ verify_equal(expected_pip_image, TIMEOUT, 'Pip not matching expected image launcher_pip_ltr.png'){
475+ @app.Launcher() \
476+ .LauncherList( :name => 'main' ) \
477+ .QDeclarativeItem( :name => @@title_string ) \
478+ .QDeclarativeImage( :name => 'pips-0')['source']
479+ }
480+ end
481+
482+
483+ # Test case objectives:
484+ # * Check launcher pips to indicate an app completely belonging to different workspace
485+ # Pre-conditions
486+ # * None
487+ # Test steps
488+ # * Move the second window too to a different workspace
489+ # * Verify the launcher tile pip image matches with the expected one
490+ # Post-conditions
491+ # * None
492+ # References
493+ # * lp:#883172
494+ test "Check launcher pips to indicate an app completely belonging to different workspace" do
495+ xid = open_window()
496+ @@xid_list << xid
497+ change_window_workspace(xid)
498+
499+ xid = open_window()
500+ @@xid_list << xid
501+ change_window_workspace(xid)
502+
503+ expected_pip_image = 'image://blended/launcher/artwork/launcher_arrow_outline_ltr.pngcolor=lightgreyalpha=1'
504+
505+ verify_equal(expected_pip_image, TIMEOUT, 'pip not matching expected image launcher_arrow_outline_ltr.png'){
506+ @app.Launcher() \
507+ .LauncherList( :name => 'main' ) \
508+ .QDeclarativeItem( :name => @@title_string ) \
509+ .QDeclarativeImage( :name => 'pips-0')['source']
510+ }
511+ end
512+
513+
514+ # Test case objectives:
515+ # * Check launcher pips when an app window is closed.
516+ # Pre-conditions
517+ # * None
518+ # Test steps
519+ # * Close one of the app windows and move the last window back to its original workspace
520+ # * Verify the launcher tile pip image matches with the expected one
521+ # Post-conditions
522+ # * None
523+ # References
524+ # * lp:#883172
525+ test "Check launcher pips when an app window is closed" do
526+ xid = open_window()
527+ @@xid_list << xid
528+ xid = open_window()
529+ @@xid_list << xid
530+
531+ xid.close!
532+ change_window_workspace(@@xid_list[0])
533+
534+ expected_pip_image = 'image://blended/launcher/artwork/launcher_arrow_outline_ltr.pngcolor=lightgreyalpha=1'
535+
536+ verify_equal(expected_pip_image, TIMEOUT, 'pip not matching expected image launcher_arrow_outline_ltr.png'){
537+ @app.Launcher() \
538+ .LauncherList( :name => 'main' ) \
539+ .QDeclarativeItem( :name => @@title_string ) \
540+ .QDeclarativeImage( :name => 'pips-0')['source']
541+ }
542+ end
543+
544+
545+ # Test case objectives:
546+ # * Check launcher pips to indicate when the user workspace changed
547+ # Pre-conditions
548+ # * None
549+ # Test steps
550+ # * Change the user workspace to other than app workspace
551+ # * Verify that the pips are updated properly
552+ # Post-conditions
553+ # * None
554+ # References
555+ # * lp:#883172
556+ test "Check launcher pips to indicate when the user workspace changed" do
557+ xid = open_window()
558+ @@xid_list << xid
559+
560+ change_user_workspace
561+
562+ expected_pip_image = 'image://blended/launcher/artwork/launcher_arrow_outline_ltr.pngcolor=lightgreyalpha=1'
563+
564+ verify_equal(expected_pip_image, TIMEOUT, 'pip not matching expected image launcher_arrow_outline_ltr.png'){
565+ @app.Launcher() \
566+ .LauncherList( :name => 'main' ) \
567+ .QDeclarativeItem( :name => @@title_string ) \
568+ .QDeclarativeImage( :name => 'pips-0')['source']
569+ }
570+ end
571+end

Subscribers

People subscribed via source and target branches

to all changes: