Merge lp:~aacid/unity8/makeSureMenuPositionOnScreen into lp:unity8
- makeSureMenuPositionOnScreen
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~aacid/unity8/makeSureMenuPositionOnScreen |
Merge into: | lp:unity8 |
Prerequisite: | lp:~nick-dedekind/unity8/menu.width.fix |
Diff against target: |
408 lines (+252/-24) 6 files modified
qml/ApplicationMenus/ApplicationMenusLimits.qml (+24/-0) qml/ApplicationMenus/MenuBar.qml (+10/-3) qml/ApplicationMenus/MenuPopup.qml (+67/-21) qml/ApplicationMenus/qmldir (+1/-0) tests/qmltests/ApplicationMenus/tst_MenuBar.qml (+50/-0) tests/qmltests/Stage/tst_DesktopStage.qml (+100/-0) |
To merge this branch: | bzr merge lp:~aacid/unity8/makeSureMenuPositionOnScreen |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Unity8 CI Bot | continuous-integration | Approve | |
Unity Team | Pending | ||
Review via email: mp+315470@code.launchpad.net |
This proposal has been superseded by a proposal from 2017-01-26.
Commit message
Make the menus and submenus do not go outside the screen when popping out
Description of the change
* Are there any related MPs required for this MP to build/function as expected?
No
* Did you perform an exploratory manual test run of your code change and any related functionality?
Yes
* If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A
* If you changed the UI, has there been a design review?
N/A
- 2773. By Albert Astals Cid
-
Now with better files!
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2773
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 2774. By Albert Astals Cid
-
Do not use exact gu values for the compares
Since there's text involved the gu values are not the same depending your px per gu, so do it in a bit of more fuzzy way
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2774
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 2775. By Albert Astals Cid
-
Merge
- 2776. By Albert Astals Cid
-
Merge clickOpenMenuCl
osesIt
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2775
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 2777. By Albert Astals Cid
-
Merge
Unmerged revisions
Preview Diff
1 | === added file 'qml/ApplicationMenus/ApplicationMenusLimits.qml' | |||
2 | --- qml/ApplicationMenus/ApplicationMenusLimits.qml 1970-01-01 00:00:00 +0000 | |||
3 | +++ qml/ApplicationMenus/ApplicationMenusLimits.qml 2017-01-26 09:29:42 +0000 | |||
4 | @@ -0,0 +1,24 @@ | |||
5 | 1 | /* | ||
6 | 2 | * Copyright (C) 2017 Canonical, Ltd. | ||
7 | 3 | * | ||
8 | 4 | * This program is free software; you can redistribute it and/or modify | ||
9 | 5 | * it under the terms of the GNU General Public License as published by | ||
10 | 6 | * the Free Software Foundation; version 3. | ||
11 | 7 | * | ||
12 | 8 | * This program is distributed in the hope that it will be useful, | ||
13 | 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | 11 | * GNU General Public License for more details. | ||
16 | 12 | * | ||
17 | 13 | * You should have received a copy of the GNU General Public License | ||
18 | 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | 15 | */ | ||
20 | 16 | |||
21 | 17 | pragma Singleton | ||
22 | 18 | import QtQuick 2.4 | ||
23 | 19 | import QtQuick.Window 2.2 | ||
24 | 20 | |||
25 | 21 | QtObject { | ||
26 | 22 | property real screenWidth: Screen.width | ||
27 | 23 | property real screenHeight: Screen.height | ||
28 | 24 | } | ||
29 | 0 | 25 | ||
30 | === modified file 'qml/ApplicationMenus/MenuBar.qml' | |||
31 | --- qml/ApplicationMenus/MenuBar.qml 2017-01-17 09:45:22 +0000 | |||
32 | +++ qml/ApplicationMenus/MenuBar.qml 2017-01-26 09:29:42 +0000 | |||
33 | @@ -114,6 +114,7 @@ | |||
34 | 114 | function show() { | 114 | function show() { |
35 | 115 | if (!__popup) { | 115 | if (!__popup) { |
36 | 116 | __popup = menuComponent.createObject(root, { objectName: visualItem.objectName + "-menu" }); | 116 | __popup = menuComponent.createObject(root, { objectName: visualItem.objectName + "-menu" }); |
37 | 117 | __popup.childActivated.connect(dismiss); | ||
38 | 117 | // force the current item to be the newly popped up menu | 118 | // force the current item to be the newly popped up menu |
39 | 118 | } else { | 119 | } else { |
40 | 119 | __popup.show(); | 120 | __popup.show(); |
41 | @@ -148,8 +149,8 @@ | |||
42 | 148 | Component { | 149 | Component { |
43 | 149 | id: menuComponent | 150 | id: menuComponent |
44 | 150 | MenuPopup { | 151 | MenuPopup { |
47 | 151 | x: visualItem.x - units.gu(1) | 152 | desiredX: visualItem.x - units.gu(1) |
48 | 152 | anchors.top: parent.bottom | 153 | desiredY: parent.height |
49 | 153 | unityMenuModel: root.unityMenuModel.submenu(visualItem.__ownIndex) | 154 | unityMenuModel: root.unityMenuModel.submenu(visualItem.__ownIndex) |
50 | 154 | 155 | ||
51 | 155 | Component.onCompleted: reset(); | 156 | Component.onCompleted: reset(); |
52 | @@ -212,7 +213,13 @@ | |||
53 | 212 | updateCurrentItemFromPosition(Qt.point(mouse.x, mouse.y)) | 213 | updateCurrentItemFromPosition(Qt.point(mouse.x, mouse.y)) |
54 | 213 | } | 214 | } |
55 | 214 | } | 215 | } |
57 | 215 | onClicked: updateCurrentItemFromPosition(Qt.point(mouse.x, mouse.y)) | 216 | onClicked: { |
58 | 217 | var prevItem = d.currentItem; | ||
59 | 218 | updateCurrentItemFromPosition(Qt.point(mouse.x, mouse.y)) | ||
60 | 219 | if (prevItem && d.currentItem == prevItem) { | ||
61 | 220 | prevItem.hide(); | ||
62 | 221 | } | ||
63 | 222 | } | ||
64 | 216 | 223 | ||
65 | 217 | function updateCurrentItemFromPosition(point) { | 224 | function updateCurrentItemFromPosition(point) { |
66 | 218 | var pos = mapToItem(row, point.x, point.y); | 225 | var pos = mapToItem(row, point.x, point.y); |
67 | 219 | 226 | ||
68 | === modified file 'qml/ApplicationMenus/MenuPopup.qml' | |||
69 | --- qml/ApplicationMenus/MenuPopup.qml 2017-01-18 12:08:05 +0000 | |||
70 | +++ qml/ApplicationMenus/MenuPopup.qml 2017-01-26 09:29:42 +0000 | |||
71 | @@ -16,16 +16,50 @@ | |||
72 | 16 | 16 | ||
73 | 17 | import QtQuick 2.4 | 17 | import QtQuick 2.4 |
74 | 18 | import QtQuick.Layouts 1.1 | 18 | import QtQuick.Layouts 1.1 |
75 | 19 | import QtQuick.Window 2.2 | ||
76 | 20 | import Ubuntu.Components 1.3 | 19 | import Ubuntu.Components 1.3 |
77 | 21 | import Ubuntu.Components.ListItems 1.3 as ListItems | 20 | import Ubuntu.Components.ListItems 1.3 as ListItems |
78 | 22 | import "../Components" | 21 | import "../Components" |
79 | 22 | import "." | ||
80 | 23 | 23 | ||
81 | 24 | UbuntuShape { | 24 | UbuntuShape { |
82 | 25 | id: root | 25 | id: root |
83 | 26 | objectName: "menu" | 26 | objectName: "menu" |
84 | 27 | backgroundColor: theme.palette.normal.overlay | 27 | backgroundColor: theme.palette.normal.overlay |
85 | 28 | 28 | ||
86 | 29 | signal childActivated() | ||
87 | 30 | |||
88 | 31 | // true for submenus that need to show on the other side of their parent | ||
89 | 32 | // if they don't fit when growing right | ||
90 | 33 | property bool substractWidth: false | ||
91 | 34 | |||
92 | 35 | property real desiredX | ||
93 | 36 | x: { | ||
94 | 37 | var dummy = visible; // force recalc when shown/hidden | ||
95 | 38 | var parentTopLeft = parent.mapToItem(null, 0, 0); | ||
96 | 39 | var farX = ApplicationMenusLimits.screenWidth; | ||
97 | 40 | if (parentTopLeft.x + width + desiredX <= farX) { | ||
98 | 41 | return desiredX; | ||
99 | 42 | } else { | ||
100 | 43 | if (substractWidth) { | ||
101 | 44 | return -width; | ||
102 | 45 | } else { | ||
103 | 46 | return farX - parentTopLeft.x - width; | ||
104 | 47 | } | ||
105 | 48 | } | ||
106 | 49 | } | ||
107 | 50 | |||
108 | 51 | property real desiredY | ||
109 | 52 | y: { | ||
110 | 53 | var dummy = visible; // force recalc when shown/hidden | ||
111 | 54 | var parentTopLeft = parent.mapToItem(null, 0, 0); | ||
112 | 55 | var bottomY = ApplicationMenusLimits.screenHeight; | ||
113 | 56 | if (parentTopLeft.y + height + desiredY <= bottomY) { | ||
114 | 57 | return desiredY; | ||
115 | 58 | } else { | ||
116 | 59 | return bottomY - parentTopLeft.y - height; | ||
117 | 60 | } | ||
118 | 61 | } | ||
119 | 62 | |||
120 | 29 | property alias unityMenuModel: repeater.model | 63 | property alias unityMenuModel: repeater.model |
121 | 30 | 64 | ||
122 | 31 | function show() { | 65 | function show() { |
123 | @@ -64,9 +98,9 @@ | |||
124 | 64 | readonly property int currentIndex: currentItem ? currentItem.__ownIndex : -1 | 98 | readonly property int currentIndex: currentItem ? currentItem.__ownIndex : -1 |
125 | 65 | 99 | ||
126 | 66 | property real __minimumWidth: units.gu(20) | 100 | property real __minimumWidth: units.gu(20) |
128 | 67 | property real __maximumWidth: Screen.width * 0.7 | 101 | property real __maximumWidth: ApplicationMenusLimits.screenWidth * 0.7 |
129 | 68 | property real __minimumHeight: units.gu(2) | 102 | property real __minimumHeight: units.gu(2) |
131 | 69 | property real __maximumHeight: Screen.height * 0.7 | 103 | property real __maximumHeight: ApplicationMenusLimits.screenHeight * 0.7 |
132 | 70 | 104 | ||
133 | 71 | signal dismissAll() | 105 | signal dismissAll() |
134 | 72 | 106 | ||
135 | @@ -257,22 +291,29 @@ | |||
136 | 257 | popup = submenuComponent.createObject(focusScope, { | 291 | popup = submenuComponent.createObject(focusScope, { |
137 | 258 | objectName: loader.objectName + "-", | 292 | objectName: loader.objectName + "-", |
138 | 259 | unityMenuModel: model, | 293 | unityMenuModel: model, |
141 | 260 | x: Qt.binding(function() { return root.width }), | 294 | substractWidth: true, |
142 | 261 | y: Qt.binding(function() { | 295 | desiredX: Qt.binding(function() { return root.width }), |
143 | 296 | desiredY: Qt.binding(function() { | ||
144 | 262 | var dummy = listView.contentY; // force a recalc on contentY change. | 297 | var dummy = listView.contentY; // force a recalc on contentY change. |
145 | 263 | return mapToItem(container, 0, y).y; | 298 | return mapToItem(container, 0, y).y; |
146 | 264 | }) | 299 | }) |
147 | 265 | }); | 300 | }); |
148 | 301 | popup.retreat.connect(function() { | ||
149 | 302 | popup.destroy(); | ||
150 | 303 | popup = null; | ||
151 | 304 | menuItem.forceActiveFocus(); | ||
152 | 305 | }); | ||
153 | 306 | popup.childActivated.connect(function() { | ||
154 | 307 | popup.destroy(); | ||
155 | 308 | popup = null; | ||
156 | 309 | root.childActivated(); | ||
157 | 310 | }); | ||
158 | 266 | } else if (popup) { | 311 | } else if (popup) { |
159 | 267 | popup.visible = true; | 312 | popup.visible = true; |
160 | 268 | } | 313 | } |
161 | 269 | popup.retreat.connect(function() { | ||
162 | 270 | popup.destroy(); | ||
163 | 271 | popup = null; | ||
164 | 272 | menuItem.forceActiveFocus(); | ||
165 | 273 | }) | ||
166 | 274 | } else { | 314 | } else { |
167 | 275 | root.unityMenuModel.activate(__ownIndex); | 315 | root.unityMenuModel.activate(__ownIndex); |
168 | 316 | root.childActivated(); | ||
169 | 276 | } | 317 | } |
170 | 277 | } | 318 | } |
171 | 278 | 319 | ||
172 | @@ -375,23 +416,28 @@ | |||
173 | 375 | id: submenuLoader | 416 | id: submenuLoader |
174 | 376 | source: "MenuPopup.qml" | 417 | source: "MenuPopup.qml" |
175 | 377 | 418 | ||
176 | 419 | property real desiredX | ||
177 | 420 | property real desiredY | ||
178 | 421 | property bool substractWidth | ||
179 | 378 | property var unityMenuModel: null | 422 | property var unityMenuModel: null |
180 | 379 | signal retreat() | 423 | signal retreat() |
192 | 380 | 424 | signal childActivated() | |
193 | 381 | Binding { | 425 | |
194 | 382 | target: item | 426 | onLoaded: { |
195 | 383 | property: "unityMenuModel" | 427 | item.unityMenuModel = Qt.binding(function() { return submenuLoader.unityMenuModel; }); |
196 | 384 | value: submenuLoader.unityMenuModel | 428 | item.objectName = Qt.binding(function() { return submenuLoader.objectName + "menu"; }); |
197 | 385 | } | 429 | item.desiredX = Qt.binding(function() { return submenuLoader.desiredX; }); |
198 | 386 | 430 | item.desiredY = Qt.binding(function() { return submenuLoader.desiredY; }); | |
199 | 387 | Binding { | 431 | item.substractWidth = Qt.binding(function() { return submenuLoader.substractWidth; }); |
189 | 388 | target: item | ||
190 | 389 | property: "objectName" | ||
191 | 390 | value: submenuLoader.objectName + "menu" | ||
200 | 391 | } | 432 | } |
201 | 392 | 433 | ||
202 | 393 | Keys.onLeftPressed: retreat() | 434 | Keys.onLeftPressed: retreat() |
203 | 394 | 435 | ||
204 | 436 | Connections { | ||
205 | 437 | target: item | ||
206 | 438 | onChildActivated: childActivated(); | ||
207 | 439 | } | ||
208 | 440 | |||
209 | 395 | Component.onCompleted: item.select(0); | 441 | Component.onCompleted: item.select(0); |
210 | 396 | onVisibleChanged: if (visible) { item.select(0); } | 442 | onVisibleChanged: if (visible) { item.select(0); } |
211 | 397 | } | 443 | } |
212 | 398 | 444 | ||
213 | === added file 'qml/ApplicationMenus/qmldir' | |||
214 | --- qml/ApplicationMenus/qmldir 1970-01-01 00:00:00 +0000 | |||
215 | +++ qml/ApplicationMenus/qmldir 2017-01-26 09:29:42 +0000 | |||
216 | @@ -0,0 +1,1 @@ | |||
217 | 1 | singleton ApplicationMenusLimits 0.1 ApplicationMenusLimits.qml | ||
218 | 0 | 2 | ||
219 | === modified file 'tests/qmltests/ApplicationMenus/tst_MenuBar.qml' | |||
220 | --- tests/qmltests/ApplicationMenus/tst_MenuBar.qml 2017-01-24 07:41:35 +0000 | |||
221 | +++ tests/qmltests/ApplicationMenus/tst_MenuBar.qml 2017-01-26 09:29:42 +0000 | |||
222 | @@ -180,6 +180,41 @@ | |||
223 | 180 | tryCompare(priv, "currentItem", menuItem); | 180 | tryCompare(priv, "currentItem", menuItem); |
224 | 181 | } | 181 | } |
225 | 182 | 182 | ||
226 | 183 | function test_menuActivateClosesMenu() { | ||
227 | 184 | menuBackend.modelData = appMenuData.generateTestData(3,3,0,0,"menu"); | ||
228 | 185 | var priv = findInvisibleChild(menuBar, "d"); | ||
229 | 186 | |||
230 | 187 | var menuItem = findChild(menuBar, "menuBar-item0"); | ||
231 | 188 | menuItem.show(); | ||
232 | 189 | compare(priv.currentItem, menuItem, "CurrentItem should be set to item 0"); | ||
233 | 190 | compare(priv.currentItem.popupVisible, true, "Popup should be visible"); | ||
234 | 191 | |||
235 | 192 | var actionItem = findChild(menuBar, "menuBar-item0-menu-item0-actionItem"); | ||
236 | 193 | mouseClick(actionItem); | ||
237 | 194 | compare(priv.currentItem, null, "CurrentItem should be null"); | ||
238 | 195 | } | ||
239 | 196 | |||
240 | 197 | function test_subMenuActivateClosesMenu() { | ||
241 | 198 | menuBackend.modelData = appMenuData.generateTestData(3,4,1,0,"menu"); | ||
242 | 199 | var priv = findInvisibleChild(menuBar, "d"); | ||
243 | 200 | |||
244 | 201 | var menuItem = findChild(menuBar, "menuBar-item0"); | ||
245 | 202 | menuItem.show(); | ||
246 | 203 | compare(priv.currentItem, menuItem, "CurrentItem should be set to item 0"); | ||
247 | 204 | compare(priv.currentItem.popupVisible, true, "Popup should be visible"); | ||
248 | 205 | |||
249 | 206 | var actionItem = findChild(menuBar, "menuBar-item0-menu-item0-actionItem"); | ||
250 | 207 | mouseClick(actionItem); | ||
251 | 208 | |||
252 | 209 | actionItem = findChild(menuBar, "menuBar-item0-menu-item0-menu-item0-actionItem"); | ||
253 | 210 | mouseClick(actionItem); | ||
254 | 211 | |||
255 | 212 | actionItem = findChild(menuBar, "menuBar-item0-menu-item0-menu-item0-menu-item0-actionItem"); | ||
256 | 213 | mouseClick(actionItem); | ||
257 | 214 | |||
258 | 215 | compare(priv.currentItem, null, "CurrentItem should be null"); | ||
259 | 216 | } | ||
260 | 217 | |||
261 | 183 | function test_openAppMenuShortcut() { | 218 | function test_openAppMenuShortcut() { |
262 | 184 | var priv = findInvisibleChild(menuBar, "d"); | 219 | var priv = findInvisibleChild(menuBar, "d"); |
263 | 185 | 220 | ||
264 | @@ -192,5 +227,20 @@ | |||
265 | 192 | keyClick(Qt.Key_F10, Qt.AltModifier); | 227 | keyClick(Qt.Key_F10, Qt.AltModifier); |
266 | 193 | compare(priv.currentItem, menuItem1, "First enabled item should be opened"); | 228 | compare(priv.currentItem, menuItem1, "First enabled item should be opened"); |
267 | 194 | } | 229 | } |
268 | 230 | |||
269 | 231 | function test_clickOpenMenuClosesMenu() { | ||
270 | 232 | menuBackend.modelData = appMenuData.generateTestData(3,3,0,0,"menu"); | ||
271 | 233 | var priv = findInvisibleChild(menuBar, "d"); | ||
272 | 234 | |||
273 | 235 | var menuItem = findChild(menuBar, "menuBar-item0"); | ||
274 | 236 | waitForRendering(menuItem); | ||
275 | 237 | mouseClick(menuItem); | ||
276 | 238 | compare(priv.currentItem, menuItem, "CurrentItem should be set to item 0"); | ||
277 | 239 | compare(priv.currentItem.popupVisible, true, "Popup should be visible"); | ||
278 | 240 | |||
279 | 241 | waitForRendering(menuItem); | ||
280 | 242 | mouseClick(menuItem); | ||
281 | 243 | compare(priv.currentItem, null, "CurrentItem should be null"); | ||
282 | 244 | } | ||
283 | 195 | } | 245 | } |
284 | 196 | } | 246 | } |
285 | 197 | 247 | ||
286 | === modified file 'tests/qmltests/Stage/tst_DesktopStage.qml' | |||
287 | --- tests/qmltests/Stage/tst_DesktopStage.qml 2017-01-10 14:44:29 +0000 | |||
288 | +++ tests/qmltests/Stage/tst_DesktopStage.qml 2017-01-26 09:29:42 +0000 | |||
289 | @@ -29,6 +29,7 @@ | |||
290 | 29 | import "../../../qml/Stage" | 29 | import "../../../qml/Stage" |
291 | 30 | import "../../../qml/Components" | 30 | import "../../../qml/Components" |
292 | 31 | import "../../../qml/Components/PanelState" | 31 | import "../../../qml/Components/PanelState" |
293 | 32 | import "../../../qml/ApplicationMenus" | ||
294 | 32 | 33 | ||
295 | 33 | Item { | 34 | Item { |
296 | 34 | id: root | 35 | id: root |
297 | @@ -44,6 +45,8 @@ | |||
298 | 44 | } | 45 | } |
299 | 45 | 46 | ||
300 | 46 | Component.onCompleted: { | 47 | Component.onCompleted: { |
301 | 48 | ApplicationMenusLimits.screenWidth = Qt.binding( function() { return stageLoader.width; } ); | ||
302 | 49 | ApplicationMenusLimits.screenHeight = Qt.binding( function() { return stageLoader.height; } ); | ||
303 | 47 | QuickUtils.keyboardAttached = true; | 50 | QuickUtils.keyboardAttached = true; |
304 | 48 | theme.name = "Ubuntu.Components.Themes.SuruDark"; | 51 | theme.name = "Ubuntu.Components.Themes.SuruDark"; |
305 | 49 | resetGeometry(); | 52 | resetGeometry(); |
306 | @@ -830,5 +833,102 @@ | |||
307 | 830 | mouseRelease(decoration); | 833 | mouseRelease(decoration); |
308 | 831 | tryCompare(Mir, "cursorName", ""); | 834 | tryCompare(Mir, "cursorName", ""); |
309 | 832 | } | 835 | } |
310 | 836 | |||
311 | 837 | function test_menuPositioning_data() { | ||
312 | 838 | return [ | ||
313 | 839 | {tag: "good", | ||
314 | 840 | windowPosition: Qt.point(units.gu(10), units.gu(10)) | ||
315 | 841 | }, | ||
316 | 842 | {tag: "collides right", | ||
317 | 843 | windowPosition: Qt.point(units.gu(100), units.gu(10)), | ||
318 | 844 | minimumXDifference: units.gu(8) | ||
319 | 845 | }, | ||
320 | 846 | {tag: "collides bottom", | ||
321 | 847 | windowPosition: Qt.point(units.gu(10), units.gu(80)), | ||
322 | 848 | minimumYDifference: units.gu(7) | ||
323 | 849 | }, | ||
324 | 850 | ] | ||
325 | 851 | } | ||
326 | 852 | |||
327 | 853 | function test_menuPositioning(data) { | ||
328 | 854 | var appDelegate = startApplication("dialer-app"); | ||
329 | 855 | appDelegate.windowedX = data.windowPosition.x; | ||
330 | 856 | appDelegate.windowedY = data.windowPosition.y; | ||
331 | 857 | |||
332 | 858 | var menuItem = findChild(appDelegate, "menuBar-item3"); | ||
333 | 859 | menuItem.show(); | ||
334 | 860 | |||
335 | 861 | var menu = findChild(appDelegate, "menuBar-item3-menu"); | ||
336 | 862 | tryCompare(menu, "visible", true); | ||
337 | 863 | |||
338 | 864 | var normalPositioningX = menuItem.x - units.gu(1); | ||
339 | 865 | var normalPositioningY = menuItem.height; | ||
340 | 866 | |||
341 | 867 | // We do this fuzzy checking because otherwise we would be duplicating the code | ||
342 | 868 | // that calculates the coordinates and any bug it may have, what we want is really | ||
343 | 869 | // to check that on collision with the border the menu is shifted substantially | ||
344 | 870 | if (data.minimumXDifference) { | ||
345 | 871 | verify(menu.x < normalPositioningX - data.minimumXDifference); | ||
346 | 872 | } else { | ||
347 | 873 | compare(menu.x, normalPositioningX); | ||
348 | 874 | } | ||
349 | 875 | |||
350 | 876 | if (data.minimumYDifference) { | ||
351 | 877 | verify(menu.y < normalPositioningY - data.minimumYDifference); | ||
352 | 878 | } else { | ||
353 | 879 | compare(menu.y, normalPositioningY); | ||
354 | 880 | } | ||
355 | 881 | } | ||
356 | 882 | |||
357 | 883 | function test_submenuPositioning_data() { | ||
358 | 884 | return [ | ||
359 | 885 | {tag: "good", | ||
360 | 886 | windowPosition: Qt.point(units.gu(10), units.gu(10)) | ||
361 | 887 | }, | ||
362 | 888 | {tag: "collides right", | ||
363 | 889 | windowPosition: Qt.point(units.gu(100), units.gu(10)), | ||
364 | 890 | minimumXDifference: units.gu(35) | ||
365 | 891 | }, | ||
366 | 892 | {tag: "collides bottom", | ||
367 | 893 | windowPosition: Qt.point(units.gu(10), units.gu(80)), | ||
368 | 894 | minimumYDifference: units.gu(8) | ||
369 | 895 | }, | ||
370 | 896 | ] | ||
371 | 897 | } | ||
372 | 898 | |||
373 | 899 | function test_submenuPositioning(data) { | ||
374 | 900 | var appDelegate = startApplication("dialer-app"); | ||
375 | 901 | appDelegate.windowedX = data.windowPosition.x; | ||
376 | 902 | appDelegate.windowedY = data.windowPosition.y; | ||
377 | 903 | |||
378 | 904 | var menuItem = findChild(appDelegate, "menuBar-item3"); | ||
379 | 905 | menuItem.show(); | ||
380 | 906 | |||
381 | 907 | var menu = findChild(appDelegate, "menuBar-item3-menu"); | ||
382 | 908 | menuItem = findChild(menu, "menuBar-item3-menu-item3-actionItem"); | ||
383 | 909 | tryCompare(menuItem, "visible", true); | ||
384 | 910 | mouseMove(menuItem); | ||
385 | 911 | mouseClick(menuItem); | ||
386 | 912 | |||
387 | 913 | menu = findChild(appDelegate, "menuBar-item3-menu-item3-menu"); | ||
388 | 914 | |||
389 | 915 | var normalPositioningX = menuItem.width; | ||
390 | 916 | var normalPositioningY = menuItem.parent.y; | ||
391 | 917 | |||
392 | 918 | // We do this fuzzy checking because otherwise we would be duplicating the code | ||
393 | 919 | // that calculates the coordinates and any bug it may have, what we want is really | ||
394 | 920 | // to check that on collision with the border the menu is shifted substantially | ||
395 | 921 | if (data.minimumXDifference) { | ||
396 | 922 | verify(menu.x < normalPositioningX - data.minimumXDifference); | ||
397 | 923 | } else { | ||
398 | 924 | compare(menu.x, normalPositioningX); | ||
399 | 925 | } | ||
400 | 926 | |||
401 | 927 | if (data.minimumYDifference) { | ||
402 | 928 | verify(menu.y < normalPositioningY - data.minimumYDifference); | ||
403 | 929 | } else { | ||
404 | 930 | compare(menu.y, normalPositioningY); | ||
405 | 931 | } | ||
406 | 932 | } | ||
407 | 833 | } | 933 | } |
408 | 834 | } | 934 | } |
FAILED: Continuous integration, rev:2772 /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/3011/ /unity8- jenkins. ubuntu. com/job/ build/3916 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= xenial+ overlay, testname= qmluitests. sh/2294 /unity8- jenkins. ubuntu. com/job/ test-0- autopkgtest/ label=amd64, release= zesty,testname= qmluitests. sh/2294 /unity8- jenkins. ubuntu. com/job/ build-0- fetch/3944 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 3789 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 3789/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/3789 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/3789/ artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 3789 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 3789/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/3789 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/3789/ artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 3789 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 3789/artifact/ output/ *zip*/output. zip /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/3789 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/3789/ artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/3011/ rebuild
https:/