Merge lp:~tpeeters/ubuntu-ui-toolkit/revert-ap16 into lp:ubuntu-ui-toolkit
- revert-ap16
- Merge into trunk
Proposed by
Tim Peeters
Status: | Superseded |
---|---|
Proposed branch: | lp:~tpeeters/ubuntu-ui-toolkit/revert-ap16 |
Merge into: | lp:ubuntu-ui-toolkit |
Diff against target: |
2312 lines (+1002/-346) 47 files modified
.bzrignore (+1/-1) components.api (+6/-0) debian/control (+13/-1) debian/ubuntu-ui-toolkit-autopilot.install (+0/-1) debian/ubuntu-ui-toolkit-tools.install (+1/-0) examples/ubuntu-ui-toolkit-gallery/gallery (+1/-1) examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.desktop (+1/-1) src/Ubuntu/Components/1.0/Icon.qml (+4/-4) src/Ubuntu/Components/1.2/TextInputPopover.qml (+0/-7) src/Ubuntu/Components/1.3/PageWrapperUtils.js (+9/-2) src/Ubuntu/Components/1.3/TextInputPopover.qml (+0/-6) src/Ubuntu/Components/Popups/1.2/ActionSelectionPopover.qml (+3/-1) src/Ubuntu/Components/Popups/1.2/PopupBase.qml (+1/-0) src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml (+3/-1) src/Ubuntu/Components/Popups/1.3/PopupBase.qml (+1/-0) src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml (+1/-1) src/Ubuntu/Components/plugin/plugin.cpp (+2/-0) src/Ubuntu/Components/plugin/privates/listitemdragarea.cpp (+3/-2) src/Ubuntu/Components/plugin/sortfiltermodel.cpp (+5/-2) src/Ubuntu/Components/plugin/ucactionitem.cpp (+61/-36) src/Ubuntu/Components/plugin/ucactionitem.h (+13/-4) src/Ubuntu/Components/plugin/uclistitem.cpp (+88/-49) src/Ubuntu/Components/plugin/uclistitem.h (+0/-1) src/Ubuntu/Components/plugin/uclistitem_p.h (+3/-7) src/Ubuntu/Components/plugin/ucviewitemsattached.cpp (+0/-64) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+5/-0) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py (+27/-6) tests/autopilot/ubuntuuitoolkit/base.py (+2/-3) tests/autopilot/ubuntuuitoolkit/tests/__init__.py (+1/-2) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py (+56/-2) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml (+9/-10) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py (+4/-2) tests/resources/listitems/ListItemTest.qml (+7/-2) tests/resources/navigation/Blackbox.qml (+48/-0) tests/tests.pro (+0/-2) tests/uitk_test_plan.sh (+19/-8) tests/unit_x11/tst_components/ListItemTestCase.qml (+4/-0) tests/unit_x11/tst_components/ListItemTestCase13.qml (+14/-0) tests/unit_x11/tst_components/tst_actionitem.qml (+178/-82) tests/unit_x11/tst_components/tst_icon.qml (+35/-0) tests/unit_x11/tst_components/tst_listitem.qml (+14/-14) tests/unit_x11/tst_components/tst_listitem13.qml (+13/-14) tests/unit_x11/tst_components/tst_listitem_extras.qml (+136/-4) tests/unit_x11/tst_components/tst_popover.qml (+33/-0) tests/unit_x11/tst_components/tst_popover13.qml (+174/-0) ubuntu-sdk.pro (+1/-1) ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher.pro (+2/-2) |
To merge this branch: | bzr merge lp:~tpeeters/ubuntu-ui-toolkit/revert-ap16 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu SDK team | Pending | ||
Review via email: mp+272002@code.launchpad.net |
Commit message
Undo the MR to support AP1.6.
Description of the change
Undo the MR to support AP1.6 because AP1.6 is not ready yet.
To post a comment you must log in.
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2015-08-18 21:07:56 +0000 | |||
3 | +++ .bzrignore 2015-09-22 15:57:54 +0000 | |||
4 | @@ -21,5 +21,5 @@ | |||
5 | 21 | tests/unit/tst_i18n/*/share/locale/en/LC_MESSAGES/*.mo | 21 | tests/unit/tst_i18n/*/share/locale/en/LC_MESSAGES/*.mo |
6 | 22 | tests/unit/tst_units/dpr*/dpr* | 22 | tests/unit/tst_units/dpr*/dpr* |
7 | 23 | tests/apicheck/apicheck | 23 | tests/apicheck/apicheck |
9 | 24 | tests/launcher/launcher | 24 | ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher |
10 | 25 | build_paths.inc | 25 | build_paths.inc |
11 | 26 | 26 | ||
12 | === modified file 'components.api' | |||
13 | --- components.api 2015-09-04 12:35:16 +0000 | |||
14 | +++ components.api 2015-09-22 15:57:54 +0000 | |||
15 | @@ -1244,6 +1244,12 @@ | |||
16 | 1244 | property bool locked | 1244 | property bool locked |
17 | 1245 | property bool opened | 1245 | property bool opened |
18 | 1246 | property Item pageStack | 1246 | property Item pageStack |
19 | 1247 | Ubuntu.Components.UCApplication 1.0 0.1: QtObject | ||
20 | 1248 | property string applicationName | ||
21 | 1249 | property QtObject inputMethod | ||
22 | 1250 | Ubuntu.Components.UCFontUtils 1.0 0.1: QtObject | ||
23 | 1251 | function double sizeToPixels(string size) | ||
24 | 1252 | function double modularScale(string size) | ||
25 | 1247 | UCListItemDivider: Item | 1253 | UCListItemDivider: Item |
26 | 1248 | property color colorFrom | 1254 | property color colorFrom |
27 | 1249 | property color colorTo | 1255 | property color colorTo |
28 | 1250 | 1256 | ||
29 | === modified file 'debian/control' | |||
30 | --- debian/control 2015-08-20 08:10:44 +0000 | |||
31 | +++ debian/control 2015-09-22 15:57:54 +0000 | |||
32 | @@ -120,7 +120,7 @@ | |||
33 | 120 | Package: ubuntu-ui-toolkit-examples | 120 | Package: ubuntu-ui-toolkit-examples |
34 | 121 | Section: devel | 121 | Section: devel |
35 | 122 | Architecture: any | 122 | Architecture: any |
37 | 123 | Depends: qmlscene, | 123 | Depends: ubuntu-ui-toolkit-tools (>= ${source:Version}), |
38 | 124 | qtdeclarative5-ubuntu-ui-toolkit-plugin (= ${binary:Version}) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles, | 124 | qtdeclarative5-ubuntu-ui-toolkit-plugin (= ${binary:Version}) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles, |
39 | 125 | ubuntu-ui-toolkit-theme (= ${binary:Version}), | 125 | ubuntu-ui-toolkit-theme (= ${binary:Version}), |
40 | 126 | qml-module-qtquick-xmllistmodel | qtdeclarative5-xmllistmodel-plugin, | 126 | qml-module-qtquick-xmllistmodel | qtdeclarative5-xmllistmodel-plugin, |
41 | @@ -160,3 +160,15 @@ | |||
42 | 160 | qml-module-qttest | qtdeclarative5-test-plugin, | 160 | qml-module-qttest | qtdeclarative5-test-plugin, |
43 | 161 | Description: Test package for Ubuntu UI Toolkit | 161 | Description: Test package for Ubuntu UI Toolkit |
44 | 162 | Autopilot tests for the ubuntu-ui-toolkit package | 162 | Autopilot tests for the ubuntu-ui-toolkit package |
45 | 163 | |||
46 | 164 | Package: ubuntu-ui-toolkit-tools | ||
47 | 165 | Architecture: any | ||
48 | 166 | Depends: ${misc:Depends}, | ||
49 | 167 | ${shlibs:Depends} | ||
50 | 168 | Description: Qt Components for Ubuntu - productive tools | ||
51 | 169 | Qt Components for Ubuntu offers a set of reusable user interface | ||
52 | 170 | components for Qt Quick 2 / QML. | ||
53 | 171 | . | ||
54 | 172 | This package contains the application launcher, which is a drop-in | ||
55 | 173 | replacement for qmlscene, oxideqmlscene, qml and derivatives. | ||
56 | 174 | |||
57 | 163 | 175 | ||
58 | === modified file 'debian/ubuntu-ui-toolkit-autopilot.install' | |||
59 | --- debian/ubuntu-ui-toolkit-autopilot.install 2015-04-29 13:02:11 +0000 | |||
60 | +++ debian/ubuntu-ui-toolkit-autopilot.install 2015-09-22 15:57:54 +0000 | |||
61 | @@ -1,3 +1,2 @@ | |||
62 | 1 | usr/lib/python3 | 1 | usr/lib/python3 |
63 | 2 | usr/lib/*/ubuntu-ui-toolkit/apicheck | 2 | usr/lib/*/ubuntu-ui-toolkit/apicheck |
64 | 3 | usr/lib/*/ubuntu-ui-toolkit/launcher | ||
65 | 4 | 3 | ||
66 | === added file 'debian/ubuntu-ui-toolkit-tools.install' | |||
67 | --- debian/ubuntu-ui-toolkit-tools.install 1970-01-01 00:00:00 +0000 | |||
68 | +++ debian/ubuntu-ui-toolkit-tools.install 2015-09-22 15:57:54 +0000 | |||
69 | @@ -0,0 +1,1 @@ | |||
70 | 1 | usr/bin/ubuntu-ui-toolkit-launcher | ||
71 | 0 | 2 | ||
72 | === modified file 'examples/ubuntu-ui-toolkit-gallery/gallery' | |||
73 | --- examples/ubuntu-ui-toolkit-gallery/gallery 2015-08-11 15:42:46 +0000 | |||
74 | +++ examples/ubuntu-ui-toolkit-gallery/gallery 2015-09-22 15:57:54 +0000 | |||
75 | @@ -3,4 +3,4 @@ | |||
76 | 3 | . `dirname $0`/../../build_paths.inc | 3 | . `dirname $0`/../../build_paths.inc |
77 | 4 | 4 | ||
78 | 5 | SCRIPT_DIRECTORY=`dirname $0` | 5 | SCRIPT_DIRECTORY=`dirname $0` |
80 | 6 | $BUILD_DIR/tests/launcher/launcher $@ $SCRIPT_DIRECTORY/ubuntu-ui-toolkit-gallery.qml | 6 | $BUILD_DIR/ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher $@ $SCRIPT_DIRECTORY/ubuntu-ui-toolkit-gallery.qml |
81 | 7 | 7 | ||
82 | === modified file 'examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.desktop' | |||
83 | --- examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.desktop 2014-11-17 11:52:44 +0000 | |||
84 | +++ examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.desktop 2015-09-22 15:57:54 +0000 | |||
85 | @@ -1,6 +1,6 @@ | |||
86 | 1 | [Desktop Entry] | 1 | [Desktop Entry] |
87 | 2 | Name=Ubuntu UI Toolkit Gallery | 2 | Name=Ubuntu UI Toolkit Gallery |
89 | 3 | Exec=/usr/bin/qmlscene $@ /usr/lib/ubuntu-ui-toolkit/examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml | 3 | Exec=/usr/bin/ubuntu-ui-toolkit-launcher $@ /usr/lib/ubuntu-ui-toolkit/examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml |
90 | 4 | Terminal=false | 4 | Terminal=false |
91 | 5 | Type=Application | 5 | Type=Application |
92 | 6 | X-Ubuntu-Touch=true | 6 | X-Ubuntu-Touch=true |
93 | 7 | 7 | ||
94 | === modified file 'src/Ubuntu/Components/1.0/Icon.qml' | |||
95 | --- src/Ubuntu/Components/1.0/Icon.qml 2015-07-24 09:53:20 +0000 | |||
96 | +++ src/Ubuntu/Components/1.0/Icon.qml 2015-09-22 15:57:54 +0000 | |||
97 | @@ -55,19 +55,19 @@ | |||
98 | 55 | } | 55 | } |
99 | 56 | 56 | ||
100 | 57 | cache: true | 57 | cache: true |
102 | 58 | visible: !colorizedImage.active | 58 | visible: !colorizedImage.visible |
103 | 59 | } | 59 | } |
104 | 60 | 60 | ||
105 | 61 | ShaderEffect { | 61 | ShaderEffect { |
106 | 62 | id: colorizedImage | 62 | id: colorizedImage |
107 | 63 | objectName: "shader" | ||
108 | 63 | 64 | ||
109 | 64 | anchors.fill: parent | 65 | anchors.fill: parent |
110 | 65 | visible: active | ||
111 | 66 | 66 | ||
112 | 67 | // Whether or not a color has been set. | 67 | // Whether or not a color has been set. |
114 | 68 | property bool active: keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0) | 68 | visible: image.status == Image.Ready && keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0) |
115 | 69 | 69 | ||
117 | 70 | property Image source: active && image.status == Image.Ready ? image : null | 70 | property Image source: image |
118 | 71 | property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0) | 71 | property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0) |
119 | 72 | property color keyColorIn: "#808080" | 72 | property color keyColorIn: "#808080" |
120 | 73 | property real threshold: 0.1 | 73 | property real threshold: 0.1 |
121 | 74 | 74 | ||
122 | === modified file 'src/Ubuntu/Components/1.2/TextInputPopover.qml' | |||
123 | --- src/Ubuntu/Components/1.2/TextInputPopover.qml 2015-08-19 06:55:11 +0000 | |||
124 | +++ src/Ubuntu/Components/1.2/TextInputPopover.qml 2015-09-22 15:57:54 +0000 | |||
125 | @@ -83,13 +83,6 @@ | |||
126 | 83 | model: actions.length | 83 | model: actions.length |
127 | 84 | AbstractButton { | 84 | AbstractButton { |
128 | 85 | id: button | 85 | id: button |
129 | 86 | /* | ||
130 | 87 | Workaround for autopilot used in the text input's context menu to access | ||
131 | 88 | action.text so we can get the proper button by text, action being not | ||
132 | 89 | accessible. https://bugs.launchpad.net/autopilot/+bug/1334599 | ||
133 | 90 | */ | ||
134 | 91 | // FIXME: AbstractButton has text property, which is getting the action.text, so no need to override! | ||
135 | 92 | property string text: action.text | ||
136 | 93 | width: Math.max(units.gu(5), implicitWidth) + units.gu(2) | 86 | width: Math.max(units.gu(5), implicitWidth) + units.gu(2) |
137 | 94 | height: units.gu(6) | 87 | height: units.gu(6) |
138 | 95 | action: actions[modelData] | 88 | action: actions[modelData] |
139 | 96 | 89 | ||
140 | === modified file 'src/Ubuntu/Components/1.3/PageWrapperUtils.js' | |||
141 | --- src/Ubuntu/Components/1.3/PageWrapperUtils.js 2015-09-01 11:59:13 +0000 | |||
142 | +++ src/Ubuntu/Components/1.3/PageWrapperUtils.js 2015-09-22 15:57:54 +0000 | |||
143 | @@ -73,6 +73,7 @@ | |||
144 | 73 | if (incubator.status != Component.Ready) { | 73 | if (incubator.status != Component.Ready) { |
145 | 74 | incubator.onStatusChanged = incubatorStatusChanged; | 74 | incubator.onStatusChanged = incubatorStatusChanged; |
146 | 75 | } else { | 75 | } else { |
147 | 76 | pageWrapper.incubator = this; | ||
148 | 76 | incubatorStatusChanged(incubator.status); | 77 | incubatorStatusChanged(incubator.status); |
149 | 77 | } | 78 | } |
150 | 78 | } | 79 | } |
151 | @@ -103,9 +104,15 @@ | |||
152 | 103 | throw new Error("Error while loading page: " + pageComponent.errorString()); | 104 | throw new Error("Error while loading page: " + pageComponent.errorString()); |
153 | 104 | } else { | 105 | } else { |
154 | 105 | // create the object | 106 | // create the object |
155 | 106 | pageWrapper.incubator = new Incubator(pageWrapper, pageComponent); | ||
156 | 107 | if (synchronous) { | 107 | if (synchronous) { |
158 | 108 | pageWrapper.incubator.forceCompletion(); | 108 | if (pageWrapper.properties) { |
159 | 109 | // initialize the object with the given properties | ||
160 | 110 | pageWrapper.object = pageComponent.createObject(pageWrapper, pageWrapper.properties); | ||
161 | 111 | } else { | ||
162 | 112 | pageWrapper.object = pageComponent.createObject(pageWrapper); | ||
163 | 113 | } | ||
164 | 114 | } else { | ||
165 | 115 | pageWrapper.incubator = new Incubator(pageWrapper, pageComponent); | ||
166 | 109 | } | 116 | } |
167 | 110 | pageWrapper.canDestroy = true; | 117 | pageWrapper.canDestroy = true; |
168 | 111 | } | 118 | } |
169 | 112 | 119 | ||
170 | === modified file 'src/Ubuntu/Components/1.3/TextInputPopover.qml' | |||
171 | --- src/Ubuntu/Components/1.3/TextInputPopover.qml 2015-07-02 23:33:22 +0000 | |||
172 | +++ src/Ubuntu/Components/1.3/TextInputPopover.qml 2015-09-22 15:57:54 +0000 | |||
173 | @@ -83,12 +83,6 @@ | |||
174 | 83 | model: actions.length | 83 | model: actions.length |
175 | 84 | AbstractButton { | 84 | AbstractButton { |
176 | 85 | id: button | 85 | id: button |
177 | 86 | /* | ||
178 | 87 | Workaround for autopilot used in the text input's context menu to access | ||
179 | 88 | action.text so we can get the proper button by text, action being not | ||
180 | 89 | accessible. https://bugs.launchpad.net/autopilot/+bug/1334599 | ||
181 | 90 | */ | ||
182 | 91 | property string text: action.text | ||
183 | 92 | width: Math.max(units.gu(5), implicitWidth) + units.gu(2) | 86 | width: Math.max(units.gu(5), implicitWidth) + units.gu(2) |
184 | 93 | height: units.gu(6) | 87 | height: units.gu(6) |
185 | 94 | action: actions[modelData] | 88 | action: actions[modelData] |
186 | 95 | 89 | ||
187 | === modified file 'src/Ubuntu/Components/Popups/1.2/ActionSelectionPopover.qml' | |||
188 | --- src/Ubuntu/Components/Popups/1.2/ActionSelectionPopover.qml 2015-04-30 08:32:44 +0000 | |||
189 | +++ src/Ubuntu/Components/Popups/1.2/ActionSelectionPopover.qml 2015-09-22 15:57:54 +0000 | |||
190 | @@ -147,8 +147,10 @@ | |||
191 | 147 | onStatusChanged: { | 147 | onStatusChanged: { |
192 | 148 | if (item && status == Loader.Ready) { | 148 | if (item && status == Loader.Ready) { |
193 | 149 | // set model data | 149 | // set model data |
195 | 150 | if (item.hasOwnProperty("action")) | 150 | if (item.hasOwnProperty("action")) { |
196 | 151 | item.action = modelData; | 151 | item.action = modelData; |
197 | 152 | item.objectName = item.action.objectName + '_button'; | ||
198 | 153 | } | ||
199 | 152 | if (item.hasOwnProperty("refModelData")) | 154 | if (item.hasOwnProperty("refModelData")) |
200 | 153 | item.refModelData = modelData; | 155 | item.refModelData = modelData; |
201 | 154 | if (item.hasOwnProperty("modelData")) | 156 | if (item.hasOwnProperty("modelData")) |
202 | 155 | 157 | ||
203 | === modified file 'src/Ubuntu/Components/Popups/1.2/PopupBase.qml' | |||
204 | --- src/Ubuntu/Components/Popups/1.2/PopupBase.qml 2015-04-30 08:32:44 +0000 | |||
205 | +++ src/Ubuntu/Components/Popups/1.2/PopupBase.qml 2015-09-22 15:57:54 +0000 | |||
206 | @@ -161,6 +161,7 @@ | |||
207 | 161 | } | 161 | } |
208 | 162 | 162 | ||
209 | 163 | MouseArea { | 163 | MouseArea { |
210 | 164 | acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton | ||
211 | 164 | anchors.fill: __foreground | 165 | anchors.fill: __foreground |
212 | 165 | onWheel: wheel.accepted = true | 166 | onWheel: wheel.accepted = true |
213 | 166 | } | 167 | } |
214 | 167 | 168 | ||
215 | === modified file 'src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml' | |||
216 | --- src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml 2015-05-14 21:32:51 +0000 | |||
217 | +++ src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml 2015-09-22 15:57:54 +0000 | |||
218 | @@ -147,8 +147,10 @@ | |||
219 | 147 | onStatusChanged: { | 147 | onStatusChanged: { |
220 | 148 | if (item && status == Loader.Ready) { | 148 | if (item && status == Loader.Ready) { |
221 | 149 | // set model data | 149 | // set model data |
223 | 150 | if (item.hasOwnProperty("action")) | 150 | if (item.hasOwnProperty("action")) { |
224 | 151 | item.action = modelData; | 151 | item.action = modelData; |
225 | 152 | item.objectName = item.action.objectName + '_button'; | ||
226 | 153 | } | ||
227 | 152 | if (item.hasOwnProperty("refModelData")) | 154 | if (item.hasOwnProperty("refModelData")) |
228 | 153 | item.refModelData = modelData; | 155 | item.refModelData = modelData; |
229 | 154 | if (item.hasOwnProperty("modelData")) | 156 | if (item.hasOwnProperty("modelData")) |
230 | 155 | 157 | ||
231 | === modified file 'src/Ubuntu/Components/Popups/1.3/PopupBase.qml' | |||
232 | --- src/Ubuntu/Components/Popups/1.3/PopupBase.qml 2015-04-29 08:55:31 +0000 | |||
233 | +++ src/Ubuntu/Components/Popups/1.3/PopupBase.qml 2015-09-22 15:57:54 +0000 | |||
234 | @@ -161,6 +161,7 @@ | |||
235 | 161 | } | 161 | } |
236 | 162 | 162 | ||
237 | 163 | MouseArea { | 163 | MouseArea { |
238 | 164 | acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton | ||
239 | 164 | anchors.fill: __foreground | 165 | anchors.fill: __foreground |
240 | 165 | onWheel: wheel.accepted = true | 166 | onWheel: wheel.accepted = true |
241 | 166 | } | 167 | } |
242 | 167 | 168 | ||
243 | === modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml' | |||
244 | --- src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml 2015-09-04 09:32:31 +0000 | |||
245 | +++ src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml 2015-09-22 15:57:54 +0000 | |||
246 | @@ -70,7 +70,7 @@ | |||
247 | 70 | } | 70 | } |
248 | 71 | 71 | ||
249 | 72 | readonly property real maxItemWidth: parent.width / itemActions.actions.length | 72 | readonly property real maxItemWidth: parent.width / itemActions.actions.length |
251 | 73 | readonly property real minItemWidth: units.gu(5) // 2GU icon + 2* 1.5GU margin | 73 | readonly property real minItemWidth: units.gu(6) // 2GU icon + 2* 2GU margin |
252 | 74 | 74 | ||
253 | 75 | Repeater { | 75 | Repeater { |
254 | 76 | model: itemActions.actions | 76 | model: itemActions.actions |
255 | 77 | 77 | ||
256 | === modified file 'src/Ubuntu/Components/plugin/plugin.cpp' | |||
257 | --- src/Ubuntu/Components/plugin/plugin.cpp 2015-08-31 15:43:14 +0000 | |||
258 | +++ src/Ubuntu/Components/plugin/plugin.cpp 2015-09-22 15:57:54 +0000 | |||
259 | @@ -163,7 +163,9 @@ | |||
260 | 163 | { | 163 | { |
261 | 164 | qmlRegisterType<UCAction>(uri, major, minor, "Action"); | 164 | qmlRegisterType<UCAction>(uri, major, minor, "Action"); |
262 | 165 | qmlRegisterType<UCActionContext>(uri, major, minor, "ActionContext"); | 165 | qmlRegisterType<UCActionContext>(uri, major, minor, "ActionContext"); |
263 | 166 | qmlRegisterUncreatableType<UCApplication>(uri, major, minor, "UCApplication", "Not instantiable"); | ||
264 | 166 | qmlRegisterType<UCActionManager>(uri, major, minor, "ActionManager"); | 167 | qmlRegisterType<UCActionManager>(uri, major, minor, "ActionManager"); |
265 | 168 | qmlRegisterUncreatableType<UCFontUtils>(uri, major, minor, "UCFontUtils", "Not instantiable"); | ||
266 | 167 | qmlRegisterType<UCStyledItemBase>(uri, major, minor, "StyledItem"); | 169 | qmlRegisterType<UCStyledItemBase>(uri, major, minor, "StyledItem"); |
267 | 168 | qmlRegisterUncreatableType<UbuntuI18n>(uri, major, minor, "i18n", "Singleton object"); | 170 | qmlRegisterUncreatableType<UbuntuI18n>(uri, major, minor, "i18n", "Singleton object"); |
268 | 169 | qmlRegisterExtendedType<QQuickImageBase, UCQQuickImageExtension>(uri, major, minor, "QQuickImageBase"); | 171 | qmlRegisterExtendedType<QQuickImageBase, UCQQuickImageExtension>(uri, major, minor, "QQuickImageBase"); |
269 | 170 | 172 | ||
270 | === modified file 'src/Ubuntu/Components/plugin/privates/listitemdragarea.cpp' | |||
271 | --- src/Ubuntu/Components/plugin/privates/listitemdragarea.cpp 2015-08-31 15:43:14 +0000 | |||
272 | +++ src/Ubuntu/Components/plugin/privates/listitemdragarea.cpp 2015-09-22 15:57:54 +0000 | |||
273 | @@ -123,7 +123,8 @@ | |||
274 | 123 | "No dragging will be possible."); | 123 | "No dragging will be possible."); |
275 | 124 | } | 124 | } |
276 | 125 | if (start) { | 125 | if (start) { |
278 | 126 | pViewAttached->buildChangesList(false); | 126 | // keep the mouse event in house |
279 | 127 | setKeepMouseGrab(true); | ||
280 | 127 | fromIndex = toIndex = index; | 128 | fromIndex = toIndex = index; |
281 | 128 | lastPos = pos; | 129 | lastPos = pos; |
282 | 129 | // create temp drag item | 130 | // create temp drag item |
283 | @@ -152,7 +153,7 @@ | |||
284 | 152 | } | 153 | } |
285 | 153 | } | 154 | } |
286 | 154 | // unlock flickables | 155 | // unlock flickables |
288 | 155 | pViewAttached->clearChangesList(); | 156 | setKeepMouseGrab(false); |
289 | 156 | // perform drop | 157 | // perform drop |
290 | 157 | UCListItemPrivate::get(item.data())->dragHandler->drop(); | 158 | UCListItemPrivate::get(item.data())->dragHandler->drop(); |
291 | 158 | item = 0; | 159 | item = 0; |
292 | 159 | 160 | ||
293 | === modified file 'src/Ubuntu/Components/plugin/sortfiltermodel.cpp' | |||
294 | --- src/Ubuntu/Components/plugin/sortfiltermodel.cpp 2015-08-20 17:08:49 +0000 | |||
295 | +++ src/Ubuntu/Components/plugin/sortfiltermodel.cpp 2015-09-22 15:57:54 +0000 | |||
296 | @@ -220,8 +220,11 @@ | |||
297 | 220 | { | 220 | { |
298 | 221 | QVariantMap res; | 221 | QVariantMap res; |
299 | 222 | const QHash<int, QByteArray> roles = roleNames(); | 222 | const QHash<int, QByteArray> roles = roleNames(); |
302 | 223 | for(int role = 0; role < roles.count(); role++) | 223 | QHashIterator<int, QByteArray> i(roles); |
303 | 224 | res.insert (roles[role], data(row, role)); | 224 | while (i.hasNext()) { |
304 | 225 | i.next(); | ||
305 | 226 | res.insert(i.value(), data(row, i.key())); | ||
306 | 227 | } | ||
307 | 225 | return res; | 228 | return res; |
308 | 226 | } | 229 | } |
309 | 227 | 230 | ||
310 | 228 | 231 | ||
311 | === modified file 'src/Ubuntu/Components/plugin/ucactionitem.cpp' | |||
312 | --- src/Ubuntu/Components/plugin/ucactionitem.cpp 2015-08-25 11:31:29 +0000 | |||
313 | +++ src/Ubuntu/Components/plugin/ucactionitem.cpp 2015-09-22 15:57:54 +0000 | |||
314 | @@ -16,6 +16,10 @@ | |||
315 | 16 | 16 | ||
316 | 17 | #include "ucactionitem.h" | 17 | #include "ucactionitem.h" |
317 | 18 | #include "ucaction.h" | 18 | #include "ucaction.h" |
318 | 19 | #include "ucstyleditembase_p.h" | ||
319 | 20 | #define foreach Q_FOREACH | ||
320 | 21 | #include <QtQml/private/qqmlbinding_p.h> | ||
321 | 22 | #undef foreach | ||
322 | 19 | 23 | ||
323 | 20 | /*! | 24 | /*! |
324 | 21 | * \qmltype ActionItem | 25 | * \qmltype ActionItem |
325 | @@ -40,8 +44,14 @@ | |||
326 | 40 | , m_action(Q_NULLPTR) | 44 | , m_action(Q_NULLPTR) |
327 | 41 | , m_flags(0) | 45 | , m_flags(0) |
328 | 42 | { | 46 | { |
331 | 43 | connect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged); | 47 | connect(this, &UCActionItem::enabledChanged, this, &UCActionItem::enabledChanged2); |
332 | 44 | connect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged); | 48 | connect(this, &UCActionItem::visibleChanged, this, &UCActionItem::visibleChanged2); |
333 | 49 | } | ||
334 | 50 | |||
335 | 51 | bool UCActionItem::hasBindingOnProperty(const QString &name) | ||
336 | 52 | { | ||
337 | 53 | QQmlProperty property(this, name, qmlContext(this)); | ||
338 | 54 | return QQmlPropertyPrivate::binding(property) != Q_NULLPTR; | ||
339 | 45 | } | 55 | } |
340 | 46 | 56 | ||
341 | 47 | void UCActionItem::componentComplete() | 57 | void UCActionItem::componentComplete() |
342 | @@ -55,40 +65,47 @@ | |||
343 | 55 | } | 65 | } |
344 | 56 | } | 66 | } |
345 | 57 | 67 | ||
346 | 58 | void UCActionItem::_q_visibleChanged() | ||
347 | 59 | { | ||
348 | 60 | m_flags |= CustomVisible; | ||
349 | 61 | disconnect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged); | ||
350 | 62 | } | ||
351 | 63 | |||
352 | 64 | void UCActionItem::_q_enabledChanged() | ||
353 | 65 | { | ||
354 | 66 | m_flags |= CustomEnabled; | ||
355 | 67 | disconnect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged); | ||
356 | 68 | } | ||
357 | 69 | |||
358 | 70 | // update visible property | 68 | // update visible property |
360 | 71 | void UCActionItem::_q_updateVisible() | 69 | void UCActionItem::_q_visibleBinding() |
361 | 72 | { | 70 | { |
362 | 71 | if (m_flags & CustomVisible) { | ||
363 | 72 | return; | ||
364 | 73 | } | ||
365 | 74 | if (hasBindingOnProperty(QStringLiteral("visible"))) { | ||
366 | 75 | m_flags |= CustomEnabled; | ||
367 | 76 | return; | ||
368 | 77 | } | ||
369 | 73 | bool visible = m_action ? m_action->m_visible : true; | 78 | bool visible = m_action ? m_action->m_visible : true; |
370 | 74 | setVisible(visible); | 79 | setVisible(visible); |
371 | 75 | // reset flag and reconnect signal handler disconnected by the | ||
372 | 76 | m_flags &= ~CustomVisible; | ||
373 | 77 | if (m_action) { | ||
374 | 78 | connect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged); | ||
375 | 79 | } | ||
376 | 80 | } | 80 | } |
377 | 81 | 81 | ||
378 | 82 | // update enabled property | 82 | // update enabled property |
380 | 83 | void UCActionItem::_q_updateEnabled() | 83 | void UCActionItem::_q_enabledBinding() |
381 | 84 | { | 84 | { |
382 | 85 | if (m_flags & CustomEnabled) { | ||
383 | 86 | return; | ||
384 | 87 | } | ||
385 | 88 | if (hasBindingOnProperty(QStringLiteral("enabled"))) { | ||
386 | 89 | m_flags |= CustomEnabled; | ||
387 | 90 | return; | ||
388 | 91 | } | ||
389 | 85 | bool enabled = m_action ? m_action->m_enabled : true; | 92 | bool enabled = m_action ? m_action->m_enabled : true; |
390 | 86 | setEnabled(enabled); | 93 | setEnabled(enabled); |
396 | 87 | // reset flag and reconnect signal handler disconnected by the | 94 | } |
397 | 88 | m_flags &= ~CustomEnabled; | 95 | |
398 | 89 | if (m_action) { | 96 | // setter called when bindings from QML set the value. Internal functions will |
399 | 90 | connect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged); | 97 | // all use the setVisible setter, so initialization and (re)parenting related |
400 | 91 | } | 98 | // visible alteration won't set the custom flag |
401 | 99 | void UCActionItem::setVisible2(bool visible) | ||
402 | 100 | { | ||
403 | 101 | // set the custom flag and forward the value to the original proepry setter | ||
404 | 102 | m_flags |= CustomVisible; | ||
405 | 103 | setVisible(visible); | ||
406 | 104 | } | ||
407 | 105 | void UCActionItem::setEnabled2(bool enabled) | ||
408 | 106 | { | ||
409 | 107 | m_flags |= CustomEnabled; | ||
410 | 108 | setEnabled(enabled); | ||
411 | 92 | } | 109 | } |
412 | 93 | 110 | ||
413 | 94 | void UCActionItem::updateProperties() | 111 | void UCActionItem::updateProperties() |
414 | @@ -109,10 +126,14 @@ | |||
415 | 109 | if (attach) { | 126 | if (attach) { |
416 | 110 | connect(this, SIGNAL(triggered(QVariant)), | 127 | connect(this, SIGNAL(triggered(QVariant)), |
417 | 111 | m_action, SLOT(trigger(QVariant)), Qt::DirectConnection); | 128 | m_action, SLOT(trigger(QVariant)), Qt::DirectConnection); |
422 | 112 | connect(m_action, &UCAction::visibleChanged, | 129 | if (!(m_flags & CustomVisible)) { |
423 | 113 | this, &UCActionItem::_q_updateVisible, Qt::DirectConnection); | 130 | connect(m_action, &UCAction::visibleChanged, |
424 | 114 | connect(m_action, &UCAction::enabledChanged, | 131 | this, &UCActionItem::_q_visibleBinding, Qt::DirectConnection); |
425 | 115 | this, &UCActionItem::_q_updateEnabled, Qt::DirectConnection); | 132 | } |
426 | 133 | if (!(m_flags & CustomEnabled)) { | ||
427 | 134 | connect(m_action, &UCAction::enabledChanged, | ||
428 | 135 | this, &UCActionItem::_q_enabledBinding, Qt::DirectConnection); | ||
429 | 136 | } | ||
430 | 116 | if (!(m_flags & CustomText)) { | 137 | if (!(m_flags & CustomText)) { |
431 | 117 | connect(m_action, &UCAction::textChanged, | 138 | connect(m_action, &UCAction::textChanged, |
432 | 118 | this, &UCActionItem::textChanged, Qt::DirectConnection); | 139 | this, &UCActionItem::textChanged, Qt::DirectConnection); |
433 | @@ -128,10 +149,14 @@ | |||
434 | 128 | } else { | 149 | } else { |
435 | 129 | disconnect(this, SIGNAL(triggered(QVariant)), | 150 | disconnect(this, SIGNAL(triggered(QVariant)), |
436 | 130 | m_action, SLOT(trigger(QVariant))); | 151 | m_action, SLOT(trigger(QVariant))); |
441 | 131 | disconnect(m_action, &UCAction::visibleChanged, | 152 | if (!(m_flags & CustomVisible)) { |
442 | 132 | this, &UCActionItem::_q_updateVisible); | 153 | disconnect(m_action, &UCAction::visibleChanged, |
443 | 133 | disconnect(m_action, &UCAction::enabledChanged, | 154 | this, &UCActionItem::_q_visibleBinding); |
444 | 134 | this, &UCActionItem::_q_updateEnabled); | 155 | } |
445 | 156 | if (!(m_flags & CustomEnabled)) { | ||
446 | 157 | disconnect(m_action, &UCAction::enabledChanged, | ||
447 | 158 | this, &UCActionItem::_q_enabledBinding); | ||
448 | 159 | } | ||
449 | 135 | if (!(m_flags & CustomText)) { | 160 | if (!(m_flags & CustomText)) { |
450 | 136 | disconnect(m_action, &UCAction::textChanged, | 161 | disconnect(m_action, &UCAction::textChanged, |
451 | 137 | this, &UCActionItem::textChanged); | 162 | this, &UCActionItem::textChanged); |
452 | @@ -167,8 +192,8 @@ | |||
453 | 167 | if (m_action) { | 192 | if (m_action) { |
454 | 168 | attachAction(true); | 193 | attachAction(true); |
455 | 169 | } | 194 | } |
458 | 170 | _q_updateVisible(); | 195 | _q_visibleBinding(); |
459 | 171 | _q_updateEnabled(); | 196 | _q_enabledBinding(); |
460 | 172 | updateProperties(); | 197 | updateProperties(); |
461 | 173 | } | 198 | } |
462 | 174 | 199 | ||
463 | 175 | 200 | ||
464 | === modified file 'src/Ubuntu/Components/plugin/ucactionitem.h' | |||
465 | --- src/Ubuntu/Components/plugin/ucactionitem.h 2015-08-25 11:31:29 +0000 | |||
466 | +++ src/Ubuntu/Components/plugin/ucactionitem.h 2015-09-22 15:57:54 +0000 | |||
467 | @@ -26,6 +26,10 @@ | |||
468 | 26 | Q_PROPERTY(QString text READ text WRITE setText RESET resetText NOTIFY textChanged) | 26 | Q_PROPERTY(QString text READ text WRITE setText RESET resetText NOTIFY textChanged) |
469 | 27 | Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource RESET resetIconSource NOTIFY iconSourceChanged) | 27 | Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource RESET resetIconSource NOTIFY iconSourceChanged) |
470 | 28 | Q_PROPERTY(QString iconName READ iconName WRITE setIconName RESET resetIconName NOTIFY iconNameChanged) | 28 | Q_PROPERTY(QString iconName READ iconName WRITE setIconName RESET resetIconName NOTIFY iconNameChanged) |
471 | 29 | |||
472 | 30 | // overrides | ||
473 | 31 | Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled2 NOTIFY enabledChanged2) | ||
474 | 32 | Q_PROPERTY(bool visible READ isVisible WRITE setVisible2 NOTIFY visibleChanged2 FINAL) | ||
475 | 29 | public: | 33 | public: |
476 | 30 | explicit UCActionItem(QQuickItem *parent = 0); | 34 | explicit UCActionItem(QQuickItem *parent = 0); |
477 | 31 | 35 | ||
478 | @@ -40,6 +44,9 @@ | |||
479 | 40 | void setIconName(const QString &iconName); | 44 | void setIconName(const QString &iconName); |
480 | 41 | void resetIconName(); | 45 | void resetIconName(); |
481 | 42 | 46 | ||
482 | 47 | void setVisible2(bool visible); | ||
483 | 48 | void setEnabled2(bool enabled); | ||
484 | 49 | |||
485 | 43 | Q_SIGNALS: | 50 | Q_SIGNALS: |
486 | 44 | void actionChanged(); | 51 | void actionChanged(); |
487 | 45 | void textChanged(); | 52 | void textChanged(); |
488 | @@ -47,14 +54,15 @@ | |||
489 | 47 | void iconNameChanged(); | 54 | void iconNameChanged(); |
490 | 48 | void triggered(const QVariant &value); | 55 | void triggered(const QVariant &value); |
491 | 49 | 56 | ||
492 | 57 | void enabledChanged2(); | ||
493 | 58 | void visibleChanged2(); | ||
494 | 59 | |||
495 | 50 | public Q_SLOTS: | 60 | public Q_SLOTS: |
496 | 51 | void trigger(const QVariant &value = QVariant()); | 61 | void trigger(const QVariant &value = QVariant()); |
497 | 52 | 62 | ||
498 | 53 | protected Q_SLOTS: | 63 | protected Q_SLOTS: |
503 | 54 | void _q_visibleChanged(); | 64 | void _q_visibleBinding(); |
504 | 55 | void _q_enabledChanged(); | 65 | void _q_enabledBinding(); |
501 | 56 | void _q_updateVisible(); | ||
502 | 57 | void _q_updateEnabled(); | ||
505 | 58 | 66 | ||
506 | 59 | protected: | 67 | protected: |
507 | 60 | enum { | 68 | enum { |
508 | @@ -72,6 +80,7 @@ | |||
509 | 72 | 80 | ||
510 | 73 | void componentComplete(); | 81 | void componentComplete(); |
511 | 74 | 82 | ||
512 | 83 | bool hasBindingOnProperty(const QString &name); | ||
513 | 75 | void updateProperties(); | 84 | void updateProperties(); |
514 | 76 | void attachAction(bool attach); | 85 | void attachAction(bool attach); |
515 | 77 | }; | 86 | }; |
516 | 78 | 87 | ||
517 | === modified file 'src/Ubuntu/Components/plugin/uclistitem.cpp' | |||
518 | --- src/Ubuntu/Components/plugin/uclistitem.cpp 2015-09-04 09:32:31 +0000 | |||
519 | +++ src/Ubuntu/Components/plugin/uclistitem.cpp 2015-09-22 15:57:54 +0000 | |||
520 | @@ -474,7 +474,7 @@ | |||
521 | 474 | if (parentAttached) { | 474 | if (parentAttached) { |
522 | 475 | Q_Q(UCListItem); | 475 | Q_Q(UCListItem); |
523 | 476 | // restore flickable's interactive and cleanup | 476 | // restore flickable's interactive and cleanup |
525 | 477 | parentAttached->disableInteractive(q, false); | 477 | q->setKeepMouseGrab(false); |
526 | 478 | // no need to listen flickables any longer | 478 | // no need to listen flickables any longer |
527 | 479 | listenToRebind(false); | 479 | listenToRebind(false); |
528 | 480 | } | 480 | } |
529 | @@ -1123,7 +1123,7 @@ | |||
530 | 1123 | 1123 | ||
531 | 1124 | // grabs the left mouse button event by turning highlight on, and triggering | 1124 | // grabs the left mouse button event by turning highlight on, and triggering |
532 | 1125 | // swipe events; child items should no longer get mouse events | 1125 | // swipe events; child items should no longer get mouse events |
534 | 1126 | void UCListItemPrivate::grabLeftButtonEvents(QMouseEvent *event) | 1126 | void UCListItemPrivate::handleLeftButtonPress(QMouseEvent *event) |
535 | 1127 | { | 1127 | { |
536 | 1128 | Q_Q(UCListItem); | 1128 | Q_Q(UCListItem); |
537 | 1129 | button = event->button(); | 1129 | button = event->button(); |
538 | @@ -1133,11 +1133,15 @@ | |||
539 | 1133 | lastPos = pressedPos = event->localPos(); | 1133 | lastPos = pressedPos = event->localPos(); |
540 | 1134 | // connect the Flickable to know when to rebound | 1134 | // connect the Flickable to know when to rebound |
541 | 1135 | listenToRebind(true); | 1135 | listenToRebind(true); |
544 | 1136 | if (swiped && parentAttached) { | 1136 | if (swiped) { |
545 | 1137 | parentAttached->disableInteractive(q, true); | 1137 | // grab now, and ungrab in snapOut |
546 | 1138 | q->setKeepMouseGrab(true); | ||
547 | 1139 | q->grabMouse(); | ||
548 | 1138 | } | 1140 | } |
549 | 1139 | // stop any ongoing animation! | 1141 | // stop any ongoing animation! |
550 | 1140 | swipeEvent(event->localPos(), UCSwipeEvent::Started); | 1142 | swipeEvent(event->localPos(), UCSwipeEvent::Started); |
551 | 1143 | // accept the event so we get the rest of the events as well | ||
552 | 1144 | event->accept(); | ||
553 | 1141 | } | 1145 | } |
554 | 1142 | 1146 | ||
555 | 1143 | void UCListItem::mousePressEvent(QMouseEvent *event) | 1147 | void UCListItem::mousePressEvent(QMouseEvent *event) |
556 | @@ -1150,10 +1154,8 @@ | |||
557 | 1150 | return; | 1154 | return; |
558 | 1151 | } | 1155 | } |
559 | 1152 | if (d->canHighlight() && !d->highlighted && event->button() == Qt::LeftButton) { | 1156 | if (d->canHighlight() && !d->highlighted && event->button() == Qt::LeftButton) { |
561 | 1153 | d->grabLeftButtonEvents(event); | 1157 | d->handleLeftButtonPress(event); |
562 | 1154 | } | 1158 | } |
563 | 1155 | // accept the event so we get the rest of the events as well | ||
564 | 1156 | event->setAccepted(true); | ||
565 | 1157 | } | 1159 | } |
566 | 1158 | 1160 | ||
567 | 1159 | bool UCListItem13::shouldShowContextMenu(QMouseEvent *event) | 1161 | bool UCListItem13::shouldShowContextMenu(QMouseEvent *event) |
568 | @@ -1203,15 +1205,16 @@ | |||
569 | 1203 | } | 1205 | } |
570 | 1204 | 1206 | ||
571 | 1205 | // ungrabs any previously grabbed left mouse button event | 1207 | // ungrabs any previously grabbed left mouse button event |
573 | 1206 | void UCListItemPrivate::ungrabLeftButtonEvents(QMouseEvent *event) | 1208 | void UCListItemPrivate::handleLeftButtonRelease(QMouseEvent *event) |
574 | 1207 | { | 1209 | { |
575 | 1208 | Q_Q(UCListItem); | 1210 | Q_Q(UCListItem); |
576 | 1209 | // set released | 1211 | // set released |
577 | 1210 | if (highlighted) { | 1212 | if (highlighted) { |
578 | 1211 | // unblock ascending Flickables | 1213 | // unblock ascending Flickables |
579 | 1212 | listenToRebind(false); | 1214 | listenToRebind(false); |
582 | 1213 | if (parentAttached) { | 1215 | q->setKeepMouseGrab(false); |
583 | 1214 | parentAttached->disableInteractive(q, false); | 1216 | if (window && window->mouseGrabberItem() == q) { |
584 | 1217 | q->ungrabMouse(); | ||
585 | 1215 | } | 1218 | } |
586 | 1216 | 1219 | ||
587 | 1217 | if (!suppressClick) { | 1220 | if (!suppressClick) { |
588 | @@ -1231,15 +1234,14 @@ | |||
589 | 1231 | } | 1234 | } |
590 | 1232 | } | 1235 | } |
591 | 1233 | button = Qt::NoButton; | 1236 | button = Qt::NoButton; |
592 | 1237 | event->accept(); | ||
593 | 1234 | } | 1238 | } |
594 | 1235 | 1239 | ||
595 | 1236 | void UCListItem::mouseReleaseEvent(QMouseEvent *event) | 1240 | void UCListItem::mouseReleaseEvent(QMouseEvent *event) |
596 | 1237 | { | 1241 | { |
597 | 1238 | UCStyledItemBase::mouseReleaseEvent(event); | 1242 | UCStyledItemBase::mouseReleaseEvent(event); |
598 | 1239 | Q_D(UCListItem); | 1243 | Q_D(UCListItem); |
602 | 1240 | d->ungrabLeftButtonEvents(event); | 1244 | d->handleLeftButtonRelease(event); |
600 | 1241 | // make sure we ungrab the mouse! | ||
601 | 1242 | ungrabMouse(); | ||
603 | 1243 | } | 1245 | } |
604 | 1244 | 1246 | ||
605 | 1245 | void UCListItem13::mouseReleaseEvent(QMouseEvent *event) | 1247 | void UCListItem13::mouseReleaseEvent(QMouseEvent *event) |
606 | @@ -1275,9 +1277,7 @@ | |||
607 | 1275 | if (d->swipedOverThreshold(event->localPos(), d->pressedPos)) { | 1277 | if (d->swipedOverThreshold(event->localPos(), d->pressedPos)) { |
608 | 1276 | // the press went out of the threshold area, enable move, if the direction allows it | 1278 | // the press went out of the threshold area, enable move, if the direction allows it |
609 | 1277 | d->lastPos = event->localPos(); | 1279 | d->lastPos = event->localPos(); |
613 | 1278 | if (d->parentAttached) { | 1280 | setKeepMouseGrab(true); |
611 | 1279 | d->parentAttached->disableInteractive(this, true); | ||
612 | 1280 | } | ||
614 | 1281 | qreal mouseX = event->localPos().x(); | 1281 | qreal mouseX = event->localPos().x(); |
615 | 1282 | qreal pressedX = d->pressedPos.x(); | 1282 | qreal pressedX = d->pressedPos.x(); |
616 | 1283 | bool doSwipe = (d->leadingActions && (mouseX > pressedX)) || | 1283 | bool doSwipe = (d->leadingActions && (mouseX > pressedX)) || |
617 | @@ -1298,42 +1298,81 @@ | |||
618 | 1298 | } | 1298 | } |
619 | 1299 | } | 1299 | } |
620 | 1300 | 1300 | ||
621 | 1301 | bool UCListItemPrivate::sendMouseEvent(QQuickItem *item, QMouseEvent *event) | ||
622 | 1302 | { | ||
623 | 1303 | Q_UNUSED(item); | ||
624 | 1304 | Q_Q(UCListItem); | ||
625 | 1305 | QQuickItem *grabber = window ? window->mouseGrabberItem() : Q_NULLPTR; | ||
626 | 1306 | if (grabber == q) { | ||
627 | 1307 | // already the grabber, return | ||
628 | 1308 | return true; | ||
629 | 1309 | } | ||
630 | 1310 | |||
631 | 1311 | bool consumed = false; | ||
632 | 1312 | if (contentItem->contains(contentItem->mapFromScene(event->windowPos()))) { | ||
633 | 1313 | QPointF localPos = q->mapFromScene(event->windowPos()); | ||
634 | 1314 | |||
635 | 1315 | switch (event->type()) { | ||
636 | 1316 | case QEvent::MouseButtonPress: { | ||
637 | 1317 | // remember pressed point over active areas | ||
638 | 1318 | if (event->button() == Qt::LeftButton) { | ||
639 | 1319 | if (swiped) { | ||
640 | 1320 | // handle as full press and grab the event from the children | ||
641 | 1321 | QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos)); | ||
642 | 1322 | handleLeftButtonPress(mouseEvent.data()); | ||
643 | 1323 | consumed = true; | ||
644 | 1324 | } else { | ||
645 | 1325 | // remember the position | ||
646 | 1326 | pressedPos = localPos; | ||
647 | 1327 | button = event->button(); | ||
648 | 1328 | } | ||
649 | 1329 | } | ||
650 | 1330 | break; | ||
651 | 1331 | } | ||
652 | 1332 | case QEvent::MouseButtonRelease: { | ||
653 | 1333 | QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos)); | ||
654 | 1334 | handleLeftButtonRelease(mouseEvent.data()); | ||
655 | 1335 | suppressClick = false; | ||
656 | 1336 | break; | ||
657 | 1337 | } | ||
658 | 1338 | case QEvent::MouseMove: { | ||
659 | 1339 | if ((button == Qt::LeftButton) && swipedOverThreshold(localPos, pressedPos) && !highlighted) { | ||
660 | 1340 | // grab the event from the child, so the click doesn't happen anymore, and initiate swiping | ||
661 | 1341 | QMouseEvent pressed(QEvent::MouseButtonPress, localPos, event->windowPos(), event->screenPos(), | ||
662 | 1342 | Qt::LeftButton, event->buttons(), event->modifiers()); | ||
663 | 1343 | handleLeftButtonPress(&pressed); | ||
664 | 1344 | // grab any further events so all land in the list item | ||
665 | 1345 | q->setKeepMouseGrab(true); | ||
666 | 1346 | q->grabMouse(); | ||
667 | 1347 | consumed = true; | ||
668 | 1348 | } | ||
669 | 1349 | break; | ||
670 | 1350 | } | ||
671 | 1351 | default: break; | ||
672 | 1352 | } | ||
673 | 1353 | } | ||
674 | 1354 | |||
675 | 1355 | return consumed; | ||
676 | 1356 | } | ||
677 | 1357 | |||
678 | 1301 | bool UCListItem::childMouseEventFilter(QQuickItem *child, QEvent *event) | 1358 | bool UCListItem::childMouseEventFilter(QQuickItem *child, QEvent *event) |
679 | 1302 | { | 1359 | { |
681 | 1303 | QEvent::Type type = event->type(); | 1360 | if (!isVisible() || !isEnabled()) { |
682 | 1361 | return UCStyledItemBase::childMouseEventFilter(child, event); | ||
683 | 1362 | } | ||
684 | 1363 | |||
685 | 1304 | Q_D(UCListItem); | 1364 | Q_D(UCListItem); |
718 | 1305 | if (type == QEvent::MouseButtonPress) { | 1365 | switch (event->type()) { |
719 | 1306 | // suppress click event if pressed over an active area, except Text, which can also handle | 1366 | case QEvent::MouseButtonPress: |
720 | 1307 | // mouse clicks when content is an URL | 1367 | case QEvent::MouseMove: |
721 | 1308 | QMouseEvent *mouse = static_cast<QMouseEvent*>(event); | 1368 | case QEvent::MouseButtonRelease: { |
722 | 1309 | if (child->isEnabled() && (child->acceptedMouseButtons() & mouse->button()) && !qobject_cast<QQuickText*>(child)) { | 1369 | if (d->sendMouseEvent(child, static_cast<QMouseEvent*>(event))) { |
723 | 1310 | // suppress click | 1370 | return true; |
724 | 1311 | d->suppressClick = true; | 1371 | } |
725 | 1312 | // listen for flickable to be able to rebind if movement started there! | 1372 | } |
726 | 1313 | d->listenToRebind(true); | 1373 | default: break; |
727 | 1314 | // if left button pressed, remember the position | 1374 | } |
728 | 1315 | if (mouse->button() == Qt::LeftButton) { | 1375 | |
697 | 1316 | d->pressedPos = mapFromItem(child, mouse->localPos()); | ||
698 | 1317 | d->button = mouse->button(); | ||
699 | 1318 | } | ||
700 | 1319 | } | ||
701 | 1320 | } else if (type == QEvent::MouseButtonRelease) { | ||
702 | 1321 | Q_D(UCListItem); | ||
703 | 1322 | d->suppressClick = false; | ||
704 | 1323 | } else if (type == QEvent::MouseMove) { | ||
705 | 1324 | QMouseEvent *mouse = static_cast<QMouseEvent*>(event); | ||
706 | 1325 | const QPointF localPos = mapFromItem(child, mouse->localPos()); | ||
707 | 1326 | if ((mouse->buttons() & Qt::LeftButton) && d->swipedOverThreshold(localPos, d->pressedPos) && !d->highlighted) { | ||
708 | 1327 | // grab the event from the child, so the click doesn't happen anymore, and initiate swiping | ||
709 | 1328 | QMouseEvent pressed(QEvent::MouseButtonPress, localPos, mouse->windowPos(), mouse->screenPos(), | ||
710 | 1329 | Qt::LeftButton, mouse->buttons(), mouse->modifiers()); | ||
711 | 1330 | d->grabLeftButtonEvents(&pressed); | ||
712 | 1331 | // stop click and pressAndHold, then grab the mouse so children do not get the mouse events anymore | ||
713 | 1332 | d->suppressClick = true; | ||
714 | 1333 | d->pressAndHoldTimer.stop(); | ||
715 | 1334 | grabMouse(); | ||
716 | 1335 | } | ||
717 | 1336 | } | ||
729 | 1337 | return UCStyledItemBase::childMouseEventFilter(child, event); | 1376 | return UCStyledItemBase::childMouseEventFilter(child, event); |
730 | 1338 | } | 1377 | } |
731 | 1339 | 1378 | ||
732 | 1340 | 1379 | ||
733 | === modified file 'src/Ubuntu/Components/plugin/uclistitem.h' | |||
734 | --- src/Ubuntu/Components/plugin/uclistitem.h 2015-09-04 09:32:31 +0000 | |||
735 | +++ src/Ubuntu/Components/plugin/uclistitem.h 2015-09-22 15:57:54 +0000 | |||
736 | @@ -180,7 +180,6 @@ | |||
737 | 180 | static UCViewItemsAttached *qmlAttachedProperties(QObject *owner); | 180 | static UCViewItemsAttached *qmlAttachedProperties(QObject *owner); |
738 | 181 | 181 | ||
739 | 182 | bool listenToRebind(UCListItem *item, bool listen); | 182 | bool listenToRebind(UCListItem *item, bool listen); |
740 | 183 | void disableInteractive(UCListItem *item, bool disable); | ||
741 | 184 | bool isMoving(); | 183 | bool isMoving(); |
742 | 185 | bool isBoundTo(UCListItem *item); | 184 | bool isBoundTo(UCListItem *item); |
743 | 186 | 185 | ||
744 | 187 | 186 | ||
745 | === modified file 'src/Ubuntu/Components/plugin/uclistitem_p.h' | |||
746 | --- src/Ubuntu/Components/plugin/uclistitem_p.h 2015-09-01 07:16:59 +0000 | |||
747 | +++ src/Ubuntu/Components/plugin/uclistitem_p.h 2015-09-22 15:57:54 +0000 | |||
748 | @@ -68,8 +68,9 @@ | |||
749 | 68 | void snapOut(); | 68 | void snapOut(); |
750 | 69 | void swipeEvent(const QPointF &localPos, UCSwipeEvent::Status status); | 69 | void swipeEvent(const QPointF &localPos, UCSwipeEvent::Status status); |
751 | 70 | bool swipedOverThreshold(const QPointF &mousePos, const QPointF relativePos); | 70 | bool swipedOverThreshold(const QPointF &mousePos, const QPointF relativePos); |
754 | 71 | void grabLeftButtonEvents(QMouseEvent *event); | 71 | void handleLeftButtonPress(QMouseEvent *event); |
755 | 72 | void ungrabLeftButtonEvents(QMouseEvent *event); | 72 | void handleLeftButtonRelease(QMouseEvent *event); |
756 | 73 | bool sendMouseEvent(QQuickItem *item, QMouseEvent *event); | ||
757 | 73 | 74 | ||
758 | 74 | quint16 defaultThemeVersion; | 75 | quint16 defaultThemeVersion; |
759 | 75 | bool highlighted:1; | 76 | bool highlighted:1; |
760 | @@ -138,8 +139,6 @@ | |||
761 | 138 | 139 | ||
762 | 139 | void clearFlickablesList(); | 140 | void clearFlickablesList(); |
763 | 140 | void buildFlickablesList(); | 141 | void buildFlickablesList(); |
764 | 141 | void clearChangesList(); | ||
765 | 142 | void buildChangesList(const QVariant &newValue); | ||
766 | 143 | bool addSelectedItem(UCListItem *item); | 142 | bool addSelectedItem(UCListItem *item); |
767 | 144 | bool removeSelectedItem(UCListItem *item); | 143 | bool removeSelectedItem(UCListItem *item); |
768 | 145 | bool isItemSelected(UCListItem *item); | 144 | bool isItemSelected(UCListItem *item); |
769 | @@ -157,13 +156,10 @@ | |||
770 | 157 | QSet<int> selectedList; | 156 | QSet<int> selectedList; |
771 | 158 | QMap<int, QPointer<UCListItem13> > expansionList; | 157 | QMap<int, QPointer<UCListItem13> > expansionList; |
772 | 159 | QList< QPointer<QQuickFlickable> > flickables; | 158 | QList< QPointer<QQuickFlickable> > flickables; |
773 | 160 | QList< PropertyChange* > changes; | ||
774 | 161 | QPointer<UCListItem> boundItem; | 159 | QPointer<UCListItem> boundItem; |
775 | 162 | QPointer<UCListItem> disablerItem; | ||
776 | 163 | QQuickFlickable *listView; | 160 | QQuickFlickable *listView; |
777 | 164 | ListItemDragArea *dragArea; | 161 | ListItemDragArea *dragArea; |
778 | 165 | UCViewItemsAttached::ExpansionFlags expansionFlags; | 162 | UCViewItemsAttached::ExpansionFlags expansionFlags; |
779 | 166 | bool globalDisabled:1; | ||
780 | 167 | bool selectable:1; | 163 | bool selectable:1; |
781 | 168 | bool draggable:1; | 164 | bool draggable:1; |
782 | 169 | bool ready:1; | 165 | bool ready:1; |
783 | 170 | 166 | ||
784 | === modified file 'src/Ubuntu/Components/plugin/ucviewitemsattached.cpp' | |||
785 | --- src/Ubuntu/Components/plugin/ucviewitemsattached.cpp 2015-09-04 08:55:29 +0000 | |||
786 | +++ src/Ubuntu/Components/plugin/ucviewitemsattached.cpp 2015-09-22 15:57:54 +0000 | |||
787 | @@ -105,7 +105,6 @@ | |||
788 | 105 | , listView(0) | 105 | , listView(0) |
789 | 106 | , dragArea(0) | 106 | , dragArea(0) |
790 | 107 | , expansionFlags(UCViewItemsAttached::Exclusive) | 107 | , expansionFlags(UCViewItemsAttached::Exclusive) |
791 | 108 | , globalDisabled(false) | ||
792 | 109 | , selectable(false) | 108 | , selectable(false) |
793 | 110 | , draggable(false) | 109 | , draggable(false) |
794 | 111 | , ready(false) | 110 | , ready(false) |
795 | @@ -114,7 +113,6 @@ | |||
796 | 114 | 113 | ||
797 | 115 | UCViewItemsAttachedPrivate::~UCViewItemsAttachedPrivate() | 114 | UCViewItemsAttachedPrivate::~UCViewItemsAttachedPrivate() |
798 | 116 | { | 115 | { |
799 | 117 | clearChangesList(); | ||
800 | 118 | clearFlickablesList(); | 116 | clearFlickablesList(); |
801 | 119 | } | 117 | } |
802 | 120 | 118 | ||
803 | @@ -155,33 +153,6 @@ | |||
804 | 155 | } | 153 | } |
805 | 156 | } | 154 | } |
806 | 157 | 155 | ||
807 | 158 | void UCViewItemsAttachedPrivate::clearChangesList() | ||
808 | 159 | { | ||
809 | 160 | // clear property change objects | ||
810 | 161 | qDeleteAll(changes); | ||
811 | 162 | changes.clear(); | ||
812 | 163 | } | ||
813 | 164 | |||
814 | 165 | void UCViewItemsAttachedPrivate::buildChangesList(const QVariant &newValue) | ||
815 | 166 | { | ||
816 | 167 | // collect all ascendant flickables | ||
817 | 168 | Q_Q(UCViewItemsAttached); | ||
818 | 169 | QQuickItem *item = qobject_cast<QQuickItem*>(q->parent()); | ||
819 | 170 | if (!item) { | ||
820 | 171 | return; | ||
821 | 172 | } | ||
822 | 173 | clearChangesList(); | ||
823 | 174 | while (item) { | ||
824 | 175 | QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(item); | ||
825 | 176 | if (flickable) { | ||
826 | 177 | PropertyChange *change = new PropertyChange(item, "interactive"); | ||
827 | 178 | PropertyChange::setValue(change, newValue); | ||
828 | 179 | changes << change; | ||
829 | 180 | } | ||
830 | 181 | item = item->parentItem(); | ||
831 | 182 | } | ||
832 | 183 | } | ||
833 | 184 | |||
834 | 185 | /*! | 156 | /*! |
835 | 186 | * \qmltype ViewItems | 157 | * \qmltype ViewItems |
836 | 187 | * \instantiates UCViewItemsAttached | 158 | * \instantiates UCViewItemsAttached |
837 | @@ -252,41 +223,6 @@ | |||
838 | 252 | return d->boundItem == item; | 223 | return d->boundItem == item; |
839 | 253 | } | 224 | } |
840 | 254 | 225 | ||
841 | 255 | /* | ||
842 | 256 | * Disable/enable interactive flag for the ascendant flickables. The item is used | ||
843 | 257 | * to detect whether the same item is trying to enable the flickables which disabled | ||
844 | 258 | * it before. The enabled/disabled states are not equivalent to the enabled/disabled | ||
845 | 259 | * state of the interactive flag. | ||
846 | 260 | * When disabled, always the last item disabling will be kept as active disabler, | ||
847 | 261 | * and only the active disabler can enable (restore) the interactive flag state. | ||
848 | 262 | */ | ||
849 | 263 | void UCViewItemsAttached::disableInteractive(UCListItem *item, bool disable) | ||
850 | 264 | { | ||
851 | 265 | Q_D(UCViewItemsAttached); | ||
852 | 266 | if (disable) { | ||
853 | 267 | // disabling or re-disabling | ||
854 | 268 | d->disablerItem = item; | ||
855 | 269 | if (d->globalDisabled == disable) { | ||
856 | 270 | // was already disabled, leave | ||
857 | 271 | return; | ||
858 | 272 | } | ||
859 | 273 | d->globalDisabled = true; | ||
860 | 274 | } else if (d->globalDisabled && d->disablerItem == item) { | ||
861 | 275 | // the one disabled it will enable | ||
862 | 276 | d->globalDisabled = false; | ||
863 | 277 | d->disablerItem.clear(); | ||
864 | 278 | } else { | ||
865 | 279 | // !disabled && (!globalDisabled || item != d->disablerItem) | ||
866 | 280 | return; | ||
867 | 281 | } | ||
868 | 282 | if (disable) { | ||
869 | 283 | // (re)build changes list with disabling the interactive value | ||
870 | 284 | d->buildChangesList(false); | ||
871 | 285 | } else { | ||
872 | 286 | d->clearChangesList(); | ||
873 | 287 | } | ||
874 | 288 | } | ||
875 | 289 | |||
876 | 290 | void UCViewItemsAttached::unbindItem() | 226 | void UCViewItemsAttached::unbindItem() |
877 | 291 | { | 227 | { |
878 | 292 | Q_D(UCViewItemsAttached); | 228 | Q_D(UCViewItemsAttached); |
879 | 293 | 229 | ||
880 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py' | |||
881 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2015-06-23 13:22:10 +0000 | |||
882 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2015-09-22 15:57:54 +0000 | |||
883 | @@ -34,6 +34,11 @@ | |||
884 | 34 | class AppHeader(_common.UbuntuUIToolkitCustomProxyObjectBase): | 34 | class AppHeader(_common.UbuntuUIToolkitCustomProxyObjectBase): |
885 | 35 | """AppHeader Autopilot custom proxy object.""" | 35 | """AppHeader Autopilot custom proxy object.""" |
886 | 36 | 36 | ||
887 | 37 | def __init__(self, *args): | ||
888 | 38 | super().__init__(*args) | ||
889 | 39 | if not hasattr(self, 'useDeprecatedToolbar'): | ||
890 | 40 | self.useDeprecatedToolbar = None | ||
891 | 41 | |||
892 | 37 | def ensure_visible(self): | 42 | def ensure_visible(self): |
893 | 38 | if not self._is_visible(): | 43 | if not self._is_visible(): |
894 | 39 | self._show() | 44 | self._show() |
895 | 40 | 45 | ||
896 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py' | |||
897 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2015-09-07 13:46:58 +0000 | |||
898 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2015-09-22 15:57:54 +0000 | |||
899 | @@ -81,16 +81,37 @@ | |||
900 | 81 | class ActionSelectionPopover(_common.UbuntuUIToolkitCustomProxyObjectBase): | 81 | class ActionSelectionPopover(_common.UbuntuUIToolkitCustomProxyObjectBase): |
901 | 82 | """ActionSelectionPopover Autopilot custom proxy object.""" | 82 | """ActionSelectionPopover Autopilot custom proxy object.""" |
902 | 83 | 83 | ||
903 | 84 | def click_action_button(self, action_object_name): | ||
904 | 85 | """Click an action button on the popover. | ||
905 | 86 | |||
906 | 87 | :parameter object_name: The QML objectName property of the action | ||
907 | 88 | :raise ToolkitException: If there is no visible button with that object | ||
908 | 89 | name or the popover is not open. | ||
909 | 90 | |||
910 | 91 | """ | ||
911 | 92 | |||
912 | 93 | if not self.visible: | ||
913 | 94 | raise _common.ToolkitException('The popover is not open.') | ||
914 | 95 | try: | ||
915 | 96 | object_name = action_object_name + "_button" | ||
916 | 97 | button = self.select_single(objectName=object_name) | ||
917 | 98 | except dbus.StateNotFoundError: | ||
918 | 99 | raise _common.ToolkitException( | ||
919 | 100 | 'Action with objectName "{0}" not found.'.format(object_name)) | ||
920 | 101 | self.pointing_device.click_object(button) | ||
921 | 102 | if self.autoClose: | ||
922 | 103 | try: | ||
923 | 104 | self.visible.wait_for(False) | ||
924 | 105 | except dbus.StateNotFoundError: | ||
925 | 106 | # The popover was removed from the tree. | ||
926 | 107 | pass | ||
927 | 108 | |||
928 | 84 | def click_button_by_text(self, text): | 109 | def click_button_by_text(self, text): |
929 | 85 | """Click a button on the popover. | 110 | """Click a button on the popover. |
930 | 86 | 111 | ||
931 | 87 | XXX We are receiving the text because there's no way to set the | ||
932 | 88 | objectName on the action. This is reported at | ||
933 | 89 | https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1205144 | ||
934 | 90 | --elopio - 2013-07-25 | ||
935 | 91 | |||
936 | 92 | :parameter text: The text of the button. | 112 | :parameter text: The text of the button. |
938 | 93 | :raise ToolkitException: If the popover is not open. | 113 | :raise ToolkitException: If there is no visible button with that label |
939 | 114 | or the popover is not open. | ||
940 | 94 | 115 | ||
941 | 95 | """ | 116 | """ |
942 | 96 | if not self.visible: | 117 | if not self.visible: |
943 | 97 | 118 | ||
944 | === modified file 'tests/autopilot/ubuntuuitoolkit/base.py' | |||
945 | --- tests/autopilot/ubuntuuitoolkit/base.py 2015-04-14 21:02:06 +0000 | |||
946 | +++ tests/autopilot/ubuntuuitoolkit/base.py 2015-09-22 15:57:54 +0000 | |||
947 | @@ -61,13 +61,12 @@ | |||
948 | 61 | def get_toolkit_launcher_command(): | 61 | def get_toolkit_launcher_command(): |
949 | 62 | root = ubuntuuitoolkit.tests.get_path_to_build_root() | 62 | root = ubuntuuitoolkit.tests.get_path_to_build_root() |
950 | 63 | path_to_local_launcher = os.path.join( | 63 | path_to_local_launcher = os.path.join( |
952 | 64 | root, 'tests', 'launcher', 'launcher') | 64 | root, 'ubuntu-ui-toolkit-launcher', 'ubuntu-ui-toolkit-launcher') |
953 | 65 | if os.path.exists(path_to_local_launcher): | 65 | if os.path.exists(path_to_local_launcher): |
954 | 66 | return path_to_local_launcher | 66 | return path_to_local_launcher |
955 | 67 | else: | 67 | else: |
956 | 68 | arch = ubuntuuitoolkit.base.get_host_multiarch() | ||
957 | 69 | path_to_installed_launcher = os.path.join( | 68 | path_to_installed_launcher = os.path.join( |
959 | 70 | '/', 'usr', 'lib', arch, 'ubuntu-ui-toolkit', 'launcher') | 69 | '/', 'usr', 'bin', 'ubuntu-ui-toolkit-launcher') |
960 | 71 | return path_to_installed_launcher | 70 | return path_to_installed_launcher |
961 | 72 | 71 | ||
962 | 73 | 72 | ||
963 | 74 | 73 | ||
964 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/__init__.py' | |||
965 | --- tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2015-07-29 09:50:33 +0000 | |||
966 | +++ tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2015-09-22 15:57:54 +0000 | |||
967 | @@ -204,8 +204,7 @@ | |||
968 | 204 | return orientationHelper | 204 | return orientationHelper |
969 | 205 | 205 | ||
970 | 206 | def checkPageHeader(self, pageTitle): | 206 | def checkPageHeader(self, pageTitle): |
973 | 207 | orientationHelper = self.getOrientationHelper() | 207 | header_label = self.main_view.select_single( |
972 | 208 | header_label = orientationHelper.select_single( | ||
974 | 209 | objectName="header_title_label", text=pageTitle) | 208 | objectName="header_title_label", text=pageTitle) |
975 | 210 | self.assertThat(header_label, Not(Is(None))) | 209 | self.assertThat(header_label, Not(Is(None))) |
976 | 211 | self.assertThat(header_label.visible, Eventually(Equals(True))) | 210 | self.assertThat(header_label.visible, Eventually(Equals(True))) |
977 | 212 | 211 | ||
978 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py' | |||
979 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py 2015-04-14 21:02:06 +0000 | |||
980 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py 2015-09-22 15:57:54 +0000 | |||
981 | @@ -51,19 +51,30 @@ | |||
982 | 51 | actions: ActionList { | 51 | actions: ActionList { |
983 | 52 | Action { | 52 | Action { |
984 | 53 | text: "Action one" | 53 | text: "Action one" |
985 | 54 | objectName: "actionOne" | ||
986 | 54 | onTriggered: label.text = "Button clicked." | 55 | onTriggered: label.text = "Button clicked." |
987 | 56 | }, | ||
988 | 57 | Action { | ||
989 | 58 | text: "Action two" | ||
990 | 59 | objectName: "actionDisabled" | ||
991 | 60 | onTriggered: label.text = "Disabled button clicked." | ||
992 | 61 | }, | ||
993 | 62 | Action { | ||
994 | 63 | text: "Action three" | ||
995 | 64 | objectName: "actionHidden" | ||
996 | 65 | onTriggered: label.text = "Hidden button clicked." | ||
997 | 55 | } | 66 | } |
998 | 56 | } | 67 | } |
999 | 57 | } | 68 | } |
1000 | 58 | } | 69 | } |
1001 | 59 | """) | 70 | """) |
1002 | 60 | 71 | ||
1004 | 61 | def test_action_selection_popover_custom_proxy_object(self): | 72 | def test_custom_proxy_object(self): |
1005 | 62 | popover = self.main_view.get_action_selection_popover( | 73 | popover = self.main_view.get_action_selection_popover( |
1006 | 63 | 'test_actions_popover') | 74 | 'test_actions_popover') |
1007 | 64 | self.assertIsInstance(popover, popups.ActionSelectionPopover) | 75 | self.assertIsInstance(popover, popups.ActionSelectionPopover) |
1008 | 65 | 76 | ||
1010 | 66 | def test_click_action_select_popover_button(self): | 77 | def test_click_button_by_label(self): |
1011 | 67 | label = self.app.select_single('Label', objectName='clicked_label') | 78 | label = self.app.select_single('Label', objectName='clicked_label') |
1012 | 68 | self.assertNotEqual(label.text, 'Button clicked.') | 79 | self.assertNotEqual(label.text, 'Button clicked.') |
1013 | 69 | self._open_popover() | 80 | self._open_popover() |
1014 | @@ -72,6 +83,49 @@ | |||
1015 | 72 | popover.click_button_by_text('Action one') | 83 | popover.click_button_by_text('Action one') |
1016 | 73 | self.assertEqual(label.text, 'Button clicked.') | 84 | self.assertEqual(label.text, 'Button clicked.') |
1017 | 74 | 85 | ||
1018 | 86 | def test_click_button_by_object_name(self): | ||
1019 | 87 | label = self.app.select_single('Label', objectName='clicked_label') | ||
1020 | 88 | self.assertNotEqual(label.text, 'Button clicked.') | ||
1021 | 89 | self._open_popover() | ||
1022 | 90 | popover = self.main_view.get_action_selection_popover( | ||
1023 | 91 | 'test_actions_popover') | ||
1024 | 92 | popover.click_action_button('actionOne') | ||
1025 | 93 | self.assertEqual(label.text, 'Button clicked.') | ||
1026 | 94 | |||
1027 | 95 | def test_click_unexisting_button_by_object_name(self): | ||
1028 | 96 | self._open_popover() | ||
1029 | 97 | popover = self.main_view.get_action_selection_popover( | ||
1030 | 98 | 'test_actions_popover') | ||
1031 | 99 | error = self.assertRaises( | ||
1032 | 100 | ubuntuuitoolkit.ToolkitException, | ||
1033 | 101 | popover.click_action_button, 'actionTwo') | ||
1034 | 102 | self.assertEqual( | ||
1035 | 103 | str(error), | ||
1036 | 104 | 'Action with objectName "actionTwo" not found.') | ||
1037 | 105 | |||
1038 | 106 | def test_click_disabled_button_by_object_name(self): | ||
1039 | 107 | self._open_popover() | ||
1040 | 108 | popover = self.main_view.get_action_selection_popover( | ||
1041 | 109 | 'test_actions_popover') | ||
1042 | 110 | # Disabled actions are not shown in ActionSelectionPopover | ||
1043 | 111 | error = self.assertRaises( | ||
1044 | 112 | ubuntuuitoolkit.ToolkitException, | ||
1045 | 113 | popover.click_action_button, 'actionDisabled') | ||
1046 | 114 | self.assertEqual( | ||
1047 | 115 | str(error), | ||
1048 | 116 | 'Action with objectName "actionDisabled" not found.') | ||
1049 | 117 | |||
1050 | 118 | def test_click_hidden_button_by_object_name(self): | ||
1051 | 119 | self._open_popover() | ||
1052 | 120 | popover = self.main_view.get_action_selection_popover( | ||
1053 | 121 | 'test_actions_popover') | ||
1054 | 122 | error = self.assertRaises( | ||
1055 | 123 | ubuntuuitoolkit.ToolkitException, | ||
1056 | 124 | popover.click_action_button, 'actionHidden') | ||
1057 | 125 | self.assertEqual( | ||
1058 | 126 | str(error), | ||
1059 | 127 | 'Action with objectName "actionHidden" not found.') | ||
1060 | 128 | |||
1061 | 75 | def _open_popover(self): | 129 | def _open_popover(self): |
1062 | 76 | open_button = self.main_view.select_single( | 130 | open_button = self.main_view.select_single( |
1063 | 77 | 'Button', objectName='open_popover') | 131 | 'Button', objectName='open_popover') |
1064 | 78 | 132 | ||
1065 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml' | |||
1066 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml 2015-09-07 15:46:58 +0000 | |||
1067 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml 2015-09-22 15:57:54 +0000 | |||
1068 | @@ -20,7 +20,6 @@ | |||
1069 | 20 | MainView { | 20 | MainView { |
1070 | 21 | width: units.gu(70) | 21 | width: units.gu(70) |
1071 | 22 | height: units.gu(60) | 22 | height: units.gu(60) |
1072 | 23 | useDeprecatedToolbar: true | ||
1073 | 24 | objectName: "mainView" | 23 | objectName: "mainView" |
1074 | 25 | 24 | ||
1075 | 26 | Tabs { | 25 | Tabs { |
1076 | @@ -29,33 +28,33 @@ | |||
1077 | 29 | objectName: "tab1" | 28 | objectName: "tab1" |
1078 | 30 | title: "Tab1" | 29 | title: "Tab1" |
1079 | 31 | Page { | 30 | Page { |
1082 | 32 | tools: ToolbarItems { | 31 | head.actions: [ |
1083 | 33 | ToolbarButton { | 32 | Action { |
1084 | 34 | text: "Test1" | 33 | text: "Test1" |
1085 | 35 | } | 34 | } |
1087 | 36 | } | 35 | ] |
1088 | 37 | } | 36 | } |
1089 | 38 | } | 37 | } |
1090 | 39 | Tab { | 38 | Tab { |
1091 | 40 | objectName: "tab2" | 39 | objectName: "tab2" |
1092 | 41 | title: "Tab2" | 40 | title: "Tab2" |
1093 | 42 | Page { | 41 | Page { |
1096 | 43 | tools: ToolbarItems { | 42 | head.actions: [ |
1097 | 44 | ToolbarButton { | 43 | Action { |
1098 | 45 | text: "Test2" | 44 | text: "Test2" |
1099 | 46 | } | 45 | } |
1101 | 47 | } | 46 | ] |
1102 | 48 | } | 47 | } |
1103 | 49 | } | 48 | } |
1104 | 50 | Tab { | 49 | Tab { |
1105 | 51 | objectName: "tab3" | 50 | objectName: "tab3" |
1106 | 52 | title: "Tab3" | 51 | title: "Tab3" |
1107 | 53 | Page { | 52 | Page { |
1110 | 54 | tools: ToolbarItems { | 53 | head.actions: [ |
1111 | 55 | ToolbarButton { | 54 | Action { |
1112 | 56 | text: "Test3" | 55 | text: "Test3" |
1113 | 57 | } | 56 | } |
1115 | 58 | } | 57 | ] |
1116 | 59 | } | 58 | } |
1117 | 60 | } | 59 | } |
1118 | 61 | } | 60 | } |
1119 | 62 | 61 | ||
1120 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py' | |||
1121 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py 2015-09-07 15:46:58 +0000 | |||
1122 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py 2015-09-22 15:57:54 +0000 | |||
1123 | @@ -28,10 +28,12 @@ | |||
1124 | 28 | dir_path = os.path.dirname(path) | 28 | dir_path = os.path.dirname(path) |
1125 | 29 | deprecated_tabbar_test_qml_file_path = os.path.join( | 29 | deprecated_tabbar_test_qml_file_path = os.path.join( |
1126 | 30 | dir_path, 'test_tabs.TabsTestCase.deprecated_TabBar.qml') | 30 | dir_path, 'test_tabs.TabsTestCase.deprecated_TabBar.qml') |
1128 | 31 | deprecated_tabbar_test_qml_file_path = os.path.join( | 31 | deprecated_tabbar_1_3_test_qml_file_path = os.path.join( |
1129 | 32 | dir_path, 'test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml') | 32 | dir_path, 'test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml') |
1130 | 33 | new_header_test_qml_file_path = os.path.join( | 33 | new_header_test_qml_file_path = os.path.join( |
1131 | 34 | dir_path, 'test_tabs.TabsTestCase.new_header.qml') | 34 | dir_path, 'test_tabs.TabsTestCase.new_header.qml') |
1132 | 35 | new_header_1_3_test_qml_file_path = os.path.join( | ||
1133 | 36 | dir_path, 'test_tabs.TabsTestCase.new_header.1.3.qml') | ||
1134 | 35 | 37 | ||
1135 | 36 | scenarios = [ | 38 | scenarios = [ |
1136 | 37 | ('deprecated TabBar', | 39 | ('deprecated TabBar', |
1137 | @@ -39,7 +41,7 @@ | |||
1138 | 39 | ('deprecated TabBar 1.3', | 41 | ('deprecated TabBar 1.3', |
1139 | 40 | dict(test_qml_file_path=deprecated_tabbar_1_3_test_qml_file_path)), | 42 | dict(test_qml_file_path=deprecated_tabbar_1_3_test_qml_file_path)), |
1140 | 41 | ('new header', | 43 | ('new header', |
1142 | 42 | dict(test_qml_file_path=new_header_test_qml_file_path)) | 44 | dict(test_qml_file_path=new_header_test_qml_file_path)), |
1143 | 43 | ('new header 1.3', | 45 | ('new header 1.3', |
1144 | 44 | dict(test_qml_file_path=new_header_1_3_test_qml_file_path)) | 46 | dict(test_qml_file_path=new_header_1_3_test_qml_file_path)) |
1145 | 45 | ] | 47 | ] |
1146 | 46 | 48 | ||
1147 | === modified file 'tests/resources/listitems/ListItemTest.qml' | |||
1148 | --- tests/resources/listitems/ListItemTest.qml 2015-07-30 13:27:32 +0000 | |||
1149 | +++ tests/resources/listitems/ListItemTest.qml 2015-09-22 15:57:54 +0000 | |||
1150 | @@ -15,8 +15,8 @@ | |||
1151 | 15 | */ | 15 | */ |
1152 | 16 | 16 | ||
1153 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
1156 | 18 | import Ubuntu.Components 1.3 | 18 | import Ubuntu.Components 1.2 |
1157 | 19 | import Ubuntu.Components.Styles 1.3 | 19 | import Ubuntu.Components.Styles 1.2 |
1158 | 20 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 |
1159 | 21 | 21 | ||
1160 | 22 | MainView { | 22 | MainView { |
1161 | @@ -263,6 +263,11 @@ | |||
1162 | 263 | Label { | 263 | Label { |
1163 | 264 | text: modelData + " Flickable item" | 264 | text: modelData + " Flickable item" |
1164 | 265 | } | 265 | } |
1165 | 266 | Button { | ||
1166 | 267 | text: "Pressme..." | ||
1167 | 268 | anchors.centerIn: parent | ||
1168 | 269 | } | ||
1169 | 270 | |||
1170 | 266 | onClicked: divider.visible = !divider.visible | 271 | onClicked: divider.visible = !divider.visible |
1171 | 267 | } | 272 | } |
1172 | 268 | } | 273 | } |
1173 | 269 | 274 | ||
1174 | === added file 'tests/resources/navigation/Blackbox.qml' | |||
1175 | --- tests/resources/navigation/Blackbox.qml 1970-01-01 00:00:00 +0000 | |||
1176 | +++ tests/resources/navigation/Blackbox.qml 2015-09-22 15:57:54 +0000 | |||
1177 | @@ -0,0 +1,48 @@ | |||
1178 | 1 | /* | ||
1179 | 2 | * Copyright 2015 Canonical Ltd. | ||
1180 | 3 | * | ||
1181 | 4 | * This program is free software; you can redistribute it and/or modify | ||
1182 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
1183 | 6 | * the Free Software Foundation; version 3. | ||
1184 | 7 | * | ||
1185 | 8 | * This program is distributed in the hope that it will be useful, | ||
1186 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1187 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1188 | 11 | * GNU Lesser General Public License for more details. | ||
1189 | 12 | * | ||
1190 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
1191 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1192 | 15 | */ | ||
1193 | 16 | |||
1194 | 17 | import QtQuick 2.4 | ||
1195 | 18 | import Ubuntu.Components 1.2 | ||
1196 | 19 | |||
1197 | 20 | MainView { | ||
1198 | 21 | width: units.gu(40) | ||
1199 | 22 | height: units.gu(60) | ||
1200 | 23 | Component.onCompleted: pageStack.push(page1) | ||
1201 | 24 | |||
1202 | 25 | PageStack { | ||
1203 | 26 | id: pageStack | ||
1204 | 27 | } | ||
1205 | 28 | |||
1206 | 29 | Page { | ||
1207 | 30 | id: page1 | ||
1208 | 31 | title: "one" | ||
1209 | 32 | Button { | ||
1210 | 33 | anchors.centerIn: parent | ||
1211 | 34 | text: "next" | ||
1212 | 35 | onClicked: pageStack.push(page2) | ||
1213 | 36 | } | ||
1214 | 37 | } | ||
1215 | 38 | Page { | ||
1216 | 39 | id: page2 | ||
1217 | 40 | title: "two" | ||
1218 | 41 | visible: false | ||
1219 | 42 | |||
1220 | 43 | head.backAction: Action { | ||
1221 | 44 | iconName: "back" | ||
1222 | 45 | onTriggered: pageStack.pop() | ||
1223 | 46 | } | ||
1224 | 47 | } | ||
1225 | 48 | } | ||
1226 | 0 | 49 | ||
1227 | === modified file 'tests/tests.pro' | |||
1228 | --- tests/tests.pro 2015-05-20 14:47:16 +0000 | |||
1229 | +++ tests/tests.pro 2015-09-22 15:57:54 +0000 | |||
1230 | @@ -4,8 +4,6 @@ | |||
1231 | 4 | autopilot_module.path = /usr/lib/python3/dist-packages/ubuntuuitoolkit | 4 | autopilot_module.path = /usr/lib/python3/dist-packages/ubuntuuitoolkit |
1232 | 5 | autopilot_module.files = autopilot/ubuntuuitoolkit/* | 5 | autopilot_module.files = autopilot/ubuntuuitoolkit/* |
1233 | 6 | 6 | ||
1234 | 7 | SUBDIRS += launcher | ||
1235 | 8 | |||
1236 | 9 | SUBDIRS += apicheck | 7 | SUBDIRS += apicheck |
1237 | 10 | 8 | ||
1238 | 11 | INSTALLS += autopilot_module | 9 | INSTALLS += autopilot_module |
1239 | 12 | 10 | ||
1240 | === modified file 'tests/uitk_test_plan.sh' | |||
1241 | --- tests/uitk_test_plan.sh 2015-07-13 08:04:32 +0000 | |||
1242 | +++ tests/uitk_test_plan.sh 2015-09-22 15:57:54 +0000 | |||
1243 | @@ -32,7 +32,7 @@ | |||
1244 | 32 | SERIES="vivid" | 32 | SERIES="vivid" |
1245 | 33 | CHANNEL="ubuntu-touch/rc-proposed/${DISTRO}" | 33 | CHANNEL="ubuntu-touch/rc-proposed/${DISTRO}" |
1246 | 34 | PASSWORD="0000" | 34 | PASSWORD="0000" |
1248 | 35 | BOOTTIME=500 | 35 | BOOTTIME=250 |
1249 | 36 | ONLYCOMPARE=false | 36 | ONLYCOMPARE=false |
1250 | 37 | DISTUPGRADE=false | 37 | DISTUPGRADE=false |
1251 | 38 | BOOTSTRAP=false | 38 | BOOTSTRAP=false |
1252 | @@ -56,7 +56,7 @@ | |||
1253 | 56 | # comment out if filemanager AP:s broken | 56 | # comment out if filemanager AP:s broken |
1254 | 57 | # " filemanager" | 57 | # " filemanager" |
1255 | 58 | # " ubuntu_terminal_app" | 58 | # " ubuntu_terminal_app" |
1257 | 59 | " -n unity8" | 59 | # " -n unity8" |
1258 | 60 | " ubuntu_clock_app" | 60 | " ubuntu_clock_app" |
1259 | 61 | # " -p dialer-app-autopilot dialer_app" | 61 | # " -p dialer-app-autopilot dialer_app" |
1260 | 62 | # " -p reminders-app-autopilot reminders" | 62 | # " -p reminders-app-autopilot reminders" |
1261 | @@ -78,7 +78,7 @@ | |||
1262 | 78 | reminders-app-autopilot \ | 78 | reminders-app-autopilot \ |
1263 | 79 | address-book-app-autopilot \ | 79 | address-book-app-autopilot \ |
1264 | 80 | # messaging-app-autopilot \ | 80 | # messaging-app-autopilot \ |
1266 | 81 | unity8-autopilot \ | 81 | # unity8-autopilot \ |
1267 | 82 | dialer-app-autopilot \ | 82 | dialer-app-autopilot \ |
1268 | 83 | camera-app-autopilot \ | 83 | camera-app-autopilot \ |
1269 | 84 | webbrowser-app-autopilot \ | 84 | webbrowser-app-autopilot \ |
1270 | @@ -89,6 +89,12 @@ | |||
1271 | 89 | ubuntu-system-settings-online-accounts-autopilot" | 89 | ubuntu-system-settings-online-accounts-autopilot" |
1272 | 90 | # messaging-app-autopilot \ | 90 | # messaging-app-autopilot \ |
1273 | 91 | 91 | ||
1274 | 92 | declare -a UNREGISTERED_APPS=( | ||
1275 | 93 | "com.ubuntu.terminal" | ||
1276 | 94 | "com.ubuntu.calculator" | ||
1277 | 95 | "com.ubuntu.shorts" | ||
1278 | 96 | ) | ||
1279 | 97 | |||
1280 | 92 | fatal_failure () { | 98 | fatal_failure () { |
1281 | 93 | echo -e "\e[31mFailed operation:\e[0m $1" | 99 | echo -e "\e[31mFailed operation:\e[0m $1" |
1282 | 94 | exit | 100 | exit |
1283 | @@ -178,10 +184,13 @@ | |||
1284 | 178 | network | 184 | network |
1285 | 179 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S reboot 2>&1|grep -v password" | 185 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S reboot 2>&1|grep -v password" |
1286 | 180 | sleep_indicator 120 | 186 | sleep_indicator 120 |
1291 | 181 | # Required for at least rtm-14.09/mako, phablet-click-test-setup fails otherwise and we don't need terminal | 187 | # Unregister few apps as they break phablet-click-test-setup or something else |
1292 | 182 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S click unregister com.ubuntu.terminal 2>&1|grep -v password" | 188 | echo -e "Unregister few apps" |
1293 | 183 | # Enable if calculator AP:s broken, to prevent phablet-click-test-setup trying to check out its tests. | 189 | for APP_TO_UNREGISTER in "${UNREGISTERED_APPS[@]}" |
1294 | 184 | #adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S click unregister com.ubuntu.calculator 2>&1|grep -v password" | 190 | do |
1295 | 191 | echo -e "\e[31m${APP_TO_UNREGISTER}\e[0m" | ||
1296 | 192 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S click unregister ${APP_TO_UNREGISTER} 2>&1|grep -v password" | ||
1297 | 193 | done | ||
1298 | 185 | echo -e "phablet-click-test-setup \e[31m${DISTRO} ${SERIES}\e[0m" | 194 | echo -e "phablet-click-test-setup \e[31m${DISTRO} ${SERIES}\e[0m" |
1299 | 186 | phablet-click-test-setup -s ${SERIALNUMBER} --distribution=${DISTRO} --series=${SERIES} 2>&1 || fatal_failure "phablet-click-test-setup has failed" | 195 | phablet-click-test-setup -s ${SERIALNUMBER} --distribution=${DISTRO} --series=${SERIES} 2>&1 || fatal_failure "phablet-click-test-setup has failed" |
1300 | 187 | echo "Sleep after phablet-click-test-setup"; | 196 | echo "Sleep after phablet-click-test-setup"; |
1301 | @@ -200,6 +209,9 @@ | |||
1302 | 200 | network | 209 | network |
1303 | 201 | # TODO: hide the sudo output | 210 | # TODO: hide the sudo output |
1304 | 202 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/ci-train-ppa-service/landing-${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/silo-${PPA}.list' 2>&1|grep -v password > /dev/null " | 211 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/ci-train-ppa-service/landing-${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/silo-${PPA}.list' 2>&1|grep -v password > /dev/null " |
1305 | 212 | # pin up the silo | ||
1306 | 213 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo -e \"Package: *\nPin: release o=LP-PPA-ci-train-ppa-service-landing-${PPA}\nPin-Priority: 1100\" > /etc/apt/preferences.d/silo.pref' 2>&1|grep -v password > /dev/null " | ||
1307 | 214 | # Resynchronize the package index files from their sources. | ||
1308 | 203 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null" | 215 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null" |
1309 | 204 | else | 216 | else |
1310 | 205 | echo -e "Set up with the PPA \e[31m${PPA}\e[0m" | 217 | echo -e "Set up with the PPA \e[31m${PPA}\e[0m" |
1311 | @@ -208,7 +220,6 @@ | |||
1312 | 208 | network | 220 | network |
1313 | 209 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/testing-ppa.list' 2>&1|grep -v password > /dev/null" | 221 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/testing-ppa.list' 2>&1|grep -v password > /dev/null" |
1314 | 210 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null" | 222 | adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null" |
1315 | 211 | |||
1316 | 212 | fi | 223 | fi |
1317 | 213 | fi | 224 | fi |
1318 | 214 | adb -s ${SERIALNUMBER} shell rm -rf /home/phablet/autopilot/ubuntuuitoolkit | 225 | adb -s ${SERIALNUMBER} shell rm -rf /home/phablet/autopilot/ubuntuuitoolkit |
1319 | 215 | 226 | ||
1320 | === modified file 'tests/unit_x11/tst_components/ListItemTestCase.qml' | |||
1321 | --- tests/unit_x11/tst_components/ListItemTestCase.qml 2015-09-02 13:18:51 +0000 | |||
1322 | +++ tests/unit_x11/tst_components/ListItemTestCase.qml 2015-09-22 15:57:54 +0000 | |||
1323 | @@ -82,6 +82,10 @@ | |||
1324 | 82 | spyWait(); | 82 | spyWait(); |
1325 | 83 | } | 83 | } |
1326 | 84 | 84 | ||
1327 | 85 | function tugNoWait(item, x, y, dx, dy) { | ||
1328 | 86 | TestExtras.touchDrag(0, item, Qt.point(x, y), Qt.point(dx, dy)); | ||
1329 | 87 | } | ||
1330 | 88 | |||
1331 | 85 | // returns the leading or trailing panel item | 89 | // returns the leading or trailing panel item |
1332 | 86 | function panelItem(item, leading) { | 90 | function panelItem(item, leading) { |
1333 | 87 | return findInvisibleChild(item, (leading ? "ListItemPanelLeading" : "ListItemPanelTrailing")); | 91 | return findInvisibleChild(item, (leading ? "ListItemPanelLeading" : "ListItemPanelTrailing")); |
1334 | 88 | 92 | ||
1335 | === modified file 'tests/unit_x11/tst_components/ListItemTestCase13.qml' | |||
1336 | --- tests/unit_x11/tst_components/ListItemTestCase13.qml 2015-09-02 10:55:46 +0000 | |||
1337 | +++ tests/unit_x11/tst_components/ListItemTestCase13.qml 2015-09-22 15:57:54 +0000 | |||
1338 | @@ -76,12 +76,26 @@ | |||
1339 | 76 | flick(item, x, y, dx, dy, 0, 0, undefined, undefined, 100); | 76 | flick(item, x, y, dx, dy, 0, 0, undefined, undefined, 100); |
1340 | 77 | } | 77 | } |
1341 | 78 | 78 | ||
1342 | 79 | // touch swipes | ||
1343 | 80 | function swipeTouch(touchId, item, x, y, dx, dy) { | ||
1344 | 81 | setupSpy(item, "contentMovementEnded"); | ||
1345 | 82 | flickTouch(touchId, item, x, y, dx, dy, 0, 100); | ||
1346 | 83 | spyWait(); | ||
1347 | 84 | } | ||
1348 | 85 | function swipeTouchNoWait(touchId, item, x, y, dx, dy) { | ||
1349 | 86 | flickTouch(touchId, item, x, y, dx, dy, 0, 100); | ||
1350 | 87 | } | ||
1351 | 88 | |||
1352 | 79 | function tug(item, x, y, dx, dy) { | 89 | function tug(item, x, y, dx, dy) { |
1353 | 80 | setupSpy(item, "contentMovementEnded"); | 90 | setupSpy(item, "contentMovementEnded"); |
1354 | 81 | TestExtras.touchDrag(0, item, Qt.point(x, y), Qt.point(dx, dy)); | 91 | TestExtras.touchDrag(0, item, Qt.point(x, y), Qt.point(dx, dy)); |
1355 | 82 | spyWait(); | 92 | spyWait(); |
1356 | 83 | } | 93 | } |
1357 | 84 | 94 | ||
1358 | 95 | function tugNoWait(item, x, y, dx, dy) { | ||
1359 | 96 | TestExtras.touchDrag(0, item, Qt.point(x, y), Qt.point(dx, dy)); | ||
1360 | 97 | } | ||
1361 | 98 | |||
1362 | 85 | // returns the leading or trailing panel item | 99 | // returns the leading or trailing panel item |
1363 | 86 | function panelItem(item, leading) { | 100 | function panelItem(item, leading) { |
1364 | 87 | return findInvisibleChild(item, (leading ? "ListItemPanelLeading" : "ListItemPanelTrailing")); | 101 | return findInvisibleChild(item, (leading ? "ListItemPanelLeading" : "ListItemPanelTrailing")); |
1365 | 88 | 102 | ||
1366 | === renamed file 'tests/unit/tst_components/tst_actionitem.qml' => 'tests/unit_x11/tst_components/tst_actionitem.qml' | |||
1367 | --- tests/unit/tst_components/tst_actionitem.qml 2015-08-18 16:58:41 +0000 | |||
1368 | +++ tests/unit_x11/tst_components/tst_actionitem.qml 2015-09-22 15:57:54 +0000 | |||
1369 | @@ -18,86 +18,182 @@ | |||
1370 | 18 | import QtTest 1.0 | 18 | import QtTest 1.0 |
1371 | 19 | import Ubuntu.Components 1.1 | 19 | import Ubuntu.Components 1.1 |
1372 | 20 | 20 | ||
1455 | 21 | TestCase { | 21 | Item { |
1456 | 22 | name: "ActionItemAPI" | 22 | id: main |
1457 | 23 | 23 | width: units.gu(20) | |
1458 | 24 | SignalSpy { | 24 | height: units.gu(20) |
1459 | 25 | id: triggerSpy | 25 | |
1460 | 26 | target: action1 | 26 | property bool customVisible: true |
1461 | 27 | signalName: "triggered" | 27 | property bool customEnabled: true |
1462 | 28 | } | 28 | |
1463 | 29 | 29 | ActionItem { | |
1464 | 30 | function initTestCase() { | 30 | id: item1 |
1465 | 31 | compare(item1.action, null, "action is null by default") | 31 | SignalSpy { |
1466 | 32 | compare(item1.text, "", "text is empty string set by default") | 32 | id: signalSpy |
1467 | 33 | compare(item1.iconSource, "", "iconSource is empty string by default") | 33 | target: parent |
1468 | 34 | compare(item1.iconName, "", "iconSource is empty string by default") | 34 | } |
1469 | 35 | } | 35 | } |
1470 | 36 | 36 | ||
1471 | 37 | function cleanup() { | 37 | Component { |
1472 | 38 | item1.action = null; | 38 | id: dynamicItem |
1473 | 39 | triggerSpy.clear(); | 39 | ActionItem { |
1474 | 40 | } | 40 | action: action1 |
1475 | 41 | 41 | } | |
1476 | 42 | function test_action() { | 42 | } |
1477 | 43 | compare(item1.action, null,"Action is null by default") | 43 | Component { |
1478 | 44 | item1.action = action1 | 44 | id: dynamicItem2 |
1479 | 45 | compare(item1.action, action1, "Action can be set") | 45 | ActionItem { |
1480 | 46 | compare(item1.text, action1.text, "text is automatically set to action text") | 46 | action: action1 |
1481 | 47 | compare(item1.iconSource, action1.iconSource, "iconSource is automatically set to action iconSource") | 47 | visible: customVisible |
1482 | 48 | item1.triggered(null) | 48 | enabled: customEnabled |
1483 | 49 | triggerSpy.wait(400); | 49 | } |
1484 | 50 | } | 50 | } |
1485 | 51 | 51 | ||
1486 | 52 | // NOTE: This test must be run AFTER test_action(), otherwise setting the action will | 52 | Action { |
1487 | 53 | // not update the text | 53 | id: action1 |
1488 | 54 | function test_text() { | 54 | objectName: "action1" |
1489 | 55 | compare(item1.text, "", "text is empty string by default") | 55 | text: "actionText" |
1490 | 56 | var newText = "new text" | 56 | iconSource: "imageURL" |
1491 | 57 | item1.text = newText | 57 | } |
1492 | 58 | compare(item1.text, newText, "text can be set") | 58 | Action { |
1493 | 59 | item1.text = "" | 59 | id: action2 |
1494 | 60 | compare(item1.text, "", "text can be unset") | 60 | objectName: "action2" |
1495 | 61 | } | 61 | } |
1496 | 62 | 62 | ||
1497 | 63 | // NOTE: This test must be run AFTER test_action(), otherwise setting the action will | 63 | Loader { |
1498 | 64 | // will not update the iconSource | 64 | id: loader |
1499 | 65 | function test_iconSource() { | 65 | asynchronous: false |
1500 | 66 | compare(item1.iconSource, "", "iconSource is empty string by default") | 66 | } |
1501 | 67 | var newIconSource = Qt.resolvedUrl("../../../examples/ubuntu-ui-toolkit-gallery/small_avatar.png") | 67 | |
1502 | 68 | item1.iconSource = newIconSource | 68 | TestCase { |
1503 | 69 | compare(item1.iconSource, newIconSource, "iconSource can be set") | 69 | id: testCase |
1504 | 70 | item1.iconSource = "" | 70 | when: windowShown |
1505 | 71 | compare(item1.iconSource, "", "iconSource can be unset") | 71 | name: "ActionItemAPI" |
1506 | 72 | } | 72 | |
1507 | 73 | 73 | SignalSpy { | |
1508 | 74 | // NOTE: This test must be run AFTER test_action(), otherwise setting the action will | 74 | id: triggerSpy |
1509 | 75 | // will not update the iconName | 75 | target: action1 |
1510 | 76 | function test_iconName() { | 76 | signalName: "triggered" |
1511 | 77 | compare(item1.iconName, "", "iconName is empty string by default") | 77 | } |
1512 | 78 | var newIconName = "compose" | 78 | |
1513 | 79 | item1.iconName = newIconName | 79 | function initTestCase() { |
1514 | 80 | compare(item1.iconName, newIconName, "iconName can be set") | 80 | compare(item1.action, null, "action is null by default") |
1515 | 81 | item1.iconName = "" | 81 | compare(item1.text, "", "text is empty string set by default") |
1516 | 82 | compare(item1.iconName, "", "iconName can be unset") | 82 | compare(item1.iconSource, "", "iconSource is empty string by default") |
1517 | 83 | } | 83 | compare(item1.iconName, "", "iconSource is empty string by default") |
1518 | 84 | 84 | } | |
1519 | 85 | function test_signal_triggered() { | 85 | |
1520 | 86 | signalSpy.signalName = "triggered"; | 86 | function cleanup() { |
1521 | 87 | compare(signalSpy.valid,true,"triggered signal exists") | 87 | loader.sourceComponent = null; |
1522 | 88 | } | 88 | item1.action = null; |
1523 | 89 | 89 | action1.visible = true; | |
1524 | 90 | ActionItem { | 90 | action1.enabled = true; |
1525 | 91 | id: item1 | 91 | action2.visible = true; |
1526 | 92 | SignalSpy { | 92 | action2.enabled = true; |
1527 | 93 | id: signalSpy | 93 | main.customEnabled = true; |
1528 | 94 | target: parent | 94 | main.customVisible = true; |
1529 | 95 | } | 95 | triggerSpy.clear(); |
1530 | 96 | } | 96 | } |
1531 | 97 | 97 | ||
1532 | 98 | Action { | 98 | function test_action() { |
1533 | 99 | id: action1 | 99 | compare(item1.action, null,"Action is null by default") |
1534 | 100 | text: "actionText" | 100 | item1.action = action1 |
1535 | 101 | iconSource: "imageURL" | 101 | compare(item1.action, action1, "Action can be set") |
1536 | 102 | } | 102 | compare(item1.text, action1.text, "text is automatically set to action text") |
1537 | 103 | compare(item1.iconSource, action1.iconSource, "iconSource is automatically set to action iconSource") | ||
1538 | 104 | item1.triggered(null) | ||
1539 | 105 | triggerSpy.wait(400); | ||
1540 | 106 | } | ||
1541 | 107 | |||
1542 | 108 | // NOTE: This test must be run AFTER test_action(), otherwise setting the action will | ||
1543 | 109 | // not update the text | ||
1544 | 110 | function test_text() { | ||
1545 | 111 | compare(item1.text, "", "text is empty string by default") | ||
1546 | 112 | var newText = "new text" | ||
1547 | 113 | item1.text = newText | ||
1548 | 114 | compare(item1.text, newText, "text can be set") | ||
1549 | 115 | item1.text = "" | ||
1550 | 116 | compare(item1.text, "", "text can be unset") | ||
1551 | 117 | } | ||
1552 | 118 | |||
1553 | 119 | // NOTE: This test must be run AFTER test_action(), otherwise setting the action will | ||
1554 | 120 | // will not update the iconSource | ||
1555 | 121 | function test_iconSource() { | ||
1556 | 122 | compare(item1.iconSource, "", "iconSource is empty string by default") | ||
1557 | 123 | var newIconSource = Qt.resolvedUrl("../../../examples/ubuntu-ui-toolkit-gallery/small_avatar.png") | ||
1558 | 124 | item1.iconSource = newIconSource | ||
1559 | 125 | compare(item1.iconSource, newIconSource, "iconSource can be set") | ||
1560 | 126 | item1.iconSource = "" | ||
1561 | 127 | compare(item1.iconSource, "", "iconSource can be unset") | ||
1562 | 128 | } | ||
1563 | 129 | |||
1564 | 130 | // NOTE: This test must be run AFTER test_action(), otherwise setting the action will | ||
1565 | 131 | // will not update the iconName | ||
1566 | 132 | function test_iconName() { | ||
1567 | 133 | compare(item1.iconName, "", "iconName is empty string by default") | ||
1568 | 134 | var newIconName = "compose" | ||
1569 | 135 | item1.iconName = newIconName | ||
1570 | 136 | compare(item1.iconName, newIconName, "iconName can be set") | ||
1571 | 137 | item1.iconName = "" | ||
1572 | 138 | compare(item1.iconName, "", "iconName can be unset") | ||
1573 | 139 | } | ||
1574 | 140 | |||
1575 | 141 | function test_signal_triggered() { | ||
1576 | 142 | signalSpy.signalName = "triggered"; | ||
1577 | 143 | compare(signalSpy.valid,true,"triggered signal exists") | ||
1578 | 144 | } | ||
1579 | 145 | |||
1580 | 146 | function test_default_bindings_visible_enabled_data() { | ||
1581 | 147 | return [ | ||
1582 | 148 | {tag: "visible", property: "visible"}, | ||
1583 | 149 | {tag: "enabled", property: "enabled"}, | ||
1584 | 150 | ]; | ||
1585 | 151 | } | ||
1586 | 152 | function test_default_bindings_visible_enabled(data) { | ||
1587 | 153 | item1.action = action1; | ||
1588 | 154 | action1[data.property] = false; | ||
1589 | 155 | compare(item1[data.property], action1[data.property], "The item1 and action1 '" + data.property + "' value differs"); | ||
1590 | 156 | } | ||
1591 | 157 | |||
1592 | 158 | function test_custom_bindings_visible_enabled_bug1495408_data() { | ||
1593 | 159 | return [ | ||
1594 | 160 | {tag: "visible", component: dynamicItem, property: "visible"}, | ||
1595 | 161 | {tag: "enabled", component: dynamicItem, property: "enabled"}, | ||
1596 | 162 | {tag: "visible binding", component: dynamicItem2, property: "visible", customProperty: "customVisible"}, | ||
1597 | 163 | {tag: "enabled binding", component: dynamicItem2, property: "enabled", customProperty: "customEnabled"}, | ||
1598 | 164 | ]; | ||
1599 | 165 | } | ||
1600 | 166 | function test_custom_bindings_visible_enabled_bug1495408(data) { | ||
1601 | 167 | loader.sourceComponent = data.component; | ||
1602 | 168 | var item = loader.item; | ||
1603 | 169 | compare(item[data.property], action1[data.property], "The item and action1 '" + data.property + "' value differs"); | ||
1604 | 170 | if (data.customProperty) { | ||
1605 | 171 | main[data.customProperty] = false; | ||
1606 | 172 | } else { | ||
1607 | 173 | item[data.property] = false; | ||
1608 | 174 | } | ||
1609 | 175 | // change the action so the internal bindings are updated | ||
1610 | 176 | item.action = action2; | ||
1611 | 177 | expectFail(data.tag, "default binding must be broken"); | ||
1612 | 178 | compare(item[data.property], item.action[data.property], "The item's and action's '" + data.property + "' value is the same"); | ||
1613 | 179 | } | ||
1614 | 180 | function test_custom_bindings_visible_enabled_reparenting_bug1495408_data() { | ||
1615 | 181 | return [ | ||
1616 | 182 | {tag: "visible binding", component: dynamicItem2, property: "visible"}, | ||
1617 | 183 | {tag: "enabled binding", component: dynamicItem2, property: "enabled"}, | ||
1618 | 184 | ]; | ||
1619 | 185 | } | ||
1620 | 186 | function test_custom_bindings_visible_enabled_reparenting_bug1495408(data) { | ||
1621 | 187 | loader.sourceComponent = dynamicItem2; | ||
1622 | 188 | var item = loader.item; | ||
1623 | 189 | compare(item[data.property], item.action[data.property], "The item and item.action '" + data.property + "' value differs"); | ||
1624 | 190 | // then reparent | ||
1625 | 191 | item.parent = item1; | ||
1626 | 192 | // change the action property | ||
1627 | 193 | |||
1628 | 194 | item.action[data.property] = false; | ||
1629 | 195 | expectFail(data.tag, "default binding must be broken"); | ||
1630 | 196 | compare(item[data.property], item.action[data.property], "The item and action2 '" + data.property + "' value is the same"); | ||
1631 | 197 | } | ||
1632 | 198 | } | ||
1633 | 103 | } | 199 | } |
1634 | 104 | 200 | ||
1635 | === modified file 'tests/unit_x11/tst_components/tst_icon.qml' | |||
1636 | --- tests/unit_x11/tst_components/tst_icon.qml 2015-03-03 13:20:06 +0000 | |||
1637 | +++ tests/unit_x11/tst_components/tst_icon.qml 2015-09-22 15:57:54 +0000 | |||
1638 | @@ -64,6 +64,11 @@ | |||
1639 | 64 | name: "Icon" | 64 | name: "Icon" |
1640 | 65 | when: windowShown | 65 | when: windowShown |
1641 | 66 | 66 | ||
1642 | 67 | SignalSpy { | ||
1643 | 68 | id: shaderSpy | ||
1644 | 69 | signalName: 'onStatusChanged' | ||
1645 | 70 | } | ||
1646 | 71 | |||
1647 | 67 | function cleanup() { | 72 | function cleanup() { |
1648 | 68 | icon2.name = ""; | 73 | icon2.name = ""; |
1649 | 69 | } | 74 | } |
1650 | @@ -93,5 +98,35 @@ | |||
1651 | 93 | "file:///usr/share/icons/suru/actions/scalable/search.svg", | 98 | "file:///usr/share/icons/suru/actions/scalable/search.svg", |
1652 | 94 | "Source of the image should equal icon2.source."); | 99 | "Source of the image should equal icon2.source."); |
1653 | 95 | } | 100 | } |
1654 | 101 | |||
1655 | 102 | function test_keyColor() { | ||
1656 | 103 | icon.visible = true; | ||
1657 | 104 | var image = findChild(icon, "image"); | ||
1658 | 105 | var shader = findChild(icon, "shader"); | ||
1659 | 106 | shaderSpy.target = shader; | ||
1660 | 107 | |||
1661 | 108 | compare(icon.name, 'search'); | ||
1662 | 109 | compare(shader.visible, false); | ||
1663 | 110 | compare(shader.status, ShaderEffect.Uncompiled) | ||
1664 | 111 | icon.color = UbuntuColors.orange; | ||
1665 | 112 | shaderSpy.wait(); | ||
1666 | 113 | compare(shader.status, ShaderEffect.Compiled) | ||
1667 | 114 | compare(shader.keyColorOut, icon.color); | ||
1668 | 115 | compare(shader.visible, true); | ||
1669 | 116 | compare(shader.source, image); | ||
1670 | 117 | icon.keyColor = UbuntuColors.purple; | ||
1671 | 118 | compare(shader.keyColorIn, icon.keyColor); | ||
1672 | 119 | // Unsetting the icon name should disable the shader | ||
1673 | 120 | icon.name = ''; | ||
1674 | 121 | compare(icon.source, ''); | ||
1675 | 122 | compare(shader.visible, false); | ||
1676 | 123 | // Let's get back to a valid source | ||
1677 | 124 | icon.name = 'search'; | ||
1678 | 125 | compare(shader.visible, true); | ||
1679 | 126 | compare(shader.source, image); | ||
1680 | 127 | // Unsetting the keyColor should also disable the shader | ||
1681 | 128 | icon.color = Qt.rgba(0.0, 0.0, 0.0, 0.0); | ||
1682 | 129 | compare(shader.visible, false); | ||
1683 | 130 | } | ||
1684 | 96 | } | 131 | } |
1685 | 97 | } | 132 | } |
1686 | 98 | 133 | ||
1687 | === modified file 'tests/unit_x11/tst_components/tst_listitem.qml' | |||
1688 | --- tests/unit_x11/tst_components/tst_listitem.qml 2015-09-02 06:47:25 +0000 | |||
1689 | +++ tests/unit_x11/tst_components/tst_listitem.qml 2015-09-22 15:57:54 +0000 | |||
1690 | @@ -198,8 +198,8 @@ | |||
1691 | 198 | signalName: "onTriggered" | 198 | signalName: "onTriggered" |
1692 | 199 | } | 199 | } |
1693 | 200 | SignalSpy { | 200 | SignalSpy { |
1696 | 201 | id: interactiveSpy | 201 | id: flickableSpy |
1697 | 202 | signalName: "interactiveChanged" | 202 | signalName: "movementStarted" |
1698 | 203 | } | 203 | } |
1699 | 204 | 204 | ||
1700 | 205 | SignalSpy { | 205 | SignalSpy { |
1701 | @@ -227,7 +227,7 @@ | |||
1702 | 227 | actionSpy.clear(); | 227 | actionSpy.clear(); |
1703 | 228 | pressAndHoldSpy.clear(); | 228 | pressAndHoldSpy.clear(); |
1704 | 229 | buttonSpy.clear(); | 229 | buttonSpy.clear(); |
1706 | 230 | interactiveSpy.clear(); | 230 | flickableSpy.clear(); |
1707 | 231 | listView.interactive = true; | 231 | listView.interactive = true; |
1708 | 232 | listView.ViewItems.selectMode = false; | 232 | listView.ViewItems.selectMode = false; |
1709 | 233 | listView.ViewItems.dragMode = false; | 233 | listView.ViewItems.dragMode = false; |
1710 | @@ -235,8 +235,8 @@ | |||
1711 | 235 | mouseClick(defaults, 0, 0) | 235 | mouseClick(defaults, 0, 0) |
1712 | 236 | movingSpy.target = null; | 236 | movingSpy.target = null; |
1713 | 237 | movingSpy.clear(); | 237 | movingSpy.clear(); |
1716 | 238 | interactiveSpy.target = null; | 238 | flickableSpy.target = null; |
1717 | 239 | interactiveSpy.clear(); | 239 | flickableSpy.clear(); |
1718 | 240 | trailing.delegate = null; | 240 | trailing.delegate = null; |
1719 | 241 | listView.positionViewAtBeginning(); | 241 | listView.positionViewAtBeginning(); |
1720 | 242 | // keep additional timeout for proper cleanup | 242 | // keep additional timeout for proper cleanup |
1721 | @@ -434,6 +434,7 @@ | |||
1722 | 434 | rebound(data.clickOn, data.item) | 434 | rebound(data.clickOn, data.item) |
1723 | 435 | } | 435 | } |
1724 | 436 | 436 | ||
1725 | 437 | // the function tests whether the Flickable/ListView moves when the ListItem is swiped | ||
1726 | 437 | function test_listview_not_interactive_while_tugged_data() { | 438 | function test_listview_not_interactive_while_tugged_data() { |
1727 | 438 | var item0 = findChild(listView, "listItem0"); | 439 | var item0 = findChild(listView, "listItem0"); |
1728 | 439 | var item1 = findChild(listView, "listItem1"); | 440 | var item1 = findChild(listView, "listItem1"); |
1729 | @@ -446,17 +447,15 @@ | |||
1730 | 446 | } | 447 | } |
1731 | 447 | function test_listview_not_interactive_while_tugged(data) { | 448 | function test_listview_not_interactive_while_tugged(data) { |
1732 | 448 | listView.positionViewAtBeginning(); | 449 | listView.positionViewAtBeginning(); |
1734 | 449 | interactiveSpy.target = listView; | 450 | flickableSpy.target = listView; |
1735 | 450 | compare(listView.interactive, true, "ListView is not interactive"); | 451 | compare(listView.interactive, true, "ListView is not interactive"); |
1736 | 451 | interactiveSpy.target = listView; | ||
1737 | 452 | if (data.mouse) { | 452 | if (data.mouse) { |
1739 | 453 | swipe(data.item, data.pos.x, data.pos.y, data.dx, data.dy); | 453 | swipe(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5)); |
1740 | 454 | } else { | 454 | } else { |
1742 | 455 | tug(data.item, data.pos.x, data.pos.y, data.dx, data.dy); | 455 | tug(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5)); |
1743 | 456 | } | 456 | } |
1744 | 457 | // animation should no longer be running! | 457 | // animation should no longer be running! |
1747 | 458 | compare(listView.interactive, true, "The ListView is still non-interactive!"); | 458 | compare(flickableSpy.count, 0, "Flickable moved!"); |
1746 | 459 | compare(interactiveSpy.count, 2, "Less/more times changed!"); | ||
1748 | 460 | // check if it snapped in | 459 | // check if it snapped in |
1749 | 461 | verify(data.item.contentItem.x != 0.0, "Not snapped in!!"); | 460 | verify(data.item.contentItem.x != 0.0, "Not snapped in!!"); |
1750 | 462 | // dismiss | 461 | // dismiss |
1751 | @@ -629,7 +628,7 @@ | |||
1752 | 629 | wait(2000); | 628 | wait(2000); |
1753 | 630 | verify(data.item.contentItem.x != data.item.contentItem.anchors.leftMargin, "Not snapped in"); | 629 | verify(data.item.contentItem.x != data.item.contentItem.anchors.leftMargin, "Not snapped in"); |
1754 | 631 | 630 | ||
1756 | 632 | var panel = panelItem(data.item, "Leading"); | 631 | var panel = panelItem(data.item, true); |
1757 | 633 | var action = findChild(panel, "leading_2"); | 632 | var action = findChild(panel, "leading_2"); |
1758 | 634 | verify(action, "actions panel cannot be reached"); | 633 | verify(action, "actions panel cannot be reached"); |
1759 | 635 | // we test the action closest to the list item's contentItem | 634 | // we test the action closest to the list item's contentItem |
1760 | @@ -724,11 +723,12 @@ | |||
1761 | 724 | function test_listitem_blocks_ascendant_flickables() { | 723 | function test_listitem_blocks_ascendant_flickables() { |
1762 | 725 | var listItem = findChild(nestedListView, "listItem0"); | 724 | var listItem = findChild(nestedListView, "listItem0"); |
1763 | 726 | verify(listItem, "Cannot find test item"); | 725 | verify(listItem, "Cannot find test item"); |
1765 | 727 | interactiveSpy.target = testFlickable; | 726 | flickableSpy.target = testFlickable; |
1766 | 728 | // tug leading | 727 | // tug leading |
1767 | 729 | swipe(listItem, centerOf(listItem).x, centerOf(listItem).y, listItem.width / 2, 0); | 728 | swipe(listItem, centerOf(listItem).x, centerOf(listItem).y, listItem.width / 2, 0); |
1768 | 730 | // check if interactive got changed | 729 | // check if interactive got changed |
1770 | 731 | interactiveSpy.wait(); | 730 | expectFailContinue("", "Flickable should not move"); |
1771 | 731 | flickableSpy.wait(200); | ||
1772 | 732 | 732 | ||
1773 | 733 | // cleanup!!! | 733 | // cleanup!!! |
1774 | 734 | rebound(listItem); | 734 | rebound(listItem); |
1775 | 735 | 735 | ||
1776 | === modified file 'tests/unit_x11/tst_components/tst_listitem13.qml' | |||
1777 | --- tests/unit_x11/tst_components/tst_listitem13.qml 2015-09-02 10:55:46 +0000 | |||
1778 | +++ tests/unit_x11/tst_components/tst_listitem13.qml 2015-09-22 15:57:54 +0000 | |||
1779 | @@ -198,8 +198,8 @@ | |||
1780 | 198 | signalName: "onTriggered" | 198 | signalName: "onTriggered" |
1781 | 199 | } | 199 | } |
1782 | 200 | SignalSpy { | 200 | SignalSpy { |
1785 | 201 | id: interactiveSpy | 201 | id: flickableSpy |
1786 | 202 | signalName: "interactiveChanged" | 202 | signalName: "movementStarted" |
1787 | 203 | } | 203 | } |
1788 | 204 | 204 | ||
1789 | 205 | SignalSpy { | 205 | SignalSpy { |
1790 | @@ -227,7 +227,7 @@ | |||
1791 | 227 | actionSpy.clear(); | 227 | actionSpy.clear(); |
1792 | 228 | pressAndHoldSpy.clear(); | 228 | pressAndHoldSpy.clear(); |
1793 | 229 | buttonSpy.clear(); | 229 | buttonSpy.clear(); |
1795 | 230 | interactiveSpy.clear(); | 230 | flickableSpy.clear(); |
1796 | 231 | listView.interactive = true; | 231 | listView.interactive = true; |
1797 | 232 | listView.ViewItems.selectMode = false; | 232 | listView.ViewItems.selectMode = false; |
1798 | 233 | listView.ViewItems.dragMode = false; | 233 | listView.ViewItems.dragMode = false; |
1799 | @@ -235,8 +235,8 @@ | |||
1800 | 235 | mouseClick(defaults, 0, 0) | 235 | mouseClick(defaults, 0, 0) |
1801 | 236 | movingSpy.target = null; | 236 | movingSpy.target = null; |
1802 | 237 | movingSpy.clear(); | 237 | movingSpy.clear(); |
1805 | 238 | interactiveSpy.target = null; | 238 | flickableSpy.target = null; |
1806 | 239 | interactiveSpy.clear(); | 239 | flickableSpy.clear(); |
1807 | 240 | trailing.delegate = null; | 240 | trailing.delegate = null; |
1808 | 241 | listView.positionViewAtBeginning(); | 241 | listView.positionViewAtBeginning(); |
1809 | 242 | // keep additional timeout for proper cleanup | 242 | // keep additional timeout for proper cleanup |
1810 | @@ -466,17 +466,15 @@ | |||
1811 | 466 | } | 466 | } |
1812 | 467 | function test_listview_not_interactive_while_tugged(data) { | 467 | function test_listview_not_interactive_while_tugged(data) { |
1813 | 468 | listView.positionViewAtBeginning(); | 468 | listView.positionViewAtBeginning(); |
1815 | 469 | interactiveSpy.target = listView; | 469 | flickableSpy.target = listView; |
1816 | 470 | compare(listView.interactive, true, "ListView is not interactive"); | 470 | compare(listView.interactive, true, "ListView is not interactive"); |
1817 | 471 | interactiveSpy.target = listView; | ||
1818 | 472 | if (data.mouse) { | 471 | if (data.mouse) { |
1820 | 473 | swipe(data.item, data.pos.x, data.pos.y, data.dx, data.dy); | 472 | swipe(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5)); |
1821 | 474 | } else { | 473 | } else { |
1823 | 475 | tug(data.item, data.pos.x, data.pos.y, data.dx, data.dy); | 474 | tug(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5)); |
1824 | 476 | } | 475 | } |
1825 | 477 | // animation should no longer be running! | 476 | // animation should no longer be running! |
1828 | 478 | compare(listView.interactive, true, "The ListView is still non-interactive!"); | 477 | compare(flickableSpy.count, 0, "Flickable moved!"); |
1827 | 479 | compare(interactiveSpy.count, 2, "Less/more times changed!"); | ||
1829 | 480 | // check if it snapped in | 478 | // check if it snapped in |
1830 | 481 | verify(data.item.contentItem.x != 0.0, "Not snapped in!!"); | 479 | verify(data.item.contentItem.x != 0.0, "Not snapped in!!"); |
1831 | 482 | // dismiss | 480 | // dismiss |
1832 | @@ -744,11 +742,12 @@ | |||
1833 | 744 | function test_listitem_blocks_ascendant_flickables() { | 742 | function test_listitem_blocks_ascendant_flickables() { |
1834 | 745 | var listItem = findChild(nestedListView, "listItem0"); | 743 | var listItem = findChild(nestedListView, "listItem0"); |
1835 | 746 | verify(listItem, "Cannot find test item"); | 744 | verify(listItem, "Cannot find test item"); |
1837 | 747 | interactiveSpy.target = testFlickable; | 745 | flickableSpy.target = testFlickable; |
1838 | 748 | // tug leading | 746 | // tug leading |
1839 | 749 | swipe(listItem, centerOf(listItem).x, centerOf(listItem).y, listItem.width / 2, 0); | 747 | swipe(listItem, centerOf(listItem).x, centerOf(listItem).y, listItem.width / 2, 0); |
1840 | 750 | // check if interactive got changed | 748 | // check if interactive got changed |
1842 | 751 | interactiveSpy.wait(); | 749 | expectFailContinue("", "Flickable should not move."); |
1843 | 750 | flickableSpy.wait(200); | ||
1844 | 752 | 751 | ||
1845 | 753 | // cleanup!!! | 752 | // cleanup!!! |
1846 | 754 | rebound(listItem); | 753 | rebound(listItem); |
1847 | @@ -1200,7 +1199,7 @@ | |||
1848 | 1200 | 1199 | ||
1849 | 1201 | var icon = findChild(testItem, data.action); | 1200 | var icon = findChild(testItem, data.action); |
1850 | 1202 | verify(icon); | 1201 | verify(icon); |
1852 | 1203 | compare(icon.width, units.gu(5), "icon width should be the same no matter of the height set"); | 1202 | compare(icon.width, units.gu(6), "icon width should be the same no matter of the height set"); |
1853 | 1204 | 1203 | ||
1854 | 1205 | rebound(testItem); | 1204 | rebound(testItem); |
1855 | 1206 | 1205 | ||
1856 | 1207 | 1206 | ||
1857 | === modified file 'tests/unit_x11/tst_components/tst_listitem_extras.qml' | |||
1858 | --- tests/unit_x11/tst_components/tst_listitem_extras.qml 2015-09-02 10:55:46 +0000 | |||
1859 | +++ tests/unit_x11/tst_components/tst_listitem_extras.qml 2015-09-22 15:57:54 +0000 | |||
1860 | @@ -30,18 +30,18 @@ | |||
1861 | 30 | Action { | 30 | Action { |
1862 | 31 | iconName: "starred" | 31 | iconName: "starred" |
1863 | 32 | text: 'Bookmark' | 32 | text: 'Bookmark' |
1865 | 33 | objectName: "leading_1" | 33 | objectName: "trailing1" |
1866 | 34 | }, | 34 | }, |
1867 | 35 | Action { | 35 | Action { |
1868 | 36 | iconName: "edit" | 36 | iconName: "edit" |
1869 | 37 | text: 'Edit' | 37 | text: 'Edit' |
1871 | 38 | objectName: "leading_2" | 38 | objectName: "trailing2" |
1872 | 39 | onTriggered: text = 'Edit Again' | 39 | onTriggered: text = 'Edit Again' |
1873 | 40 | }, | 40 | }, |
1874 | 41 | Action { | 41 | Action { |
1875 | 42 | iconName: "camcorder" | 42 | iconName: "camcorder" |
1876 | 43 | text: 'Record' | 43 | text: 'Record' |
1878 | 44 | objectName: "leading_3" | 44 | objectName: "trailing3" |
1879 | 45 | } | 45 | } |
1880 | 46 | ] | 46 | ] |
1881 | 47 | } | 47 | } |
1882 | @@ -50,7 +50,7 @@ | |||
1883 | 50 | actions: Action { | 50 | actions: Action { |
1884 | 51 | id: stockAction | 51 | id: stockAction |
1885 | 52 | iconName: "torch-on" | 52 | iconName: "torch-on" |
1887 | 53 | objectName: "stockAction" | 53 | objectName: "leading1" |
1888 | 54 | text: 'Switch lights on' | 54 | text: 'Switch lights on' |
1889 | 55 | } | 55 | } |
1890 | 56 | } | 56 | } |
1891 | @@ -80,6 +80,22 @@ | |||
1892 | 80 | onPressed: mouse.accepted = overlaidMouseArea.acceptEvent | 80 | onPressed: mouse.accepted = overlaidMouseArea.acceptEvent |
1893 | 81 | } | 81 | } |
1894 | 82 | } | 82 | } |
1895 | 83 | ListView { | ||
1896 | 84 | id: listView | ||
1897 | 85 | width: parent.width | ||
1898 | 86 | height: 4 * units.gu(7) // 4 items | ||
1899 | 87 | clip: true | ||
1900 | 88 | model: 5 | ||
1901 | 89 | delegate: ListItem { | ||
1902 | 90 | objectName: "listItem" + index | ||
1903 | 91 | Label { | ||
1904 | 92 | anchors.centerIn: parent | ||
1905 | 93 | text: index | ||
1906 | 94 | } | ||
1907 | 95 | |||
1908 | 96 | leadingActions: leading | ||
1909 | 97 | } | ||
1910 | 98 | } | ||
1911 | 83 | } | 99 | } |
1912 | 84 | 100 | ||
1913 | 85 | ListItemTestCase13 { | 101 | ListItemTestCase13 { |
1914 | @@ -89,11 +105,16 @@ | |||
1915 | 89 | signalName: "clicked" | 105 | signalName: "clicked" |
1916 | 90 | } | 106 | } |
1917 | 91 | 107 | ||
1918 | 108 | function initTestCase() { | ||
1919 | 109 | TestExtras.registerTouchDevice(); | ||
1920 | 110 | } | ||
1921 | 111 | |||
1922 | 92 | function cleanup() { | 112 | function cleanup() { |
1923 | 93 | rebound(testWithActiveItem); | 113 | rebound(testWithActiveItem); |
1924 | 94 | rebound(overlaidMouseArea); | 114 | rebound(overlaidMouseArea); |
1925 | 95 | clickSpy.target = null; | 115 | clickSpy.target = null; |
1926 | 96 | clickSpy.clear(); | 116 | clickSpy.clear(); |
1927 | 117 | wait(200); | ||
1928 | 97 | } | 118 | } |
1929 | 98 | 119 | ||
1930 | 99 | function test_swipe_over_active_item() { | 120 | function test_swipe_over_active_item() { |
1931 | @@ -114,5 +135,116 @@ | |||
1932 | 114 | swipeNoWait(overlayArea, centerOf(overlayArea).x, centerOf(overlayArea).y, units.gu(10)); | 135 | swipeNoWait(overlayArea, centerOf(overlayArea).x, centerOf(overlayArea).y, units.gu(10)); |
1933 | 115 | spyWait(); | 136 | spyWait(); |
1934 | 116 | } | 137 | } |
1935 | 138 | |||
1936 | 139 | function test_swipe_out_from_overlay_button_bug1497156_data() { | ||
1937 | 140 | return [ | ||
1938 | 141 | {tag: "leading with mouse", touch: false, swipeInDx: units.gu(20), swipeOutDx: -units.gu(5)}, | ||
1939 | 142 | {tag: "trailing with mouse", touch: false, swipeInDx: -units.gu(20), swipeOutDx: units.gu(5)}, | ||
1940 | 143 | {tag: "leading with touch", touch: true, swipeInDx: units.gu(20), swipeOutDx: -units.gu(5)}, | ||
1941 | 144 | {tag: "trailing with touch", touch: true, swipeInDx: -units.gu(20), swipeOutDx: units.gu(5)}, | ||
1942 | 145 | ] | ||
1943 | 146 | } | ||
1944 | 147 | function test_swipe_out_from_overlay_button_bug1497156(data) { | ||
1945 | 148 | // swipe in and out from teh same point | ||
1946 | 149 | if (data.touch) { | ||
1947 | 150 | tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeInDx, 0); | ||
1948 | 151 | } else { | ||
1949 | 152 | swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeInDx, 0); | ||
1950 | 153 | } | ||
1951 | 154 | verify(testWithActiveItem.contentItem.x != 0, "Not swiped in"); | ||
1952 | 155 | // swipe out | ||
1953 | 156 | if (data.touch) { | ||
1954 | 157 | tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeOutDx, 0); | ||
1955 | 158 | } else { | ||
1956 | 159 | swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeOutDx, 0); | ||
1957 | 160 | } | ||
1958 | 161 | tryCompareFunction(function() { | ||
1959 | 162 | return testWithActiveItem.contentItem.x == testWithActiveItem.contentItem.anchors.leftMargin; | ||
1960 | 163 | }, true, 500); | ||
1961 | 164 | } | ||
1962 | 165 | |||
1963 | 166 | function test_swipe_over_contextual_actions_bug1486008_data() { | ||
1964 | 167 | return [ | ||
1965 | 168 | {tag: "leading action with mouse", touch: false, dx: units.gu(20), leadingPanel: true, action: "leading1"}, | ||
1966 | 169 | {tag: "trailing action with mouse", touch: false, dx: -units.gu(20), leadingPanel: false, action: "trailing1"}, | ||
1967 | 170 | {tag: "leading action with touch", touch: true, dx: units.gu(20), leadingPanel: true, action: "leading1"}, | ||
1968 | 171 | {tag: "trailing action with touch", touch: true, dx: -units.gu(20), leadingPanel: false, action: "trailing1"}, | ||
1969 | 172 | ]; | ||
1970 | 173 | } | ||
1971 | 174 | function test_swipe_over_contextual_actions_bug1486008(data) { | ||
1972 | 175 | if (data.touch) { | ||
1973 | 176 | tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0); | ||
1974 | 177 | } else { | ||
1975 | 178 | swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0); | ||
1976 | 179 | } | ||
1977 | 180 | var panel = panelItem(testWithActiveItem, data.leadingPanel); | ||
1978 | 181 | var actionItem = findChild(panel, data.action); | ||
1979 | 182 | verify(actionItem, data.action + " action not found."); | ||
1980 | 183 | // swipe over the action | ||
1981 | 184 | setupSpy(testWithActiveItem, "contentMovementStarted"); | ||
1982 | 185 | if (data.touch) { | ||
1983 | 186 | tugNoWait(actionItem, centerOf(actionItem).x, centerOf(actionItem).y, -data.dx, 0); | ||
1984 | 187 | } else { | ||
1985 | 188 | swipeNoWait(actionItem, centerOf(actionItem).x, centerOf(actionItem).y, -data.dx, 0); | ||
1986 | 189 | } | ||
1987 | 190 | expectFail(data.tag, "should not swipe"); | ||
1988 | 191 | spyWait(); | ||
1989 | 192 | } | ||
1990 | 193 | |||
1991 | 194 | function test_button_inactive_while_swiped_data() { | ||
1992 | 195 | return [ | ||
1993 | 196 | {tag: "mouse", touch: false, dx: units.gu(20)}, | ||
1994 | 197 | {tag: "touch", touch: true, dx: units.gu(20)}, | ||
1995 | 198 | ]; | ||
1996 | 199 | } | ||
1997 | 200 | function test_button_inactive_while_swiped(data) { | ||
1998 | 201 | clickSpy.target = activeItem; | ||
1999 | 202 | if (data.touch) { | ||
2000 | 203 | tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0); | ||
2001 | 204 | TestExtras.touchClick(0, activeItem, centerOf(activeItem)); | ||
2002 | 205 | } else { | ||
2003 | 206 | swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0); | ||
2004 | 207 | mouseClick(activeItem, centerOf(activeItem).x, centerOf(activeItem).y); | ||
2005 | 208 | } | ||
2006 | 209 | expectFail(data.tag, "Button is inactive while swiped"); | ||
2007 | 210 | clickSpy.wait(200); | ||
2008 | 211 | } | ||
2009 | 212 | |||
2010 | 213 | function test_click_before_and_after_snapout_bug1496468_data() { | ||
2011 | 214 | var item0 = findChild(listView, "listItem0"); | ||
2012 | 215 | var item1 = findChild(listView, "listItem1"); | ||
2013 | 216 | return [ | ||
2014 | 217 | {tag: "mouse", touch: false, clickedItem: item0, swipedItem: item1, dx: units.gu(20), reboundDx: -units.gu(5)}, | ||
2015 | 218 | {tag: "touch", touch: true, clickedItem: item0, swipedItem: item1, dx: units.gu(20), reboundDx: -units.gu(5)}, | ||
2016 | 219 | ]; | ||
2017 | 220 | } | ||
2018 | 221 | function test_click_before_and_after_snapout_bug1496468(data) { | ||
2019 | 222 | clickSpy.target = data.clickedItem; | ||
2020 | 223 | if (data.touch) { | ||
2021 | 224 | TestExtras.touchClick(0, data.clickedItem, centerOf(data.clickedItem)); | ||
2022 | 225 | } else { | ||
2023 | 226 | mouseClick(data.clickedItem, centerOf(data.clickedItem).x, centerOf(data.clickedItem).y); | ||
2024 | 227 | } | ||
2025 | 228 | clickSpy.wait(200); | ||
2026 | 229 | // swipe in then rebound | ||
2027 | 230 | if (data.touch) { | ||
2028 | 231 | tug(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.dx, 0); | ||
2029 | 232 | wait(200); | ||
2030 | 233 | tug(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.reboundDx, 0); | ||
2031 | 234 | } else { | ||
2032 | 235 | swipe(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.dx, 0); | ||
2033 | 236 | wait(200); | ||
2034 | 237 | swipe(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.reboundDx, 0); | ||
2035 | 238 | } | ||
2036 | 239 | // then test click | ||
2037 | 240 | clickSpy.target = data.swipedItem; | ||
2038 | 241 | clickSpy.clear(); | ||
2039 | 242 | if (data.touch) { | ||
2040 | 243 | TestExtras.touchClick(0, data.swipedItem, centerOf(data.swipedItem)); | ||
2041 | 244 | } else { | ||
2042 | 245 | mouseClick(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y); | ||
2043 | 246 | } | ||
2044 | 247 | clickSpy.wait(200); | ||
2045 | 248 | } | ||
2046 | 117 | } | 249 | } |
2047 | 118 | } | 250 | } |
2048 | 119 | 251 | ||
2049 | === modified file 'tests/unit_x11/tst_components/tst_popover.qml' | |||
2050 | --- tests/unit_x11/tst_components/tst_popover.qml 2015-03-03 13:20:06 +0000 | |||
2051 | +++ tests/unit_x11/tst_components/tst_popover.qml 2015-09-22 15:57:54 +0000 | |||
2052 | @@ -29,6 +29,11 @@ | |||
2053 | 29 | y: main.height / 2 | 29 | y: main.height / 2 |
2054 | 30 | height: units.gu(10) | 30 | height: units.gu(10) |
2055 | 31 | width: height | 31 | width: height |
2056 | 32 | MouseArea { | ||
2057 | 33 | id: whiteSpace | ||
2058 | 34 | anchors.fill: parent | ||
2059 | 35 | acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton | ||
2060 | 36 | } | ||
2061 | 32 | 37 | ||
2062 | 33 | Button { | 38 | Button { |
2063 | 34 | id: pressMe | 39 | id: pressMe |
2064 | @@ -68,6 +73,11 @@ | |||
2065 | 68 | id: popoverSpy | 73 | id: popoverSpy |
2066 | 69 | signalName: "hideCompleted" | 74 | signalName: "hideCompleted" |
2067 | 70 | } | 75 | } |
2068 | 76 | SignalSpy { | ||
2069 | 77 | id: whiteSpy | ||
2070 | 78 | signalName: "clicked" | ||
2071 | 79 | target: whiteSpace | ||
2072 | 80 | } | ||
2073 | 71 | 81 | ||
2074 | 72 | Component { | 82 | Component { |
2075 | 73 | id: popoverComponent | 83 | id: popoverComponent |
2076 | @@ -116,6 +126,29 @@ | |||
2077 | 116 | popoverSpy.wait(); | 126 | popoverSpy.wait(); |
2078 | 117 | } | 127 | } |
2079 | 118 | 128 | ||
2080 | 129 | function test_popover_consumes_clicks_bug1488540_data() { | ||
2081 | 130 | return [ | ||
2082 | 131 | { tag: 'Left-click', button: Qt.LeftButton }, | ||
2083 | 132 | { tag: 'Right-click', button: Qt.RightButton }, | ||
2084 | 133 | { tag: 'Middle-click', button: Qt.MiddleButton }, | ||
2085 | 134 | ] | ||
2086 | 135 | } | ||
2087 | 136 | function test_popover_consumes_clicks_bug1488540(data) { | ||
2088 | 137 | mouseClick(pressMe, pressMe.width / 2, pressMe.height / 2); | ||
2089 | 138 | waitForRendering(pressMe); | ||
2090 | 139 | verify(popoverSpy.target !== null, "The popover did not open"); | ||
2091 | 140 | var popover = popoverSpy.target; | ||
2092 | 141 | // Click in the popover, the rectangle doesn't handle clicks | ||
2093 | 142 | whiteSpy.clear(); | ||
2094 | 143 | mouseClick(popover, popover.width / 2, popover.height / 2, data.button); | ||
2095 | 144 | // dismiss | ||
2096 | 145 | mouseClick(main, 10, 10, Qt.LeftButton); | ||
2097 | 146 | popoverSpy.wait(); | ||
2098 | 147 | // Did the click reach through the popover foreground? | ||
2099 | 148 | compare(whiteSpy.count, 0, 'Click passed through popover foreground!'); | ||
2100 | 149 | |||
2101 | 150 | } | ||
2102 | 151 | |||
2103 | 119 | function test_popover_follows_pointerTarget_bug1199502_data() { | 152 | function test_popover_follows_pointerTarget_bug1199502_data() { |
2104 | 120 | return [ | 153 | return [ |
2105 | 121 | { tag: "Moving pointerTarget", button: pressMe, dir: "down", y: 318 }, | 154 | { tag: "Moving pointerTarget", button: pressMe, dir: "down", y: 318 }, |
2106 | 122 | 155 | ||
2107 | === added file 'tests/unit_x11/tst_components/tst_popover13.qml' | |||
2108 | --- tests/unit_x11/tst_components/tst_popover13.qml 1970-01-01 00:00:00 +0000 | |||
2109 | +++ tests/unit_x11/tst_components/tst_popover13.qml 2015-09-22 15:57:54 +0000 | |||
2110 | @@ -0,0 +1,174 @@ | |||
2111 | 1 | /* | ||
2112 | 2 | * Copyright 2014-2015 Canonical Ltd. | ||
2113 | 3 | * | ||
2114 | 4 | * This program is free software; you can redistribute it and/or modify | ||
2115 | 5 | * it under the terms of the GNU Lesser General Public License as published by | ||
2116 | 6 | * the Free Software Foundation; version 3. | ||
2117 | 7 | * | ||
2118 | 8 | * This program is distributed in the hope that it will be useful, | ||
2119 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2120 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2121 | 11 | * GNU Lesser General Public License for more details. | ||
2122 | 12 | * | ||
2123 | 13 | * You should have received a copy of the GNU Lesser General Public License | ||
2124 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
2125 | 15 | */ | ||
2126 | 16 | import QtQuick 2.0 | ||
2127 | 17 | import QtTest 1.0 | ||
2128 | 18 | import Ubuntu.Test 1.0 | ||
2129 | 19 | import Ubuntu.Components 1.3 | ||
2130 | 20 | import Ubuntu.Components.Popups 1.3 | ||
2131 | 21 | |||
2132 | 22 | MainView { | ||
2133 | 23 | id: main | ||
2134 | 24 | width: units.gu(50) | ||
2135 | 25 | height: units.gu(71) | ||
2136 | 26 | |||
2137 | 27 | Rectangle { | ||
2138 | 28 | id: rect | ||
2139 | 29 | y: main.height / 2 | ||
2140 | 30 | height: units.gu(10) | ||
2141 | 31 | width: height | ||
2142 | 32 | MouseArea { | ||
2143 | 33 | id: whiteSpace | ||
2144 | 34 | anchors.fill: parent | ||
2145 | 35 | acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton | ||
2146 | 36 | } | ||
2147 | 37 | |||
2148 | 38 | Button { | ||
2149 | 39 | id: pressMe | ||
2150 | 40 | anchors.top: parent.top | ||
2151 | 41 | text: "Press me" | ||
2152 | 42 | onClicked: { | ||
2153 | 43 | testCase.resetPositions(); | ||
2154 | 44 | var popover = PopupUtils.open(popoverComponent, pressMe); | ||
2155 | 45 | popoverSpy.target = testCase.findChild(popover, "popover_foreground"); | ||
2156 | 46 | popoverSpy.clear(); | ||
2157 | 47 | pressMe.parent.height = units.gu(25) | ||
2158 | 48 | pressMe.anchors.top = parent.bottom | ||
2159 | 49 | } | ||
2160 | 50 | } | ||
2161 | 51 | |||
2162 | 52 | Button { | ||
2163 | 53 | id: pushMe | ||
2164 | 54 | anchors.bottom: parent.bottom | ||
2165 | 55 | text: "Push me" | ||
2166 | 56 | onClicked: { | ||
2167 | 57 | testCase.resetPositions(); | ||
2168 | 58 | var popover = PopupUtils.open(popoverComponent, pushMe); | ||
2169 | 59 | popoverSpy.target = testCase.findChild(popover, "popover_foreground"); | ||
2170 | 60 | popoverSpy.clear(); | ||
2171 | 61 | rect.y = main.height / 10 | ||
2172 | 62 | } | ||
2173 | 63 | } | ||
2174 | 64 | } | ||
2175 | 65 | Label { | ||
2176 | 66 | id: other | ||
2177 | 67 | text: "Ignore me" | ||
2178 | 68 | anchors.centerIn: parent | ||
2179 | 69 | } | ||
2180 | 70 | |||
2181 | 71 | // spy to listen on the popover foreground's hideCompleted() signal | ||
2182 | 72 | SignalSpy { | ||
2183 | 73 | id: popoverSpy | ||
2184 | 74 | signalName: "hideCompleted" | ||
2185 | 75 | } | ||
2186 | 76 | SignalSpy { | ||
2187 | 77 | id: whiteSpy | ||
2188 | 78 | signalName: "clicked" | ||
2189 | 79 | target: whiteSpace | ||
2190 | 80 | } | ||
2191 | 81 | |||
2192 | 82 | Component { | ||
2193 | 83 | id: popoverComponent | ||
2194 | 84 | Popover { | ||
2195 | 85 | objectName: "popover" | ||
2196 | 86 | Rectangle { | ||
2197 | 87 | width: units.gu(20) | ||
2198 | 88 | height: units.gu(20) | ||
2199 | 89 | color: "blue" | ||
2200 | 90 | } | ||
2201 | 91 | } | ||
2202 | 92 | } | ||
2203 | 93 | |||
2204 | 94 | UbuntuTestCase { | ||
2205 | 95 | id: testCase | ||
2206 | 96 | name: "PopoverTests" | ||
2207 | 97 | when: windowShown | ||
2208 | 98 | |||
2209 | 99 | function resetPositions() { | ||
2210 | 100 | pressMe.parent.height = units.gu(10) | ||
2211 | 101 | rect.y = main.height / 2 | ||
2212 | 102 | } | ||
2213 | 103 | |||
2214 | 104 | function cleanup() { | ||
2215 | 105 | resetPositions() | ||
2216 | 106 | popoverSpy.target = null; | ||
2217 | 107 | popoverSpy.clear(); | ||
2218 | 108 | waitForRendering(main, 500); | ||
2219 | 109 | } | ||
2220 | 110 | |||
2221 | 111 | function test_dismiss_on_click_data() { | ||
2222 | 112 | return [ | ||
2223 | 113 | {button: Qt.LeftButton}, | ||
2224 | 114 | {button: Qt.MiddleButton}, | ||
2225 | 115 | {button: Qt.RightButton}, | ||
2226 | 116 | ]; | ||
2227 | 117 | } | ||
2228 | 118 | |||
2229 | 119 | function test_dismiss_on_click(data) { | ||
2230 | 120 | mouseClick(pressMe, pressMe.width / 2, pressMe.height / 2); | ||
2231 | 121 | waitForRendering(pressMe); | ||
2232 | 122 | verify(popoverSpy.target !== null, "The popover did not open"); | ||
2233 | 123 | |||
2234 | 124 | // dismiss | ||
2235 | 125 | mouseClick(main, 10, 10, data.button); | ||
2236 | 126 | popoverSpy.wait(); | ||
2237 | 127 | } | ||
2238 | 128 | |||
2239 | 129 | function test_popover_consumes_clicks_bug1488540_data() { | ||
2240 | 130 | return [ | ||
2241 | 131 | { tag: 'Left-click', button: Qt.LeftButton }, | ||
2242 | 132 | { tag: 'Right-click', button: Qt.RightButton }, | ||
2243 | 133 | { tag: 'Middle-click', button: Qt.MiddleButton }, | ||
2244 | 134 | ] | ||
2245 | 135 | } | ||
2246 | 136 | function test_popover_consumes_clicks_bug1488540(data) { | ||
2247 | 137 | mouseClick(pressMe, pressMe.width / 2, pressMe.height / 2); | ||
2248 | 138 | waitForRendering(pressMe); | ||
2249 | 139 | verify(popoverSpy.target !== null, "The popover did not open"); | ||
2250 | 140 | var popover = popoverSpy.target; | ||
2251 | 141 | // Click in the popover, the rectangle doesn't handle clicks | ||
2252 | 142 | whiteSpy.clear(); | ||
2253 | 143 | mouseClick(popover, popover.width / 2, popover.height / 2, data.button); | ||
2254 | 144 | // dismiss | ||
2255 | 145 | mouseClick(main, 10, 10, Qt.LeftButton); | ||
2256 | 146 | popoverSpy.wait(); | ||
2257 | 147 | // Did the click reach through the popover foreground? | ||
2258 | 148 | compare(whiteSpy.count, 0, 'Click passed through popover foreground!'); | ||
2259 | 149 | |||
2260 | 150 | } | ||
2261 | 151 | |||
2262 | 152 | function test_popover_follows_pointerTarget_bug1199502_data() { | ||
2263 | 153 | return [ | ||
2264 | 154 | { tag: "Moving pointerTarget", button: pressMe, dir: "down", y: 318 }, | ||
2265 | 155 | // FIXME: { tag: "Moving parent", button: pushMe, dir: "up", y: 142.8 }, | ||
2266 | 156 | // https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1427557 | ||
2267 | 157 | ] | ||
2268 | 158 | } | ||
2269 | 159 | function test_popover_follows_pointerTarget_bug1199502(data) { | ||
2270 | 160 | mouseClick(data.button, data.button.width / 2, data.button.height / 2); | ||
2271 | 161 | waitForRendering(data.button); | ||
2272 | 162 | var dir = popoverSpy.target.direction | ||
2273 | 163 | var popoverY = popoverSpy.target.y | ||
2274 | 164 | |||
2275 | 165 | // dismiss | ||
2276 | 166 | mouseClick(main, 10, 10, Qt.LeftButton); | ||
2277 | 167 | popoverSpy.wait(); | ||
2278 | 168 | |||
2279 | 169 | // ensure popover was next to caller | ||
2280 | 170 | compare(dir, data.dir, "Popover arrow is wrong") | ||
2281 | 171 | compare(popoverY, data.y, "Popover isn't pointing at the caller") | ||
2282 | 172 | } | ||
2283 | 173 | } | ||
2284 | 174 | } | ||
2285 | 0 | 175 | ||
2286 | === modified file 'ubuntu-sdk.pro' | |||
2287 | --- ubuntu-sdk.pro 2015-08-13 09:20:05 +0000 | |||
2288 | +++ ubuntu-sdk.pro 2015-09-22 15:57:54 +0000 | |||
2289 | @@ -8,7 +8,7 @@ | |||
2290 | 8 | requires(qtHaveModule(quick)) | 8 | requires(qtHaveModule(quick)) |
2291 | 9 | load(qt_parts) | 9 | load(qt_parts) |
2292 | 10 | 10 | ||
2294 | 11 | SUBDIRS += po documentation | 11 | SUBDIRS += po documentation ubuntu-ui-toolkit-launcher |
2295 | 12 | 12 | ||
2296 | 13 | #when standalone we always want tests to be built | 13 | #when standalone we always want tests to be built |
2297 | 14 | !build_with_qt{ | 14 | !build_with_qt{ |
2298 | 15 | 15 | ||
2299 | === renamed directory 'tests/launcher' => 'ubuntu-ui-toolkit-launcher' | |||
2300 | === renamed file 'tests/launcher/launcher.pro' => 'ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher.pro' | |||
2301 | --- tests/launcher/launcher.pro 2014-06-17 07:12:49 +0000 | |||
2302 | +++ ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher.pro 2015-09-22 15:57:54 +0000 | |||
2303 | @@ -6,8 +6,8 @@ | |||
2304 | 6 | HEADERS += MouseTouchAdaptor.h | 6 | HEADERS += MouseTouchAdaptor.h |
2305 | 7 | SOURCES += launcher.cpp \ | 7 | SOURCES += launcher.cpp \ |
2306 | 8 | MouseTouchAdaptor.cpp | 8 | MouseTouchAdaptor.cpp |
2308 | 9 | installPath = $$[QT_INSTALL_LIBS]/ubuntu-ui-toolkit | 9 | installPath = $$[QT_INSTALL_PREFIX]/bin |
2309 | 10 | launcher.path = $$installPath | 10 | launcher.path = $$installPath |
2311 | 11 | launcher.files = launcher | 11 | launcher.files = ubuntu-ui-toolkit-launcher |
2312 | 12 | INSTALLS += launcher | 12 | INSTALLS += launcher |
2313 | 13 | 13 |