Merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/autopilot-nolivedragging into lp:ubuntu-ui-toolkit/staging

Proposed by Leo Arias on 2015-03-18
Status: Merged
Approved by: Zsombor Egri on 2015-03-19
Approved revision: 1454
Merged at revision: 1454
Proposed branch: lp:~canonical-platform-qa/ubuntu-ui-toolkit/autopilot-nolivedragging
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~canonical/ubuntu-ui-toolkit/autopilot-listview
Diff against target: 135 lines (+84/-6)
2 files modified
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListViewWithoutLiveDraggingTestCase.qml (+65/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.py (+19/-6)
To merge this branch: bzr merge lp:~canonical-platform-qa/ubuntu-ui-toolkit/autopilot-nolivedragging
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2015-03-19
Zsombor Egri (community) 2015-03-18 Approve on 2015-03-19
Brendan Donegan (community) Approve on 2015-03-18
Review via email: mp+253398@code.launchpad.net

Commit Message

Added a scenario for autopilot tests without live dragging.

To post a comment you must log in.
Brendan Donegan (brendan-donegan) wrote :

Looks good from a code point of view. I'll leave sorting out the tests to someone else.

review: Approve
Zsombor Egri (zsombi) wrote :

Looks good, thanks! CPO now fully covers the ListItem functionality. Thx again!!!

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListViewDraggingTestCase.qml' => 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListViewWithLiveDraggingTestCase.qml'
2=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListViewWithoutLiveDraggingTestCase.qml'
3--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListViewWithoutLiveDraggingTestCase.qml 1970-01-01 00:00:00 +0000
4+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListViewWithoutLiveDraggingTestCase.qml 2015-03-18 17:14:29 +0000
5@@ -0,0 +1,65 @@
6+/*
7+ * Copyright 2015 Canonical Ltd.
8+ *
9+ * This program is free software; you can redistribute it and/or modify
10+ * it under the terms of the GNU Lesser General Public License as published by
11+ * the Free Software Foundation; version 3.
12+ *
13+ * This program is distributed in the hope that it will be useful,
14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+ * GNU Lesser General Public License for more details.
17+ *
18+ * You should have received a copy of the GNU Lesser General Public License
19+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20+ */
21+
22+import QtQuick 2.0
23+import Ubuntu.Components 1.2
24+
25+MainView {
26+ width: units.gu(48)
27+ height: units.gu(60)
28+ objectName: "mainView"
29+
30+ Page {
31+ id: testPage
32+ objectName: "test_page"
33+ title: listView.ViewItems.dragMode ? "In drag mode" : "Test app"
34+ ListView {
35+ id: listView
36+ objectName: "test_view"
37+ ViewItems.objectName: "test_attached"
38+ ViewItems.onDragUpdated: {
39+ if (event.status == ListItemDrag.Moving) {
40+ // disable live move.
41+ event.accept = false;
42+ } else if (event.status == ListItemDrag.Dropped) {
43+ model.move(event.from, event.to, 1)
44+ }
45+ }
46+
47+ anchors.fill: parent
48+ model: ListModel {
49+ Component.onCompleted: {
50+ for (var i = 0; i < 25; i++) {
51+ append({data: i});
52+ }
53+ }
54+ }
55+ moveDisplaced: Transition {
56+ UbuntuNumberAnimation {
57+ properties: "y";
58+ }
59+ }
60+ delegate: ListItem {
61+ objectName: "listitem" + index
62+ ListView.objectName: "bumm"
63+ onPressAndHold: ListView.view.ViewItems.dragMode = !ListView.view.ViewItems.dragMode
64+ Label {
65+ text: "List item #" + modelData
66+ }
67+ }
68+ }
69+ }
70+}
71
72=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.py'
73--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.py 2015-03-18 17:14:29 +0000
74+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_qquicklistview.py 2015-03-18 17:14:29 +0000
75@@ -21,6 +21,7 @@
76
77 import os
78
79+import testscenarios
80 from autopilot import platform
81 from autopilot.introspection import dbus
82
83@@ -231,12 +232,12 @@
84
85 class QQuickListViewDraggingBaseTestCase(tests.QMLFileAppTestCase):
86
87- path = os.path.abspath(__file__)
88- dir_path = os.path.dirname(path)
89- test_qml_file_path = os.path.join(
90- dir_path, 'test_listitem.ListViewDraggingTestCase.qml')
91-
92 def setUp(self):
93+ path = os.path.abspath(__file__)
94+ dir_path = os.path.dirname(path)
95+ self.test_qml_file_path = os.path.join(
96+ dir_path, self.qml_file_name)
97+
98 super(QQuickListViewDraggingBaseTestCase, self).setUp()
99 self.list_view = self.main_view.select_single(
100 ubuntuuitoolkit.QQuickListView, objectName='test_view')
101@@ -244,6 +245,8 @@
102
103 class QQuickListViewDraggingTestCase(QQuickListViewDraggingBaseTestCase):
104
105+ qml_file_name = 'test_listitem.ListViewWithLiveDraggingTestCase.qml'
106+
107 def test_long_press_must_enable_drag_mode(self):
108 list_item = self.list_view.select_single(
109 'UCListItem', objectName='listitem0')
110@@ -254,7 +257,15 @@
111
112 class QQuickListViewReorderingTestCase(QQuickListViewDraggingBaseTestCase):
113
114- scenarios = [
115+ dragging_scenarios = [
116+ ('with live dragging', {
117+ 'qml_file_name': (
118+ 'test_listitem.ListViewWithLiveDraggingTestCase.qml')}),
119+ ('without live dragging', {
120+ 'qml_file_name': (
121+ 'test_listitem.ListViewWithoutLiveDraggingTestCase.qml')}),
122+ ]
123+ reorder_scenarios = [
124 ('both items visible, to bottom', {'from_index': 0, 'to_index': 1}),
125 ('both items visible, to top', {'from_index': 1, 'to_index': 0}),
126 ('both items visible, to bottom, first non visible', {
127@@ -264,6 +275,8 @@
128 'from_index': 0, 'to_index': 15}),
129 ('to item not visible, to bottom', {'from_index': 0, 'to_index': 24})
130 ]
131+ scenarios = testscenarios.multiply_scenarios(
132+ dragging_scenarios, reorder_scenarios)
133
134 def _find_item(self, index):
135 object_name = 'listitem{}'.format(index)

Subscribers

People subscribed via source and target branches