Merge lp:~aacid/unity8/testFor1316660 into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 1597
Merged at revision: 1616
Proposed branch: lp:~aacid/unity8/testFor1316660
Merge into: lp:unity8
Diff against target: 94 lines (+43/-1)
4 files modified
qml/Dash/Previews/Preview.qml (+1/-0)
tests/mocks/Unity/fake_previewwidgetmodel.cpp (+10/-0)
tests/qmltests/Dash/Previews/tst_Preview.qml (+31/-0)
tests/qmltests/Dash/tst_GenericScopeView.qml (+1/-1)
To merge this branch: bzr merge lp:~aacid/unity8/testFor1316660
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+249210@code.launchpad.net

Commit message

Test for bug #1316660

preview combo should autoscroll to make sure its child buttons are on screen

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
No, it's test only

 * Did you make sure that your branch does not contain spurious tags?
Yes

 * 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)
lp:~aacid/unity8/testFor1316660 updated
1597. By Albert Astals Cid

Verify to tryCompare

Doesn't really belong to this MR but i had it failing in CI so let's make it more resilient here

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) 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.
It did!
 * Did you make sure that the branch does not contain spurious tags?
yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Dash/Previews/Preview.qml'
2--- qml/Dash/Previews/Preview.qml 2014-10-23 11:59:22 +0000
3+++ qml/Dash/Previews/Preview.qml 2015-02-11 08:35:33 +0000
4@@ -65,6 +65,7 @@
5
6 delegate: ListView {
7 id: column
8+ objectName: "previewListRow" + index
9 anchors { top: parent.top; bottom: parent.bottom }
10 width: row.columnWidth
11 spacing: row.spacing
12
13=== modified file 'tests/mocks/Unity/fake_previewwidgetmodel.cpp'
14--- tests/mocks/Unity/fake_previewwidgetmodel.cpp 2014-05-14 08:36:42 +0000
15+++ tests/mocks/Unity/fake_previewwidgetmodel.cpp 2015-02-11 08:35:33 +0000
16@@ -53,6 +53,16 @@
17 PreviewData* preview_data = new PreviewData(QString("widget-%1").arg(i), QString("text"), attributes);
18 m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data));
19 }
20+
21+ QVariantMap attributes;
22+ QVariantMap buttonData;
23+ buttonData["label"] = "Button";
24+ QVariantList buttons;
25+ buttons << buttonData << buttonData << buttonData;
26+ attributes["actions"] = QVariant::fromValue(buttons);
27+ PreviewData* preview_data = new PreviewData(QString("widget-21"), QString("actions"), attributes);
28+ m_previewWidgets.append(QSharedPointer<PreviewData>(preview_data));
29+
30 endResetModel();
31
32 }
33
34=== modified file 'tests/qmltests/Dash/Previews/tst_Preview.qml'
35--- tests/qmltests/Dash/Previews/tst_Preview.qml 2014-07-04 16:20:48 +0000
36+++ tests/qmltests/Dash/Previews/tst_Preview.qml 2015-02-11 08:35:33 +0000
37@@ -54,6 +54,11 @@
38 name: "Preview"
39 when: windowShown
40
41+ function init() {
42+ var widget = findChild(preview, "previewListRow0");
43+ widget.positionViewAtBeginning();
44+ }
45+
46 function test_triggered() {
47 waitForRendering(preview);
48 var widget = findChild(preview, "widget-3");
49@@ -102,5 +107,31 @@
50 return bottomLeft.y <= preview.height
51 }, true);
52 }
53+
54+ function test_comboEnsureVisible() {
55+ waitForRendering(preview);
56+
57+ // Scroll down
58+ var previewListRow0 = findChild(preview, "previewListRow0");
59+ touchFlick(preview, preview.width / 2, units.gu(20), preview.width / 2, units.gu(1));
60+ tryCompare(previewListRow0, "atYEnd", true);
61+ tryCompare(previewListRow0, "moving", false);
62+
63+ // Click on the combo
64+ var widget = findChild(preview, "widget-21");
65+ var initialWidgetHeight = widget.height;
66+ var moreLessButton = findChild(widget, "moreLessButton");
67+ mouseClick(moreLessButton);
68+
69+ // Make sure the combo is growing
70+ tryCompareFunction(function () { return widget.height > 2 * initialWidgetHeight; }, true);
71+
72+ // Wait for the combo to stop growing
73+ tryCompareFunction(function () { var currentWidgetHeight = widget.height; wait(200); return currentWidgetHeight === widget.height;}, true);
74+
75+ // Make sure the combo bottom is on the viewport
76+ var bottomLeft = preview.mapFromItem(widget, 0, widget.height);
77+ verify(bottomLeft.y <= preview.height);
78+ }
79 }
80 }
81
82=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
83--- tests/qmltests/Dash/tst_GenericScopeView.qml 2015-01-09 09:15:45 +0000
84+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2015-02-11 08:35:33 +0000
85@@ -380,8 +380,8 @@
86
87 tryCompare(testCase.subPageLoader, "open", false);
88
89+ tryCompareFunction(function() { return findChild(category, "delegate1") != null; }, true);
90 var tile = findChild(category, "delegate1");
91- verify(tile, "Could not find delegate");
92
93 mouseClick(tile);
94 tryCompare(testCase.subPageLoader, "open", true);

Subscribers

People subscribed via source and target branches