Merge lp:~unity-2d-team/unity-2d/filter-option-compact-shell into lp:~unity-2d-team/unity-2d/unity-2d-shell

Proposed by Lohith D Shivamurthy
Status: Superseded
Proposed branch: lp:~unity-2d-team/unity-2d/filter-option-compact-shell
Merge into: lp:~unity-2d-team/unity-2d/unity-2d-shell
Diff against target: 1375 lines (+564/-220)
29 files modified
data/com.canonical.Unity2d.gschema.xml (+1/-1)
debian/control (+1/-1)
libunity-2d-private/src/lens.cpp (+15/-3)
libunity-2d-private/src/lenses.cpp (+8/-5)
libunity-2d-private/src/lenses.h (+2/-0)
shell/Shell.qml (+1/-1)
shell/app/shelldeclarativeview.cpp (+7/-0)
shell/app/shelldeclarativeview.h (+2/-0)
shell/common/Background.qml (+111/-0)
shell/common/IconTile.qml (+97/-0)
shell/common/SearchEntry.qml (+25/-33)
shell/dash/Dash.qml (+41/-64)
shell/dash/FilterCheckoption.qml (+4/-2)
shell/dash/FilterCheckoptionCompact.qml (+22/-0)
shell/dash/FilterLoader.qml (+2/-0)
shell/dash/FilterPane.qml (+1/-0)
shell/dash/Home.qml (+1/-1)
shell/dash/LensBar.qml (+21/-19)
shell/dash/LensView.qml (+7/-6)
shell/dash/RendererGrid.qml (+6/-14)
shell/launcher/LauncherItem.qml (+17/-67)
shell/launcher/LauncherList.qml (+1/-1)
tests/dash/dash-tests.rb (+3/-1)
tests/dash/test-renderer-filter-check-option-compact.rb (+135/-0)
tests/launcher/autohide_show_tests.rb (+7/-0)
tests/launcher/autohide_show_tests_rtl.rb (+7/-0)
tests/shell/input_shaping.rb (+7/-0)
tests/shell/input_shaping_rtl.rb (+7/-0)
tests/spread/spread-tests.rb (+5/-1)
To merge this branch: bzr merge lp:~unity-2d-team/unity-2d/filter-option-compact-shell
Reviewer Review Type Date Requested Status
Gerry Boland (community) Needs Fixing
Michał Sawicz Needs Fixing
Review via email: mp+89874@code.launchpad.net

This proposal has been superseded by a proposal from 2012-02-16.

Description of the change

[shell][dash] Now we have a separate renderer filter-checkoption-compact. Hence the same change is incorparated in unity-2d-shell.

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

The tests rely on the fact that Application and Music lens as we know them have 2 and 3 columns, respectively.
That doesn't look like a reliable way to test, can you think of a better way? The easiest would probably be to go through the lenses / filters to find one that's filter-check-option and the other filter-check-option-compact.

Obviously that won't work when no lens uses those, but at some point we might have a fake testing lens that will have all of the different filter types for testing and the tests will still work, whereas we can't be sure people actually have the Applications or the Music lens.

Gerry, what's your take on it?

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

The lenses are something we don't have control over. However in the absense of test lenses, we've got to assume *some* lenses are there. I'm happy assuming Applications, Documents & Music are there, as they're the defaults.

And to do a reliable test, we've got to know a lens with filter-check-option, and one with filter-check-option-compact. Applications & Music (resp.) are suitable. Cycling through them doesn't test something we know, only that we found a lens which claims to have 2 or 3 columns.

So I think these tests are sufficient.

Long term goal is to have a test lens, so we don't need to worry about lens changes.

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

Comments on test script:

lines 28, 66, 111: Pet peeve: please use "lens" instead of "lense"
 - http://oxforddictionaries.com/spellcheck/?region=us&q=lense

line 29: 'pwd' not needed

lines 78, 123: Expand the comments like "Could not find AppLensButton" to ask if the relevant lens package is installed. Should help people who have removed it.

lines 82+, and others
+ XDo::Mouse.move(button['x_absolute'].to_i + 1, button['y_absolute'].to_i + 1, 0, true)
+ XDo::Mouse.click(nil, nil, :left)
Use button.tap, it's easier & safer.

line 86,130: no need to reset "button"

line 99:
+ verify( TIMEOUT, 'FilterCheckOption don\'t have two columns' ) {
+ loader.GridViewWithSpacing()['columns'] == '2'
+ }
Please use:
verify_equal( 2, TIMEOUT, 'FilterCheckOption don\'t have two columns' ) {
  loader.GridViewWithSpacing()['columns'].to_i
}
instead, as it returns better error output if it fails.

line 123: wrong comment

And some small English suggestions:
61: Check Filter results list view having renderer as filter-checkoption is displayed with two columns
   -> "Check Filter results list view rendered with filter-checkoption is displayed with two columns"
68: Check that filter-checkoption renderer is having two columns
   -> "Check that the filter-checkoption renderer uses two columns"
and similar.

review: Needs Fixing
932. By Lohith D Shivamurthy

[shell][dash] Review comments fixed

933. By Lohith D Shivamurthy

[places][tests] replace sysytem with .execute_shell_command

934. By Lohith D Shivamurthy

[places][tests] Use the global and remove the local @sut

935. By Lohith D Shivamurthy

[places] replace 'system' i teardown too

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

Ok now I've verified that Unity-Core has been updated to support this change, I've tested it and it's working.

Issue found: the Documents lens, the "Last Modified" checkboxes are not compact - but they should be according to the mockups.

This requires a fix in the documents lens. I've logged this bug here:
https://bugs.launchpad.net/unity-lens-files/+bug/928208
I'll hold off merging this until that bug is fixed.

I suggest in the mean time you keep this branch up to date.

Revision history for this message
Florian Boucault (fboucault) wrote :

Please resubmit the MR against lp:unity-2d

936. By Lohith D Shivamurthy

merge

937. By Lohith D Shivamurthy

nerge lp:unity-2d

938. By Lohith D Shivamurthy

merge lp:~dyams/unity-2d/fix-modifed-filter-3-columns

Unmerged revisions

938. By Lohith D Shivamurthy

merge lp:~dyams/unity-2d/fix-modifed-filter-3-columns

937. By Lohith D Shivamurthy

nerge lp:unity-2d

936. By Lohith D Shivamurthy

merge

935. By Lohith D Shivamurthy

[places] replace 'system' i teardown too

934. By Lohith D Shivamurthy

[places][tests] Use the global and remove the local @sut

933. By Lohith D Shivamurthy

[places][tests] replace sysytem with .execute_shell_command

932. By Lohith D Shivamurthy

[shell][dash] Review comments fixed

931. By Lohith D Shivamurthy

[shell] Have a separate QML for new renderer filter-checkoption-compact

930. By Lohith D Shivamurthy

[shell] Add comments to test cases

929. By Lohith D Shivamurthy

[shell] Tests added to verify the new renderer

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/com.canonical.Unity2d.gschema.xml'
2--- data/com.canonical.Unity2d.gschema.xml 2012-01-27 12:39:09 +0000
3+++ data/com.canonical.Unity2d.gschema.xml 2012-02-16 08:01:24 +0000
4@@ -23,7 +23,7 @@
5 <description>Whether or not the super (also called windows key) key is used.</description>
6 </key>
7 <key name="hide-mode" type="i">
8- <default>2</default>
9+ <default>0</default>
10 <summary>Hiding mode of the launcher</summary>
11 <description>Possible values:
12 0: never hide; the launcher is always visible and windows won't overlap with it
13
14=== modified file 'debian/control'
15--- debian/control 2012-02-06 12:07:47 +0000
16+++ debian/control 2012-02-16 08:01:24 +0000
17@@ -15,7 +15,7 @@
18 libqtgconf-dev,
19 libdconf-qt-dev,
20 libqtbamf-dev (>= 0.2.3-0ubuntu1),
21- libqtdee-dev (>= 0.2.3-0ubuntu2),
22+ libqtdee-dev (>= 0.2.4-0ubuntu1),
23 libdbusmenu-qt-dev,
24 libx11-dev,
25 libindicator3-dev,
26
27=== modified file 'libunity-2d-private/src/lens.cpp'
28--- libunity-2d-private/src/lens.cpp 2011-12-14 22:45:04 +0000
29+++ libunity-2d-private/src/lens.cpp 2012-02-16 08:01:24 +0000
30@@ -224,9 +224,21 @@
31
32 m_filters = new Filters(m_unityLens->filters, this);
33
34- m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
35- m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
36- m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
37+ if (QString::fromStdString(m_unityLens->results()->swarm_name) == QString(":local")) {
38+ m_results->setModel(m_unityLens->results()->model());
39+ } else {
40+ m_results->setName(QString::fromStdString(m_unityLens->results()->swarm_name));
41+ }
42+ if (QString::fromStdString(m_unityLens->global_results()->swarm_name) == QString(":local")) {
43+ m_globalResults->setModel(m_unityLens->global_results()->model());
44+ } else {
45+ m_globalResults->setName(QString::fromStdString(m_unityLens->global_results()->swarm_name));
46+ }
47+ if (QString::fromStdString(m_unityLens->categories()->swarm_name) == QString(":local")) {
48+ m_categories->setModel(m_unityLens->categories()->model());
49+ } else {
50+ m_categories->setName(QString::fromStdString(m_unityLens->categories()->swarm_name));
51+ }
52
53 /* Property change signals */
54 m_unityLens->id.changed.connect(sigc::mem_fun(this, &Lens::idChanged));
55
56=== modified file 'libunity-2d-private/src/lenses.cpp'
57--- libunity-2d-private/src/lenses.cpp 2011-09-09 10:15:14 +0000
58+++ libunity-2d-private/src/lenses.cpp 2012-02-16 08:01:24 +0000
59@@ -27,6 +27,8 @@
60
61 // libunity-core
62 #include <UnityCore/FilesystemLenses.h>
63+#include <UnityCore/HomeLens.h>
64+#include <unity2dtr.h>
65
66 Lenses::Lenses(QObject *parent) :
67 QAbstractListModel(parent)
68@@ -36,17 +38,18 @@
69 roles[Lenses::RoleVisible] = "visible";
70 setRoleNames(roles);
71
72+ m_homeLens = new unity::dash::HomeLens(u2dTr("Home").toStdString(), u2dTr("Home screen").toStdString(), u2dTr("Search").toStdString());
73 m_unityLenses = new unity::dash::FilesystemLenses("/usr/share/unity/lenses");
74- for (unsigned int i=0; i<m_unityLenses->count(); i++) {
75- unity::dash::Lens::Ptr unityLens = m_unityLenses->GetLensAtIndex(i);
76- addUnityLens(unityLens, i);
77- }
78- m_unityLenses->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded));
79+ m_homeLens->AddLenses(*m_unityLenses);
80+ m_homeLens->lens_added.connect(sigc::mem_fun(this, &Lenses::onLensAdded));
81+ unity::dash::HomeLens::Ptr homeLensPtr(m_homeLens);
82+ addUnityLens(homeLensPtr, 0);
83 }
84
85 Lenses::~Lenses()
86 {
87 delete m_unityLenses;
88+ delete m_homeLens;
89 }
90
91 int Lenses::rowCount(const QModelIndex& parent) const
92
93=== modified file 'libunity-2d-private/src/lenses.h'
94--- libunity-2d-private/src/lenses.h 2011-08-11 14:38:51 +0000
95+++ libunity-2d-private/src/lenses.h 2012-02-16 08:01:24 +0000
96@@ -26,6 +26,7 @@
97
98 // libunity-core
99 #include <UnityCore/Lens.h>
100+#include <UnityCore/HomeLens.h>
101
102 namespace unity
103 {
104@@ -64,6 +65,7 @@
105
106 private:
107 unity::dash::Lenses* m_unityLenses;
108+ unity::dash::HomeLens* m_homeLens;
109 QList<Lens*> m_lenses;
110
111 void addUnityLens(unity::dash::Lens::Ptr unity_lens, int index);
112
113=== modified file 'shell/Shell.qml'
114--- shell/Shell.qml 2012-02-10 17:03:01 +0000
115+++ shell/Shell.qml 2012-02-16 08:01:24 +0000
116@@ -164,7 +164,7 @@
117
118 InputShapeMask {
119 id: shape1
120- source: "shell/dash/artwork/desktop_dash_background_no_transparency.png"
121+ source: "shell/common/artwork/desktop_dash_background_no_transparency.png"
122 color: "red"
123 position: Qt.point(dashLoader.width - 50, dashLoader.height - 49)
124 enabled: declarativeView.dashMode == ShellDeclarativeView.DesktopMode
125
126=== modified file 'shell/app/shelldeclarativeview.cpp'
127--- shell/app/shelldeclarativeview.cpp 2012-02-09 12:27:35 +0000
128+++ shell/app/shelldeclarativeview.cpp 2012-02-16 08:01:24 +0000
129@@ -41,6 +41,7 @@
130 #include <QtDBus/QDBusInterface>
131 #include <QX11Info>
132 #include <QGraphicsObject>
133+#include <QFileInfo>
134
135 // X11
136 #include <X11/Xlib.h>
137@@ -188,6 +189,12 @@
138 return m_active;
139 }
140
141+bool
142+ShellDeclarativeView::haveCustomHomeShortcuts() const
143+{
144+ return QFileInfo(unity2dDirectory() + "/shell/dash/HomeShortcutsCustomized.qml").exists();
145+}
146+
147 void
148 ShellDeclarativeView::setDashMode(ShellDeclarativeView::DashMode mode)
149 {
150
151=== modified file 'shell/app/shelldeclarativeview.h'
152--- shell/app/shelldeclarativeview.h 2012-02-09 02:22:19 +0000
153+++ shell/app/shelldeclarativeview.h 2012-02-16 08:01:24 +0000
154@@ -39,6 +39,7 @@
155 Q_PROPERTY(QString activeLens READ activeLens WRITE setActiveLens NOTIFY activeLensChanged)
156 Q_PROPERTY(bool focus READ hasFocus NOTIFY focusChanged) // overridden to add notify
157 Q_PROPERTY(bool superKeyHeld READ superKeyHeld NOTIFY superKeyHeldChanged)
158+ Q_PROPERTY(bool haveCustomHomeShortcuts READ haveCustomHomeShortcuts)
159
160 /* These two properties and mouse movement tracking on the widget are added here only because
161 we need to detect when the mouse is inside the area occupied by the lancher. This should
162@@ -59,6 +60,7 @@
163
164 /* getters */
165 bool dashActive() const;
166+ bool haveCustomHomeShortcuts() const;
167 DashMode dashMode() const;
168 const QString& activeLens() const;
169 bool expanded() const;
170
171=== added file 'shell/common/Background.qml'
172--- shell/common/Background.qml 1970-01-01 00:00:00 +0000
173+++ shell/common/Background.qml 2012-02-16 08:01:24 +0000
174@@ -0,0 +1,111 @@
175+/*
176+ * This file is part of unity-2d
177+ *
178+ * Copyright 2010-2011 Canonical Ltd.
179+ *
180+ * This program is free software; you can redistribute it and/or modify
181+ * it under the terms of the GNU General Public License as published by
182+ * the Free Software Foundation; version 3.
183+ *
184+ * This program is distributed in the hope that it will be useful,
185+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
186+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
187+ * GNU General Public License for more details.
188+ *
189+ * You should have received a copy of the GNU General Public License
190+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
191+ */
192+
193+import QtQuick 1.1
194+import Unity2d 1.0
195+import Effects 1.0
196+
197+Item {
198+ id: background
199+ property bool active: false
200+ property bool fullscreen: false
201+ property int bottomBorderThickness
202+ property int rightBorderThickness
203+
204+ /* Avoid redraw at rendering */
205+ effect: CacheEffect {}
206+
207+ Item {
208+ anchors.fill: parent
209+ anchors.bottomMargin: bottomBorderThickness
210+ anchors.rightMargin: rightBorderThickness
211+ clip: true
212+
213+ Image {
214+ id: blurredBackground
215+
216+ effect: Blur {blurRadius: 12}
217+
218+ /* 'source' needs to be set when this becomes visible, that is when active
219+ becomes true, so that a screenshot of the desktop is taken at that point.
220+ See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop
221+ */
222+
223+ /* Use an image of the root window which essentially is a
224+ capture of the entire screen */
225+ source: active ? "image://window/root" : ""
226+ cache: false
227+
228+ fillMode: Image.PreserveAspectCrop
229+
230+ /* Place the screenshot of the desktop background on top of the desktop background,
231+ no matter where the DeclarativeView or the parent object are placed.
232+ */
233+ property variant origin: parent.mapFromItem(null, -declarativeView.globalPosition.x, -declarativeView.globalPosition.y)
234+ x: origin.x
235+ y: origin.y
236+ }
237+
238+ Image {
239+ anchors.fill: parent
240+ fillMode: Image.PreserveAspectCrop
241+ source: "artwork/background_sheen.png"
242+ }
243+ }
244+
245+ BorderImage {
246+ id: border
247+
248+ /* Define properties of border here */
249+ property int bottomThickness: 39
250+ property int rightThickness: 37
251+
252+ anchors.fill: parent
253+ source: desktop.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci"
254+ mirror: isRightToLeft()
255+ }
256+
257+ states: [
258+ State {
259+ name: "normal"
260+ when: !fullscreen
261+ PropertyChanges {
262+ target: background
263+ bottomBorderThickness: border.bottomThickness
264+ rightBorderThickness: border.rightThickness
265+ }
266+ PropertyChanges {
267+ target: border
268+ visible: true
269+ }
270+ },
271+ State {
272+ name: "fullscreen"
273+ when: fullscreen
274+ PropertyChanges {
275+ target: background
276+ bottomBorderThickness: 0
277+ rightBorderThickness: 0
278+ }
279+ PropertyChanges {
280+ target: border
281+ visible: false
282+ }
283+ }
284+ ]
285+}
286
287=== added file 'shell/common/IconTile.qml'
288--- shell/common/IconTile.qml 1970-01-01 00:00:00 +0000
289+++ shell/common/IconTile.qml 2012-02-16 08:01:24 +0000
290@@ -0,0 +1,97 @@
291+/*
292+ * This file is part of unity-2d
293+ *
294+ * Copyright 2010-2011 Canonical Ltd.
295+ *
296+ * This program is free software; you can redistribute it and/or modify
297+ * it under the terms of the GNU General Public License as published by
298+ * the Free Software Foundation; version 3.
299+ *
300+ * This program is distributed in the hope that it will be useful,
301+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
302+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
303+ * GNU General Public License for more details.
304+ *
305+ * You should have received a copy of the GNU General Public License
306+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
307+ */
308+
309+import QtQuick 1.1
310+import Unity2d 1.0
311+
312+Item {
313+ id: iconTile
314+
315+ property bool activeFocus: false
316+ property bool backgroundFromIcon: true
317+ property alias source: icon.source
318+ property alias backgroundOpacity: tileBackground.opacity
319+
320+ /* For icons that do not follow usual tile design, can specify custom tile background,
321+ custom tile background when tile selected, and custom shine image for on top */
322+ property string selectedTileBackgroundImage: ""
323+ property string tileBackgroundImage: ""
324+ property string tileShineImage: ""
325+
326+ property color defaultBackgroundColor: "#333333"
327+ property color selectedBackgroundColor: "#dddddd"
328+
329+ /* This is the image providing the background image. The color blended
330+ with this image is obtained from the color of the icon when it's loaded.
331+ While the application is launching, this will fade out and in. */
332+ Image {
333+ id: tileBackground
334+ objectName: "tileBackground"
335+ property color color: defaultBackgroundColor
336+ anchors.fill: parent
337+ smooth: true
338+
339+ source: {
340+ if (selectedTileBackgroundImage != "" && declarativeView.focus && activeFocus) {
341+ return selectedTileBackgroundImage
342+ } else if (tileBackgroundImage != "") {
343+ return tileBackgroundImage
344+ }
345+
346+ var actualColor = declarativeView.focus && activeFocus ? selectedBackgroundColor : color
347+ return "image://blended/%1color=%2alpha=%3"
348+ .arg("common/artwork/round_corner_54x54.png")
349+ .arg(actualColor.toString().replace("#", ""))
350+ .arg(1.0)
351+ }
352+ }
353+
354+ /* This is just the main icon of the tile */
355+ Image {
356+ id: icon
357+ objectName: "icon"
358+ anchors.centerIn: parent
359+ smooth: true
360+
361+ sourceSize.width: 48
362+ sourceSize.height: 48
363+
364+ /* Whenever one of the parameters used in calculating the background color of
365+ the icon changes, recalculate its value */
366+ onWidthChanged: updateColors()
367+ onHeightChanged: updateColors()
368+ onSourceChanged: updateColors()
369+ onStatusChanged: if (status == Image.Error) source = "image://icons/unknown"
370+
371+ function updateColors() {
372+ if (!backgroundFromIcon) return;
373+
374+ var colors = iconUtilities.getColorsFromIcon(icon.source, icon.sourceSize)
375+ if (colors && colors.length > 0) tileBackground.color = colors[0]
376+ }
377+ }
378+
379+ /* This just adds some shiny effect to the tile */
380+ Image {
381+ id: tileShine
382+ anchors.fill: parent
383+ smooth: true
384+
385+ source: (tileShineImage != "") ? tileShineImage : "artwork/round_shine_54x54.png"
386+ }
387+}
388
389=== renamed file 'shell/dash/SearchEntry.qml' => 'shell/common/SearchEntry.qml'
390--- shell/dash/SearchEntry.qml 2012-01-10 10:42:46 +0000
391+++ shell/common/SearchEntry.qml 2012-02-16 08:01:24 +0000
392@@ -18,28 +18,22 @@
393
394 import QtQuick 1.1
395 import Effects 1.0
396-import "../common/fontUtils.js" as FontUtils
397-import "../common"
398+import "fontUtils.js" as FontUtils
399
400 AbstractButton {
401 property string searchQuery
402+ property string placeHolderText: ""
403+ property bool active: false
404+
405+ signal activateFirstResult
406
407 Accessible.name: "Search Entry"
408
409- /* Cancels current search when the dash becomes invisible */
410- Connections {
411- target: dash
412- onActiveChanged: if (!dash.active) search_input.text = ""
413- }
414-
415- Binding {
416- target: dash.currentPage != undefined ? dash.currentPage.model : null
417- property: "searchQuery"
418- value: searchQuery
419- }
420+ /* Delete search when set in-active */
421+ onActiveChanged: if (!active) searchInput.text = ""
422
423 /* Keys forwarded to the search entry are forwarded to the text input. */
424- Keys.forwardTo: [search_input]
425+ Keys.forwardTo: [searchInput]
426
427 opacity: ( state == "selected" || state == "hovered" ) ? 1.0 : 0.7
428
429@@ -58,7 +52,7 @@
430 anchors.rightMargin: 16
431
432 Image {
433- id: search_icon
434+ id: searchIcon
435
436 anchors.left: parent.left
437 anchors.leftMargin: -9
438@@ -68,28 +62,28 @@
439
440 smooth: true
441
442- source: search_input.text ? "artwork/cross.png" : "artwork/search_icon.png"
443+ source: searchInput.text ? "artwork/cross.png" : "artwork/search_icon.png"
444 fillMode: Image.PreserveAspectFit
445 }
446
447 MouseArea {
448- id: clear_button
449+ id: clearButton
450
451 Accessible.name: "Clear"
452 Accessible.role: Accessible.PushButton
453
454- anchors.fill: search_icon
455+ anchors.fill: searchIcon
456
457 onClicked: {
458- search_input.forceActiveFocus()
459- search_input.text = ""
460+ searchInput.forceActiveFocus()
461+ searchInput.text = ""
462 }
463 }
464
465 TextInput {
466- id: search_input
467+ id: searchInput
468
469- Accessible.name: search_instructions.text
470+ Accessible.name: searchInstructions.text
471 Accessible.role: Accessible.EditableText
472
473 effect: DropShadow {
474@@ -99,10 +93,10 @@
475 offset.x: 0
476 offset.y: 0
477 color: "white"
478- enabled: search_input.text != "" || search_input.inputMethodComposing
479+ enabled: searchInput.text != "" || searchInput.inputMethodComposing
480 }
481
482- anchors.left: search_icon.right
483+ anchors.left: searchIcon.right
484 anchors.leftMargin: -5
485 anchors.right: parent.right
486 anchors.verticalCenter: parent.verticalCenter
487@@ -115,17 +109,17 @@
488 cursorDelegate: cursor
489 selectionColor: "gray"
490
491- onTextChanged: live_search_timeout.restart()
492+ onTextChanged: liveSearchTimeout.restart()
493
494 Timer {
495- id: live_search_timeout
496+ id: liveSearchTimeout
497 interval: 200
498- onTriggered: searchQuery = search_input.text
499+ onTriggered: searchQuery = searchInput.text
500 }
501
502 Keys.onPressed: {
503 if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter) {
504- dash.currentPage.activateFirstResult()
505+ activateFirstResult()
506 event.accepted = true;
507 }
508 }
509@@ -159,7 +153,7 @@
510 }
511
512 TextCustom {
513- id: search_instructions
514+ id: searchInstructions
515
516 anchors.left: parent.left
517 anchors.right: parent.right
518@@ -173,12 +167,10 @@
519 fontSize: "x-large"
520 font.italic: true
521 text: {
522- if(search_input.text || search_input.inputMethodComposing)
523+ if(searchInput.text || searchInput.inputMethodComposing)
524 return ""
525- else if(dash.currentPage != undefined && dash.currentPage.model.searchHint)
526- return dash.currentPage.model.searchHint
527 else
528- return u2d.tr("Search")
529+ return placeHolderText
530 }
531 }
532 }
533
534=== renamed file 'shell/dash/artwork/background_sheen.png' => 'shell/common/artwork/background_sheen.png'
535=== renamed file 'shell/dash/artwork/cross.png' => 'shell/common/artwork/cross.png'
536=== renamed file 'shell/dash/artwork/desktop_dash_background.png' => 'shell/common/artwork/desktop_dash_background.png'
537=== renamed file 'shell/dash/artwork/desktop_dash_background.sci' => 'shell/common/artwork/desktop_dash_background.sci'
538=== renamed file 'shell/dash/artwork/desktop_dash_background_no_transparency.png' => 'shell/common/artwork/desktop_dash_background_no_transparency.png'
539=== renamed file 'shell/dash/artwork/desktop_dash_background_no_transparency.sci' => 'shell/common/artwork/desktop_dash_background_no_transparency.sci'
540=== renamed file 'shell/launcher/artwork/round_corner_54x54.png' => 'shell/common/artwork/round_corner_54x54.png'
541=== renamed file 'shell/launcher/artwork/round_shine_54x54.png' => 'shell/common/artwork/round_shine_54x54.png'
542=== renamed file 'shell/dash/artwork/search_background.png' => 'shell/common/artwork/search_background.png'
543=== renamed file 'shell/dash/artwork/search_background.sci' => 'shell/common/artwork/search_background.sci'
544=== renamed file 'shell/dash/artwork/search_icon.png' => 'shell/common/artwork/search_icon.png'
545=== modified file 'shell/dash/Dash.qml'
546--- shell/dash/Dash.qml 2012-02-09 11:22:43 +0000
547+++ shell/dash/Dash.qml 2012-02-16 08:01:24 +0000
548@@ -106,6 +106,7 @@
549 for (var i=0; i<lenses.rowCount(); i++) {
550 lenses.get(i).viewType = Lens.Hidden
551 }
552+ declarativeView.activeLens = ""
553 }
554
555 SpreadMonitor {
556@@ -133,11 +134,19 @@
557 return
558 }
559
560- /* To activate lens, we set its viewType to LensView, and then set all
561- other lenses to Hidden */
562 for (var i=0; i<lenses.rowCount(); i++) {
563 var thislens = lenses.get(i)
564- thislens.viewType = (lens == thislens) ? Lens.LensView : Lens.Hidden
565+ if (lensId == "home.lens") {
566+ if (thislens.id == lensId) {
567+ thislens.viewType = Lens.LensView
568+ continue
569+ }
570+ /* When Home is shown, need to notify all other lenses. Those in the global view
571+ (in home search results page) are set to HomeView, all others to Hidden */
572+ thislens.viewType = (thislens.searchInGlobal) ? Lens.HomeView : Lens.Hidden
573+ } else {
574+ thislens.viewType = (lens == thislens) ? Lens.LensView : Lens.Hidden
575+ }
576 }
577
578 buildLensPage(lens)
579@@ -147,20 +156,19 @@
580
581 function activateHome() {
582 if (spreadMonitor.shown) return
583-
584- /* When Home is shown, need to notify all other lenses. Those in the global view
585- (in home search results page) are set to HomeView, all others to Hidden */
586- for (var i=0; i<lenses.rowCount(); i++) {
587- var thislens = lenses.get(i)
588- thislens.viewType = (thislens.searchInGlobal) ? Lens.HomeView : Lens.Hidden
589+ if (declarativeView.haveCustomHomeShortcuts) {
590+ for (var i=0; i<lenses.rowCount(); i++) {
591+ lenses.get(i).viewType = Lens.Hidden
592+ }
593+ pageLoader.setSource("Home.qml")
594+ /* Take advantage of the fact that the loaded qml is local and setting
595+ the source loads it immediately making pageLoader.item valid */
596+ activatePage(pageLoader.item)
597+ declarativeView.activeLens = ""
598+ dash.active = true
599+ } else {
600+ activateLens("home.lens")
601 }
602-
603- pageLoader.setSource("Home.qml")
604- /* Take advantage of the fact that the loaded qml is local and setting
605- the source loads it immediately making pageLoader.item valid */
606- activatePage(pageLoader.item)
607- declarativeView.activeLens = ""
608- dash.active = true
609 }
610
611 function activateLensWithOptionFilter(lensId, filterId, optionId) {
612@@ -211,55 +219,13 @@
613 }
614 }
615
616- Item {
617+ Background {
618 id: background
619
620 anchors.fill: parent
621
622- /* Avoid redraw at rendering */
623- effect: CacheEffect {}
624-
625- Item {
626- anchors.fill: parent
627- anchors.bottomMargin: content.anchors.bottomMargin
628- anchors.rightMargin: content.anchors.rightMargin
629- clip: true
630-
631- Image {
632- id: blurredBackground
633-
634- effect: Blur {blurRadius: 12}
635-
636- /* 'source' needs to be set when the dash becomes visible, that
637- is when dash.active becomes true, so that a
638- screenshot of the windows behind the dash is taken at that
639- point.
640- See http://doc.qt.nokia.com/4.7-snapshot/qml-image.html#cache-prop
641- */
642-
643- /* Use an image of the root window which essentially is a
644- capture of the entire screen */
645- source: dash.active ? "image://window/root" : ""
646- cache: false
647-
648- fillMode: Image.PreserveAspectCrop
649- x: -launcherLoader.width
650- y: -declarativeView.globalPosition.y
651- }
652-
653- Image {
654- anchors.fill: parent
655- fillMode: Image.PreserveAspectCrop
656- source: "artwork/background_sheen.png"
657- }
658- }
659-
660- BorderImage {
661- anchors.fill: parent
662- visible: declarativeView.dashMode == ShellDeclarativeView.DesktopMode
663- source: desktop.isCompositingManagerRunning ? "artwork/desktop_dash_background.sci" : "artwork/desktop_dash_background_no_transparency.sci"
664- mirror: isRightToLeft()
665- }
666+ active: dash.active
667+ fullscreen: declarativeView.dashMode != ShellDeclarativeView.DesktopMode
668 }
669
670 Item {
671@@ -269,8 +235,8 @@
672 /* Margins in DesktopMode set so that the content does not overlap with
673 the border defined by the background image.
674 */
675- anchors.bottomMargin: declarativeView.dashMode == ShellDeclarativeView.DesktopMode ? 39 : 0
676- anchors.rightMargin: declarativeView.dashMode == ShellDeclarativeView.DesktopMode ? 37 : 0
677+ anchors.bottomMargin: background.bottomBorderThickness
678+ anchors.rightMargin: background.rightBorderThickness
679
680 /* Unhandled keys will always be forwarded to the search bar. That way
681 the user can type and search from anywhere in the interface without
682@@ -296,6 +262,17 @@
683 anchors.rightMargin: 15
684
685 height: 42
686+
687+ active: dash.active
688+ placeHolderText: {
689+ if(dash.currentPage != undefined && dash.currentPage.model.searchHint)
690+ return dash.currentPage.model.searchHint
691+ else
692+ return u2d.tr("Search")
693+ }
694+
695+ onSearchQueryChanged: if (dash.currentPage != undefined) dash.currentPage.model.searchQuery = searchQuery
696+ onActivateFirstResult: if (dash.currentPage != undefined) dash.currentPage.activateFirstResult()
697 }
698
699 FilterPane {
700@@ -304,7 +281,7 @@
701 KeyNavigation.left: search_entry
702
703 /* FilterPane is only to be displayed for lenses, not in the home page or Alt+F2 Run page */
704- visible: declarativeView.activeLens != "" && declarativeView.activeLens != "commands.lens"
705+ visible: declarativeView.activeLens != "home.lens" && declarativeView.activeLens != "" && declarativeView.activeLens != "commands.lens"
706 lens: visible && currentPage != undefined ? currentPage.model : undefined
707
708 anchors.top: search_entry.anchors.top
709
710=== modified file 'shell/dash/FilterCheckoption.qml'
711--- shell/dash/FilterCheckoption.qml 2012-01-10 16:52:24 +0000
712+++ shell/dash/FilterCheckoption.qml 2012-02-16 08:01:24 +0000
713@@ -23,11 +23,13 @@
714
715 height: filters.height
716
717+ property variant grid_columns : 2
718+
719 GridViewWithSpacing {
720 id: filters
721
722- columns: ( filterView.filterModel.id == "genre"
723- || filterView.filterModel.id == "modified" ) ? 3 : 2
724+ columns: grid_columns
725+
726 rows: Math.ceil(count/columns)
727
728 horizontalSpacing: 10
729
730=== added file 'shell/dash/FilterCheckoptionCompact.qml'
731--- shell/dash/FilterCheckoptionCompact.qml 1970-01-01 00:00:00 +0000
732+++ shell/dash/FilterCheckoptionCompact.qml 2012-02-16 08:01:24 +0000
733@@ -0,0 +1,22 @@
734+/*
735+ * This file is part of unity-2d
736+ *
737+ * Copyright 2010-2011 Canonical Ltd.
738+ *
739+ * This program is free software; you can redistribute it and/or modify
740+ * it under the terms of the GNU General Public License as published by
741+ * the Free Software Foundation; version 3.
742+ *
743+ * This program is distributed in the hope that it will be useful,
744+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
745+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
746+ * GNU General Public License for more details.
747+ *
748+ * You should have received a copy of the GNU General Public License
749+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
750+ */
751+import QtQuick 1.0
752+
753+FilterCheckoption {
754+ grid_columns : 3
755+}
756
757=== modified file 'shell/dash/FilterLoader.qml'
758--- shell/dash/FilterLoader.qml 2011-11-30 10:28:01 +0000
759+++ shell/dash/FilterLoader.qml 2012-02-16 08:01:24 +0000
760@@ -22,6 +22,7 @@
761
762 FocusScope {
763 id: filterLoader
764+ objectName: filterModel.rendererName
765
766 property variant lens
767 property variant filterModel
768@@ -96,6 +97,7 @@
769
770 Loader {
771 id: filterView
772+ objectName: filterModel.rendererName
773
774 KeyNavigation.up: header
775 anchors.top: header.bottom
776
777=== modified file 'shell/dash/FilterPane.qml'
778--- shell/dash/FilterPane.qml 2012-01-10 17:31:32 +0000
779+++ shell/dash/FilterPane.qml 2012-02-16 08:01:24 +0000
780@@ -32,6 +32,7 @@
781
782 AbstractButton {
783 id: header
784+ objectName: "filterResults"
785
786 Accessible.name: title.text
787
788
789=== modified file 'shell/dash/Home.qml'
790--- shell/dash/Home.qml 2012-01-20 09:35:38 +0000
791+++ shell/dash/Home.qml 2012-02-16 08:01:24 +0000
792@@ -170,7 +170,7 @@
793 width: sourceSize.width
794 height: sourceSize.height
795
796- source: "artwork/cross.png"
797+ source: "../common/artwork/cross.png"
798 }
799
800 opacity: (expanded && declarativeView.dashMode == ShellDeclarativeView.DesktopMode) ? 1 : 0
801
802=== modified file 'shell/dash/LensBar.qml'
803--- shell/dash/LensBar.qml 2012-01-10 13:07:48 +0000
804+++ shell/dash/LensBar.qml 2012-02-16 08:01:24 +0000
805@@ -93,22 +93,6 @@
806 return undefined
807 }
808
809- /* Need to manually include the Home lens */
810- LensButton {
811- id: homeLens
812-
813- Accessible.name: u2d.tr("home")
814-
815- focus: true
816- icon: "artwork/lens-nav-home.svg"
817- onClicked: dash.activateHome()
818- active: ( declarativeView.activeLens == "" )
819- iconWidth: lensBar.iconWidth
820- iconSpacing: lensBar.iconSpacing
821- width: iconWidth+iconSpacing
822- height: lensContainer.height
823- }
824-
825 /* Now fetch all other lenses and display */
826 Repeater{
827 id: repeater
828@@ -116,11 +100,29 @@
829 model: visibleLenses
830 delegate: LensButton {
831 Accessible.name: u2d.tr(item.name)
832+ objectName: item.name
833
834 /* Heuristic: if iconHint does not contain a '/' then it is an icon name */
835- icon: item.iconHint.indexOf("/") == -1 ? "image://icons/" + item.iconHint : item.iconHint
836- active: item.viewType == Lens.LensView
837- onClicked: dash.activateLens(item.id)
838+ icon: {
839+ if (item.id == "home.lens") {
840+ return "artwork/lens-nav-home.svg"
841+ }
842+ item.iconHint.indexOf("/") == -1 ? "image://icons/" + item.iconHint : item.iconHint
843+ }
844+ active: {
845+ /* we need this in order to activate the arrow when using a custom shortcuts file */
846+ if (item.id == "home.lens" && declarativeView.activeLens == "") {
847+ return true
848+ }
849+ return item.viewType == Lens.LensView
850+ }
851+ onClicked: {
852+ if (item.id == "home.lens") {
853+ dash.activateHome()
854+ } else {
855+ dash.activateLens(item.id)
856+ }
857+ }
858 iconWidth: lensBar.iconWidth
859 iconSpacing: lensBar.iconSpacing
860 width: iconWidth+iconSpacing
861
862=== modified file 'shell/dash/LensView.qml'
863--- shell/dash/LensView.qml 2012-01-10 10:42:46 +0000
864+++ shell/dash/LensView.qml 2012-02-16 08:01:24 +0000
865@@ -81,7 +81,7 @@
866 bodyDelegate: Loader {
867 visible: category_model.count > 0
868 width: parent.width
869- height: visible ? item.contentHeight : 0
870+ height: item ? visible ? item.contentHeight : 0 : 0
871
872 property string name: model.column_0
873 property string iconHint: model.column_1
874@@ -119,18 +119,19 @@
875 Binding { target: item; property: "categoryId"; value: categoryId }
876 Binding { target: item; property: "category_model"; value: category_model }
877 Binding { target: item; property: "lens"; value: lensView.model }
878+ Binding { target: item; property: "lensId"; value: lensView.model.id }
879
880 onLoaded: item.focus = true
881 }
882
883 headerDelegate: CategoryHeader {
884- visible: body.item.needHeader && body.visible
885+ visible: body.item ? body.item.needHeader && body.visible : false
886 height: visible ? 32 : 0
887
888- property bool foldable: body.item.folded != undefined
889- availableCount: foldable ? body.category_model.count - body.item.cellsPerRow : 0
890- folded: foldable ? body.item.folded : false
891- onClicked: if(foldable) body.item.folded = !body.item.folded
892+ property bool foldable: body.item ? body.item.folded != undefined : false
893+ availableCount: body.item ? foldable ? body.category_model.count - body.item.cellsPerRow : 0 : 0
894+ folded: body.item ? foldable ? body.item.folded : false : false
895+ onClicked: if(foldable && body.item) body.item.folded = !body.item.folded
896 moving: flickerMoving
897
898 icon: body.iconHint
899
900=== modified file 'shell/dash/RendererGrid.qml'
901--- shell/dash/RendererGrid.qml 2011-11-23 10:27:05 +0000
902+++ shell/dash/RendererGrid.qml 2012-02-16 08:01:24 +0000
903@@ -77,14 +77,6 @@
904
905 FocusPath.index: index
906
907- property string uri: column_0
908- property string iconHint: column_1
909- property string categoryId: column_2 // FIXME: rename to categoryIndex
910- property string mimetype: column_3
911- property string displayName: column_4 // FIXME: rename to name
912- property string comment: column_5
913- property string dndUri: column_6
914-
915 Loader {
916 id: loader
917
918@@ -96,13 +88,13 @@
919
920 sourceComponent: cellRenderer
921 onLoaded: {
922- item.uri = uri
923- item.iconHint = iconHint
924- item.mimetype = mimetype
925- item.displayName = displayName
926- item.comment = comment
927+ item.uri = column_0
928+ item.iconHint = column_1
929+ item.mimetype = column_3
930+ item.displayName = column_4
931+ item.comment = column_5
932 item.focus = true
933- item.dndUri = dndUri
934+ item.dndUri = column_6
935 }
936 }
937 }
938
939=== modified file 'shell/launcher/LauncherItem.qml'
940--- shell/launcher/LauncherItem.qml 2012-02-06 12:07:47 +0000
941+++ shell/launcher/LauncherItem.qml 2012-02-16 08:01:24 +0000
942@@ -18,6 +18,7 @@
943
944 import QtQuick 1.1
945 import Unity2d 1.0
946+import "../common"
947
948 /* This component represents a single "tile" in the launcher and the surrounding
949 indicator icons.
950@@ -191,19 +192,22 @@
951 height: item.tileSize
952 anchors.centerIn: parent
953
954- /* This is the image providing the background image. The
955- color blended with this image is obtained from the color of the icon when it's
956- loaded.
957- While the application is launching, this will fade out and in. */
958- Image {
959- id: tileBackground
960- objectName: "tileBackground"
961- property color color: defaultBackgroundColor
962- anchors.fill: parent
963- smooth: true
964- opacity: 1
965-
966- SequentialAnimation on opacity {
967+ /* This draws the icon, the tile background and the sheen on top */
968+ IconTile {
969+ id: icon
970+ width: item.tileSize
971+ height: item.tileSize
972+ anchors.centerIn: parent
973+
974+ activeFocus: item.activeFocus
975+ backgroundFromIcon: item.backgroundFromIcon
976+
977+ tileBackgroundImage: (item.isBfb) ? "../launcher/artwork/squircle_base_54.png" : ""
978+ tileShineImage: (item.isBfb) ? "../launcher/artwork/squircle_shine_54.png" : ""
979+ selectedTileBackgroundImage: (item.isBfb) ? "../launcher/artwork/squircle_base_selected_54.png" : ""
980+
981+ /* tile background fade in/out animation */
982+ SequentialAnimation on backgroundOpacity {
983 NumberAnimation { to: 0.0; duration: 1000; easing.type: Easing.InOutQuad }
984 NumberAnimation { to: 1.0; duration: 1000; easing.type: Easing.InOutQuad }
985
986@@ -211,24 +215,6 @@
987 alwaysRunToEnd: true
988 running: launching
989 }
990-
991- sourceSize.width: item.tileSize
992- sourceSize.height: item.tileSize
993- source: {
994- if (isBfb) {
995- if (declarativeView.focus && item.activeFocus) {
996- return "artwork/squircle_base_selected_54.png"
997- } else {
998- return "artwork/squircle_base_54.png"
999- }
1000- }
1001-
1002- var actualColor = declarativeView.focus && item.activeFocus ? selectedBackgroundColor : color
1003- return "image://blended/%1color=%2alpha=%3"
1004- .arg("launcher/artwork/round_corner_54x54.png")
1005- .arg(actualColor.toString().replace("#", ""))
1006- .arg(1.0)
1007- }
1008 }
1009
1010 /* This image appears only while launching, and pulses in and out in counterpoint
1011@@ -254,42 +240,6 @@
1012 }
1013 }
1014
1015- /* This is just the main icon of the tile */
1016- Image {
1017- id: icon
1018- objectName: "icon"
1019- anchors.centerIn: parent
1020- smooth: true
1021-
1022- sourceSize.width: 48
1023- sourceSize.height: 48
1024-
1025- /* Whenever one of the parameters used in calculating the background color of
1026- the icon changes, recalculate its value */
1027- onWidthChanged: updateColors()
1028- onHeightChanged: updateColors()
1029- onSourceChanged: updateColors()
1030- onStatusChanged: if (status == Image.Error) source = "image://icons/unknown"
1031-
1032- function updateColors() {
1033- if (!item.backgroundFromIcon) return;
1034-
1035- var colors = iconUtilities.getColorsFromIcon(icon.source, icon.sourceSize)
1036- if (colors && colors.length > 0) tileBackground.color = colors[0]
1037- }
1038- }
1039-
1040- /* This just adds some shiny effect to the tile */
1041- Image {
1042- id: tileShine
1043- anchors.fill: parent
1044- smooth: true
1045-
1046- source: isBfb ? "artwork/squircle_shine_54.png" : "artwork/round_shine_54x54.png"
1047- sourceSize.width: item.tileSize
1048- sourceSize.height: item.tileSize
1049- }
1050-
1051 Image {
1052 id: selectionOutline
1053 objectName: "selectionOutline"
1054
1055=== modified file 'shell/launcher/LauncherList.qml'
1056--- shell/launcher/LauncherList.qml 2012-02-08 10:47:00 +0000
1057+++ shell/launcher/LauncherList.qml 2012-02-16 08:01:24 +0000
1058@@ -25,7 +25,7 @@
1059
1060 /* The spacing is explicitly set in order to compensate
1061 the space added by selectionOutline and round_corner_54x54.png. */
1062- spacing: -8
1063+ spacing: -7
1064
1065 property int tileSize: 54
1066
1067
1068=== modified file 'tests/dash/dash-tests.rb'
1069--- tests/dash/dash-tests.rb 2012-02-07 18:53:20 +0000
1070+++ tests/dash/dash-tests.rb 2012-02-16 08:01:24 +0000
1071@@ -214,6 +214,7 @@
1072 test "Super, Super and Alt+F1 interaction" do
1073 XDo::Mouse.move(200, 200, 0, true)
1074 xid = TmpWindow.open_window_at(10,100)
1075+ hide_mode = $SUT.execute_shell_command('gsettings get com.canonical.Unity2d.Launcher hide-mode').to_i
1076 verify_equal( xid.id, TIMEOUT, 'terminal should have focus after starting it' ) {
1077 XDo::XWindow.active_window
1078 }
1079@@ -231,7 +232,8 @@
1080 verify_equal( xid.id, TIMEOUT, 'terminal should have focus after toggling the dash' ) {
1081 XDo::XWindow.active_window
1082 }
1083- verify_equal( -LAUNCHER_WIDTH, TIMEOUT, 'Launcher should be hiding after toggling the dash' ) {
1084+ verify_equal((hide_mode == 0) ? 0 : -LAUNCHER_WIDTH, TIMEOUT,
1085+ 'Launcher position wrong after toggling the dash' ) {
1086 @app.Launcher()['x_absolute'].to_i
1087 }
1088 XDo::Keyboard.alt_F1 #Must use uppercase F to indicate function keys
1089
1090=== added file 'tests/dash/test-renderer-filter-check-option-compact.rb'
1091--- tests/dash/test-renderer-filter-check-option-compact.rb 1970-01-01 00:00:00 +0000
1092+++ tests/dash/test-renderer-filter-check-option-compact.rb 2012-02-16 08:01:24 +0000
1093@@ -0,0 +1,135 @@
1094+#!/usr/bin/env ruby1.8
1095+=begin
1096+/*
1097+ * This file is part of unity-2d
1098+ *
1099+ * Copyright 2011 Canonical Ltd.
1100+ *
1101+ * This program is free software; you can redistribute it and/or modify
1102+ * it under the terms of the GNU General Public License as published by
1103+ * the Free Software Foundation; version 3.
1104+ *
1105+ * This program is distributed in the hope that it will be useful,
1106+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1107+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1108+ * GNU General Public License for more details.
1109+ *
1110+ * You should have received a copy of the GNU General Public License
1111+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1112+ */
1113+=end
1114+
1115+require '../run-tests.rb' unless $INIT_COMPLETED
1116+require 'xdo/xwindow'
1117+require 'xdo/keyboard'
1118+require 'xdo/mouse'
1119+
1120+############################# Test Suite #############################
1121+context "Dash - Filter Results renderer tests" do
1122+ # Run once at the beginning of this test suite
1123+ startup do
1124+ $SUT.execute_shell_command 'killall unity-2d-shell'
1125+ $SUT.execute_shell_command 'killall unity-2d-shell'
1126+ end
1127+
1128+ # Run once at the end of this test suite
1129+ shutdown do
1130+ end
1131+
1132+ # Run before each test case begins
1133+ setup do
1134+ # Execute the application
1135+ @app = $SUT.run( :name => UNITY_2D_SHELL,
1136+ :arguments => "-testability",
1137+ :sleeptime => 2 )
1138+ end
1139+
1140+ # Run after each test case completes
1141+ teardown do
1142+ $SUT.execute_shell_command "pkill -nf unity-2d-shell"
1143+ end
1144+
1145+ #####################################################################################
1146+ # Test cases
1147+
1148+ # Test case objectives:
1149+ # * Verify renderer filter-check-option is displayed with two columns
1150+ # Pre-conditions
1151+ # * None
1152+ # Test steps
1153+ # * Open Dash
1154+ # * Goto Applications Lens
1155+ # * Open Filter Results
1156+ # * verify that filter-checkoption renderer is having two columns
1157+ # Post-conditions
1158+ # * None
1159+ # References
1160+ # * None
1161+ test "Verify renderer filter-check-option" do
1162+ XDo::Keyboard.super
1163+ verify (TIMEOUT) { @app.Dash() }
1164+
1165+ button = ""
1166+ verify( TIMEOUT, 'Could not find Applications Lens. Did you install it?' ) {
1167+ button = @app.Dash().LensBar().LensButton( :name => 'Applications' )
1168+ }
1169+
1170+ button.tap
1171+
1172+ verify( TIMEOUT, 'Could not find filterResults button' ) {
1173+ button = @app.Dash().FilterPane().AbstractButton( :name => 'filterResults' )
1174+ }
1175+
1176+ button.tap
1177+
1178+ loader = ""
1179+ verify( TIMEOUT, 'Could not find FilterCheckOption Loader' ) {
1180+ loader = @app.Dash().FilterPane().FilterLoader(:name => 'filter-checkoption').QDeclarativeLoader( :name => 'filter-checkoption' )
1181+ }
1182+
1183+ verify_equal(2, TIMEOUT, 'FilterCheckOption don\'t have two columns' ) {
1184+ loader.GridViewWithSpacing()['columns'].to_i
1185+ }
1186+
1187+ end
1188+
1189+ # Test case objectives:
1190+ # * Verify renderer filter-check-option-compact is displayed with three columns
1191+ # Pre-conditions
1192+ # * None
1193+ # Test steps
1194+ # * Open Dash
1195+ # * Goto Music Lens
1196+ # * Open Filter-Results
1197+ # * verify that filter-checkoption-compact renderer is having three columns
1198+ # Post-conditions
1199+ # * None
1200+ # References
1201+ # * None
1202+ test "Verify renderer filter-check-option-compact" do
1203+ XDo::Keyboard.super
1204+ verify (TIMEOUT) { @app.Dash() }
1205+
1206+ button = ""
1207+ verify( TIMEOUT, 'Could not find Music Lens. Did you install it?' ) {
1208+ button = @app.Dash().LensBar().LensButton( :name => 'Music' )
1209+ }
1210+
1211+ button.tap
1212+
1213+ verify( TIMEOUT, 'Could not find filterResults button' ) {
1214+ button = @app.Dash().FilterPane().AbstractButton( :name => 'filterResults' )
1215+ }
1216+
1217+ button.tap
1218+
1219+ loader = ""
1220+ verify( TIMEOUT, 'Could not find FilterCheckOptionCompact Loader' ) {
1221+ loader = @app.Dash().FilterPane().FilterLoader(:name => 'filter-checkoption-compact').QDeclarativeLoader( :name => 'filter-checkoption-compact' )
1222+ }
1223+
1224+ verify_equal(3, TIMEOUT, 'FilterCheckOptionCompact don\'t have three columns' ) {
1225+ loader.GridViewWithSpacing()['columns'].to_i
1226+ }
1227+ end
1228+end
1229
1230=== modified file 'tests/launcher/autohide_show_tests.rb'
1231--- tests/launcher/autohide_show_tests.rb 2012-02-07 11:18:21 +0000
1232+++ tests/launcher/autohide_show_tests.rb 2012-02-16 08:01:24 +0000
1233@@ -32,6 +32,7 @@
1234 ############################# Test Suite #############################
1235 context "Launcher Autohide and Show Tests" do
1236 launcher_favorites = ""
1237+ hide_mode = 0
1238
1239 def verify_launcher_visible(timeout, message = '')
1240 verify_equal( 0, timeout, message ) {
1241@@ -75,12 +76,18 @@
1242 $SUT.execute_shell_command 'killall unity-2d-shell'
1243 $SUT.execute_shell_command 'killall unity-2d-shell'
1244
1245+ hide_mode = $SUT.execute_shell_command 'gsettings get com.canonical.Unity2d.Launcher hide-mode'
1246+
1247+ # Set hide mode to intellihide
1248+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode 2'
1249+
1250 # Minimize all windows
1251 XDo::XWindow.toggle_minimize_all
1252 end
1253
1254 # Run once at the end of this test suite
1255 shutdown do
1256+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode ' + hide_mode
1257 end
1258
1259 # Run before each test case begins
1260
1261=== modified file 'tests/launcher/autohide_show_tests_rtl.rb'
1262--- tests/launcher/autohide_show_tests_rtl.rb 2012-02-07 11:18:21 +0000
1263+++ tests/launcher/autohide_show_tests_rtl.rb 2012-02-16 08:01:24 +0000
1264@@ -32,6 +32,7 @@
1265 ############################# Test Suite #############################
1266 context "Launcher Autohide and Show Tests on RTL" do
1267 launcher_favorites = ""
1268+ hide_mode = 0
1269
1270 def verify_launcher_visible(timeout, message = '')
1271 verify_equal( XDo::XWindow.display_geometry[0] - LAUNCHER_WIDTH, timeout, message ) {
1272@@ -76,12 +77,18 @@
1273 $SUT.execute_shell_command 'killall unity-2d-shell'
1274 $SUT.execute_shell_command 'killall unity-2d-shell'
1275
1276+ hide_mode = $SUT.execute_shell_command 'gsettings get com.canonical.Unity2d.Launcher hide-mode'
1277+
1278+ # Set hide mode to intellihide
1279+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode 2'
1280+
1281 # Minimize all windows
1282 XDo::XWindow.toggle_minimize_all
1283 end
1284
1285 # Run once at the end of this test suite
1286 shutdown do
1287+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode ' + hide_mode
1288 end
1289
1290 # Run before each test case begins
1291
1292=== modified file 'tests/shell/input_shaping.rb'
1293--- tests/shell/input_shaping.rb 2012-02-06 14:00:19 +0000
1294+++ tests/shell/input_shaping.rb 2012-02-16 08:01:24 +0000
1295@@ -33,6 +33,7 @@
1296 ############################# Test Suite #############################
1297 context "Shell input shape tests" do
1298 pwd = File.expand_path(File.dirname(__FILE__)) + '/'
1299+ hide_mode = 0
1300
1301 # Run once at the beginning of this test suite
1302 startup do
1303@@ -41,6 +42,11 @@
1304 $SUT.execute_shell_command 'killall unity-2d-panel'
1305 $SUT.execute_shell_command 'killall unity-2d-panel'
1306
1307+ hide_mode = $SUT.execute_shell_command 'gsettings get com.canonical.Unity2d.Launcher hide-mode'
1308+
1309+ # Set hide mode to intellihide
1310+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode 2'
1311+
1312 # Need panel running as position of shell depends on it
1313 @@panel = $SUT.run(:name => UNITY_2D_PANEL,
1314 :arguments => "-testability" )
1315@@ -51,6 +57,7 @@
1316
1317 # Run once at the end of this test suite
1318 shutdown do
1319+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode ' + hide_mode
1320 end
1321
1322 # Run before each test case begins
1323
1324=== modified file 'tests/shell/input_shaping_rtl.rb'
1325--- tests/shell/input_shaping_rtl.rb 2012-02-03 11:00:51 +0000
1326+++ tests/shell/input_shaping_rtl.rb 2012-02-16 08:01:24 +0000
1327@@ -33,6 +33,7 @@
1328 ############################# Test Suite #############################
1329 context "Shell input shape tests" do
1330 pwd = File.expand_path(File.dirname(__FILE__)) + '/'
1331+ hide_mode = 0
1332
1333 # Run once at the beginning of this test suite
1334 startup do
1335@@ -41,6 +42,11 @@
1336 $SUT.execute_shell_command 'killall unity-2d-panel'
1337 $SUT.execute_shell_command 'killall unity-2d-panel'
1338
1339+ hide_mode = $SUT.execute_shell_command 'gsettings get com.canonical.Unity2d.Launcher hide-mode'
1340+
1341+ # Set hide mode to intellihide
1342+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode 2'
1343+
1344 # Need panel running as position of shell depends on it
1345 @@panel = $SUT.run(:name => UNITY_2D_PANEL,
1346 :arguments => "-testability" )
1347@@ -51,6 +57,7 @@
1348
1349 # Run once at the end of this test suite
1350 shutdown do
1351+ $SUT.execute_shell_command 'gsettings set com.canonical.Unity2d.Launcher hide-mode ' + hide_mode
1352 end
1353
1354 # Run before each test case begins
1355
1356=== modified file 'tests/spread/spread-tests.rb'
1357--- tests/spread/spread-tests.rb 2012-01-27 09:06:28 +0000
1358+++ tests/spread/spread-tests.rb 2012-02-16 08:01:24 +0000
1359@@ -86,11 +86,15 @@
1360 # References
1361 # * None
1362 test "Super+s shows the launcher and the spread" do
1363+ hide_mode = $SUT.execute_shell_command('gsettings get com.canonical.Unity2d.Launcher hide-mode').to_i
1364+
1365 verify_not(2, 'There should not be a Spread declarative view on startup') {
1366 @app_spread.SpreadView()
1367 }
1368 xid = TmpWindow.open_window_at(10,100)
1369- verify_equal(-LAUNCHER_WIDTH, TIMEOUT, 'The launcher should not be visible with an overlapping window') {
1370+
1371+ verify_equal((hide_mode == 0) ? 0 :-LAUNCHER_WIDTH, TIMEOUT,
1372+ 'The launcher should not be visible with an overlapping window (unless Launcher in always-show mode)') {
1373 @app_shell.Launcher()['x_absolute'].to_i
1374 }
1375 XDo::Keyboard.super_s

Subscribers

People subscribed via source and target branches

to all changes: