Merge lp:~saviq/unity8/fix-horizontal-list-activation into lp:unity8

Proposed by Michał Sawicz
Status: Merged
Approved by: Michael Terry
Approved revision: 1162
Merged at revision: 1172
Proposed branch: lp:~saviq/unity8/fix-horizontal-list-activation
Merge into: lp:unity8
Diff against target: 128 lines (+53/-19)
3 files modified
qml/Dash/CardHorizontalList.qml (+2/-2)
tests/mocks/Unity/fake_categories.cpp (+3/-0)
tests/qmltests/Dash/tst_GenericScopeView.qml (+48/-17)
To merge this branch: bzr merge lp:~saviq/unity8/fix-horizontal-list-activation
Reviewer Review Type Date Requested Status
Michael Terry Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+230985@code.launchpad.net

Commit message

Fix horizontal list activation and add test for it.

Description of the change

 * Are there any related MPs required for this MP to build/function as expected? Please list.
N
 * Did you perform an exploratory manual test run of your code change and any related functionality?
N
 * Did you make sure that your branch does not contain spurious tags?
N
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote :

Looks good!

review: Approve
Revision history for this message
Michael Terry (mterry) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
 - Yes

 * Did CI run pass? If not, please explain why.
 - No, but for unrelated reasons.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Dash/CardHorizontalList.qml'
2--- qml/Dash/CardHorizontalList.qml 2014-08-13 15:33:44 +0000
3+++ qml/Dash/CardHorizontalList.qml 2014-08-15 14:27:43 +0000
4@@ -54,8 +54,8 @@
5 }
6 Connections {
7 target: loader.item
8- onClicked: root.clicked(index, result)
9- onPressAndHold: root.pressAndHold(index)
10+ onClicked: root.clicked(index, result, loader.item, model)
11+ onPressAndHold: root.pressAndHold(index, model)
12 }
13 }
14 }
15
16=== modified file 'tests/mocks/Unity/fake_categories.cpp'
17--- tests/mocks/Unity/fake_categories.cpp 2014-08-08 11:03:15 +0000
18+++ tests/mocks/Unity/fake_categories.cpp 2014-08-15 14:27:43 +0000
19@@ -149,6 +149,9 @@
20 map["card-size"] = "medium";
21 map["overlay"] = true;
22 }
23+ if (index.row() == 18) {
24+ map["category-layout"] = "horizontal-list";
25+ }
26 if (index.row() == 19) {
27 map["category-layout"] = "grid";
28 map["collapsed-rows"] = 0;
29
30=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
31--- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-08 13:34:00 +0000
32+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-08-15 14:27:43 +0000
33@@ -76,6 +76,20 @@
34 spy.signalName = "";
35 }
36
37+ function scrollToCategory(category) {
38+ var categoryListView = findChild(genericScopeView, "categoryListView");
39+ tryCompareFunction(function() {
40+ if (findChild(genericScopeView, category)) return true;
41+ mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height,
42+ genericScopeView.width/2, genericScopeView.y)
43+ tryCompare(categoryListView, "moving", false);
44+ return findChild(genericScopeView, category) !== null;
45+ }, true);
46+
47+ tryCompareFunction(function() { return findChild(genericScopeView, "delegate0") !== null; }, true);
48+ return findChild(genericScopeView, category);
49+ }
50+
51 function test_isActive() {
52 tryCompare(genericScopeView.scope, "isActive", false)
53 genericScopeView.isCurrent = true
54@@ -222,12 +236,7 @@
55 }
56
57 function test_forced_category_expansion() {
58- tryCompareFunction(function() {
59- mouseFlick(genericScopeView, genericScopeView.width/2, genericScopeView.height,
60- genericScopeView.width/2, genericScopeView.y)
61- return findChild(genericScopeView, "dashCategory19") !== null;
62- }, true);
63- var category = findChild(genericScopeView, "dashCategory19")
64+ var category = scrollToCategory("dashCategory19");
65 compare(category.expandable, false, "Category with collapsed-rows: 0 should not be expandable");
66
67 var grid = findChild(category, "19");
68@@ -285,20 +294,13 @@
69 }
70
71 function test_showPreviewCarousel() {
72- tryCompareFunction(function() {
73- var dashCategory1 = findChild(genericScopeView, "dashCategory1");
74- if (dashCategory1 != null) {
75- var tile = findChild(dashCategory1, "carouselDelegate1");
76- return tile != null;
77- }
78- return false;
79- },
80- true);
81+ var category = scrollToCategory("dashCategory1");
82
83 tryCompare(testCase.previewListView, "open", false);
84
85- var dashCategory1 = findChild(genericScopeView, "dashCategory1");
86- var tile = findChild(dashCategory1, "carouselDelegate1");
87+ var tile = findChild(category, "carouselDelegate1");
88+ verify(tile, "Could not find delegate");
89+
90 mouseClick(tile, tile.width / 2, tile.height / 2);
91 tryCompare(tile, "explicitlyScaled", true);
92 mouseClick(tile, tile.width / 2, tile.height / 2);
93@@ -306,6 +308,35 @@
94 tryCompare(testCase.previewListView, "x", 0);
95
96 closePreview();
97+
98+ mousePress(tile, tile.width / 2, tile.height / 2);
99+ tryCompare(testCase.previewListView, "open", true);
100+ tryCompare(testCase.previewListView, "x", 0);
101+ mouseRelease(tile, tile.width / 2, tile.height / 2);
102+
103+ closePreview();
104+ }
105+
106+ function test_showPreviewHorizontalList() {
107+ var category = scrollToCategory("dashCategory18");
108+
109+ tryCompare(testCase.previewListView, "open", false);
110+
111+ var tile = findChild(category, "delegate1");
112+ verify(tile, "Could not find delegate");
113+
114+ mouseClick(tile, tile.width / 2, tile.height / 2);
115+ tryCompare(testCase.previewListView, "open", true);
116+ tryCompare(testCase.previewListView, "x", 0);
117+
118+ closePreview();
119+
120+ mousePress(tile, tile.width / 2, tile.height / 2);
121+ tryCompare(testCase.previewListView, "open", true);
122+ tryCompare(testCase.previewListView, "x", 0);
123+ mouseRelease(tile, tile.width / 2, tile.height / 2);
124+
125+ closePreview();
126 }
127
128 function test_previewCycle() {

Subscribers

People subscribed via source and target branches