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

Proposed by Lohith D Shivamurthy
Status: Merged
Approved by: Gerry Boland
Approved revision: 938
Merged at revision: 938
Proposed branch: lp:~unity-2d-team/unity-2d/filter-option-compact-shell
Merge into: lp:unity-2d
Diff against target: 252 lines (+178/-2)
7 files modified
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/FilterRadiooption.qml (+13/-0)
shell/dash/LensBar.qml (+1/-0)
tests/dash/test-renderer-filter-check-option-compact.rb (+135/-0)
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) Approve
Michał Sawicz Pending
Review via email: mp+93346@code.launchpad.net

This proposal supersedes a proposal from 2012-01-24.

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

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
Revision history for this message
Gerry Boland (gerboland) wrote : Posted in a previous version of this proposal

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 : Posted in a previous version of this proposal

Please resubmit the MR against lp:unity-2d

937. By Lohith D Shivamurthy

nerge lp:unity-2d

938. By Lohith D Shivamurthy

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

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

Question: can your small hack be a little more specific to the Files lens? Right now, any lens filterModel with id "modified" will be changed with this hack.

Small comment change needed:
+ unity-core fixes the issue
It is the files lens which needs fixing, not unity-core.

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

Well I can answer my question: No easy way to make this more specific to Files lens, without changing filters API. This hack will do.

Also, from comments on the bug attached, it appears fixes to unity-core will be needed.
As a result I withdraw my objections and approve. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shell/dash/FilterCheckoption.qml'
2--- shell/dash/FilterCheckoption.qml 2012-01-10 16:52:24 +0000
3+++ shell/dash/FilterCheckoption.qml 2012-02-17 12:01:32 +0000
4@@ -23,11 +23,13 @@
5
6 height: filters.height
7
8+ property variant grid_columns : 2
9+
10 GridViewWithSpacing {
11 id: filters
12
13- columns: ( filterView.filterModel.id == "genre"
14- || filterView.filterModel.id == "modified" ) ? 3 : 2
15+ columns: grid_columns
16+
17 rows: Math.ceil(count/columns)
18
19 horizontalSpacing: 10
20
21=== added file 'shell/dash/FilterCheckoptionCompact.qml'
22--- shell/dash/FilterCheckoptionCompact.qml 1970-01-01 00:00:00 +0000
23+++ shell/dash/FilterCheckoptionCompact.qml 2012-02-17 12:01:32 +0000
24@@ -0,0 +1,22 @@
25+/*
26+ * This file is part of unity-2d
27+ *
28+ * Copyright 2010-2011 Canonical Ltd.
29+ *
30+ * This program is free software; you can redistribute it and/or modify
31+ * it under the terms of the GNU General Public License as published by
32+ * the Free Software Foundation; version 3.
33+ *
34+ * This program is distributed in the hope that it will be useful,
35+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
36+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37+ * GNU General Public License for more details.
38+ *
39+ * You should have received a copy of the GNU General Public License
40+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
41+ */
42+import QtQuick 1.0
43+
44+FilterCheckoption {
45+ grid_columns : 3
46+}
47
48=== modified file 'shell/dash/FilterLoader.qml'
49--- shell/dash/FilterLoader.qml 2011-11-30 10:28:01 +0000
50+++ shell/dash/FilterLoader.qml 2012-02-17 12:01:32 +0000
51@@ -22,6 +22,7 @@
52
53 FocusScope {
54 id: filterLoader
55+ objectName: filterModel.rendererName
56
57 property variant lens
58 property variant filterModel
59@@ -96,6 +97,7 @@
60
61 Loader {
62 id: filterView
63+ objectName: filterModel.rendererName
64
65 KeyNavigation.up: header
66 anchors.top: header.bottom
67
68=== modified file 'shell/dash/FilterPane.qml'
69--- shell/dash/FilterPane.qml 2012-01-10 17:31:32 +0000
70+++ shell/dash/FilterPane.qml 2012-02-17 12:01:32 +0000
71@@ -32,6 +32,7 @@
72
73 AbstractButton {
74 id: header
75+ objectName: "filterResults"
76
77 Accessible.name: title.text
78
79
80=== modified file 'shell/dash/FilterRadiooption.qml'
81--- shell/dash/FilterRadiooption.qml 2011-11-09 12:47:37 +0000
82+++ shell/dash/FilterRadiooption.qml 2012-02-17 12:01:32 +0000
83@@ -19,4 +19,17 @@
84 import QtQuick 1.0
85
86 FilterCheckoption {
87+ /*TODO: This is a workaround for the unity-core bug
88+ Files & Folders-> LastModified should have 3 columns not 2
89+ https://bugs.launchpad.net/unity-lens-files/+bug/928208
90+ We should remove the following block as soon as
91+ unity-core fixes the issue
92+ */
93+ grid_columns : {
94+ if (filterModel.id === "modified") {
95+ return 3
96+ } else {
97+ return 2
98+ }
99+ }
100 }
101
102=== modified file 'shell/dash/LensBar.qml'
103--- shell/dash/LensBar.qml 2012-02-10 20:25:00 +0000
104+++ shell/dash/LensBar.qml 2012-02-17 12:01:32 +0000
105@@ -100,6 +100,7 @@
106 model: visibleLenses
107 delegate: LensButton {
108 Accessible.name: u2d.tr(item.name)
109+ objectName: item.name
110
111 /* Heuristic: if iconHint does not contain a '/' then it is an icon name */
112 icon: {
113
114=== added file 'tests/dash/test-renderer-filter-check-option-compact.rb'
115--- tests/dash/test-renderer-filter-check-option-compact.rb 1970-01-01 00:00:00 +0000
116+++ tests/dash/test-renderer-filter-check-option-compact.rb 2012-02-17 12:01:32 +0000
117@@ -0,0 +1,135 @@
118+#!/usr/bin/env ruby1.8
119+=begin
120+/*
121+ * This file is part of unity-2d
122+ *
123+ * Copyright 2011 Canonical Ltd.
124+ *
125+ * This program is free software; you can redistribute it and/or modify
126+ * it under the terms of the GNU General Public License as published by
127+ * the Free Software Foundation; version 3.
128+ *
129+ * This program is distributed in the hope that it will be useful,
130+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
131+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
132+ * GNU General Public License for more details.
133+ *
134+ * You should have received a copy of the GNU General Public License
135+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
136+ */
137+=end
138+
139+require '../run-tests.rb' unless $INIT_COMPLETED
140+require 'xdo/xwindow'
141+require 'xdo/keyboard'
142+require 'xdo/mouse'
143+
144+############################# Test Suite #############################
145+context "Dash - Filter Results renderer tests" do
146+ # Run once at the beginning of this test suite
147+ startup do
148+ $SUT.execute_shell_command 'killall unity-2d-shell'
149+ $SUT.execute_shell_command 'killall unity-2d-shell'
150+ end
151+
152+ # Run once at the end of this test suite
153+ shutdown do
154+ end
155+
156+ # Run before each test case begins
157+ setup do
158+ # Execute the application
159+ @app = $SUT.run( :name => UNITY_2D_SHELL,
160+ :arguments => "-testability",
161+ :sleeptime => 2 )
162+ end
163+
164+ # Run after each test case completes
165+ teardown do
166+ $SUT.execute_shell_command "pkill -nf unity-2d-shell"
167+ end
168+
169+ #####################################################################################
170+ # Test cases
171+
172+ # Test case objectives:
173+ # * Verify renderer filter-check-option is displayed with two columns
174+ # Pre-conditions
175+ # * None
176+ # Test steps
177+ # * Open Dash
178+ # * Goto Applications Lens
179+ # * Open Filter Results
180+ # * verify that filter-checkoption renderer is having two columns
181+ # Post-conditions
182+ # * None
183+ # References
184+ # * None
185+ test "Verify renderer filter-check-option" do
186+ XDo::Keyboard.super
187+ verify (TIMEOUT) { @app.Dash() }
188+
189+ button = ""
190+ verify( TIMEOUT, 'Could not find Applications Lens. Did you install it?' ) {
191+ button = @app.Dash().LensBar().LensButton( :name => 'Applications' )
192+ }
193+
194+ button.tap
195+
196+ verify( TIMEOUT, 'Could not find filterResults button' ) {
197+ button = @app.Dash().FilterPane().AbstractButton( :name => 'filterResults' )
198+ }
199+
200+ button.tap
201+
202+ loader = ""
203+ verify( TIMEOUT, 'Could not find FilterCheckOption Loader' ) {
204+ loader = @app.Dash().FilterPane().FilterLoader(:name => 'filter-checkoption').QDeclarativeLoader( :name => 'filter-checkoption' )
205+ }
206+
207+ verify_equal(2, TIMEOUT, 'FilterCheckOption don\'t have two columns' ) {
208+ loader.GridViewWithSpacing()['columns'].to_i
209+ }
210+
211+ end
212+
213+ # Test case objectives:
214+ # * Verify renderer filter-check-option-compact is displayed with three columns
215+ # Pre-conditions
216+ # * None
217+ # Test steps
218+ # * Open Dash
219+ # * Goto Music Lens
220+ # * Open Filter-Results
221+ # * verify that filter-checkoption-compact renderer is having three columns
222+ # Post-conditions
223+ # * None
224+ # References
225+ # * None
226+ test "Verify renderer filter-check-option-compact" do
227+ XDo::Keyboard.super
228+ verify (TIMEOUT) { @app.Dash() }
229+
230+ button = ""
231+ verify( TIMEOUT, 'Could not find Music Lens. Did you install it?' ) {
232+ button = @app.Dash().LensBar().LensButton( :name => 'Music' )
233+ }
234+
235+ button.tap
236+
237+ verify( TIMEOUT, 'Could not find filterResults button' ) {
238+ button = @app.Dash().FilterPane().AbstractButton( :name => 'filterResults' )
239+ }
240+
241+ button.tap
242+
243+ loader = ""
244+ verify( TIMEOUT, 'Could not find FilterCheckOptionCompact Loader' ) {
245+ loader = @app.Dash().FilterPane().FilterLoader(:name => 'filter-checkoption-compact').QDeclarativeLoader( :name => 'filter-checkoption-compact' )
246+ }
247+
248+ verify_equal(3, TIMEOUT, 'FilterCheckOptionCompact don\'t have three columns' ) {
249+ loader.GridViewWithSpacing()['columns'].to_i
250+ }
251+ end
252+end

Subscribers

People subscribed via source and target branches