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

Proposed by Albert Astals Cid
Status: Superseded
Proposed branch: lp:~aacid/unity8/clickOpenMenuClosesIt
Merge into: lp:unity8
Diff against target: 154 lines (+77/-6)
3 files modified
qml/ApplicationMenus/MenuBar.qml (+8/-1)
qml/ApplicationMenus/MenuPopup.qml (+19/-5)
tests/qmltests/ApplicationMenus/tst_MenuBar.qml (+50/-0)
To merge this branch: bzr merge lp:~aacid/unity8/clickOpenMenuClosesIt
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Needs Fixing
Daniel d'Andrada Pending
Review via email: mp+315649@code.launchpad.net

This proposal supersedes a proposal from 2017-01-20.

This proposal has been superseded by a proposal from 2017-01-26.

Commit message

Clicking on an open menu closes it + test

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

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

FAILED: Continuous integration, rev:2773
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2986/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3890
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2277
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2277
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3918
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3763
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3763/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3763
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3763/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3763
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3763/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3763
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3763/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3763
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3763/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3763
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3763/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2986/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote : Posted in a previous version of this proposal

PASSED: Continuous integration, rev:2773
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2992/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3896
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2283
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2283
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3924
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3769
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3769/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3769
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3769/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3769
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3769/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3769
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3769/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3769
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3769/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3769
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3769/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2992/rebuild

review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

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

* Did CI run pass? If not, please explain why.
Yes

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2774
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3037/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3952
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2309
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2309
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3980
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3824
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3824/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3824
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3824/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3824
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3824/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3824
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3824/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3824
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3824/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3824
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3824/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3037/rebuild

review: Needs Fixing (continuous-integration)
2775. By Albert Astals Cid

Merge

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'qml/ApplicationMenus/MenuBar.qml'
--- qml/ApplicationMenus/MenuBar.qml 2017-01-17 09:45:22 +0000
+++ qml/ApplicationMenus/MenuBar.qml 2017-01-26 09:02:07 +0000
@@ -114,6 +114,7 @@
114 function show() {114 function show() {
115 if (!__popup) {115 if (!__popup) {
116 __popup = menuComponent.createObject(root, { objectName: visualItem.objectName + "-menu" });116 __popup = menuComponent.createObject(root, { objectName: visualItem.objectName + "-menu" });
117 __popup.childActivated.connect(dismiss);
117 // force the current item to be the newly popped up menu118 // force the current item to be the newly popped up menu
118 } else {119 } else {
119 __popup.show();120 __popup.show();
@@ -212,7 +213,13 @@
212 updateCurrentItemFromPosition(Qt.point(mouse.x, mouse.y))213 updateCurrentItemFromPosition(Qt.point(mouse.x, mouse.y))
213 }214 }
214 }215 }
215 onClicked: updateCurrentItemFromPosition(Qt.point(mouse.x, mouse.y))216 onClicked: {
217 var prevItem = d.currentItem;
218 updateCurrentItemFromPosition(Qt.point(mouse.x, mouse.y))
219 if (prevItem && d.currentItem == prevItem) {
220 prevItem.hide();
221 }
222 }
216223
217 function updateCurrentItemFromPosition(point) {224 function updateCurrentItemFromPosition(point) {
218 var pos = mapToItem(row, point.x, point.y);225 var pos = mapToItem(row, point.x, point.y);
219226
=== modified file 'qml/ApplicationMenus/MenuPopup.qml'
--- qml/ApplicationMenus/MenuPopup.qml 2017-01-18 12:08:05 +0000
+++ qml/ApplicationMenus/MenuPopup.qml 2017-01-26 09:02:07 +0000
@@ -26,6 +26,8 @@
26 objectName: "menu"26 objectName: "menu"
27 backgroundColor: theme.palette.normal.overlay27 backgroundColor: theme.palette.normal.overlay
2828
29 signal childActivated()
30
29 property alias unityMenuModel: repeater.model31 property alias unityMenuModel: repeater.model
3032
31 function show() {33 function show() {
@@ -263,16 +265,22 @@
263 return mapToItem(container, 0, y).y;265 return mapToItem(container, 0, y).y;
264 })266 })
265 });267 });
268 popup.retreat.connect(function() {
269 popup.destroy();
270 popup = null;
271 menuItem.forceActiveFocus();
272 });
273 popup.childActivated.connect(function() {
274 popup.destroy();
275 popup = null;
276 root.childActivated();
277 });
266 } else if (popup) {278 } else if (popup) {
267 popup.visible = true;279 popup.visible = true;
268 }280 }
269 popup.retreat.connect(function() {
270 popup.destroy();
271 popup = null;
272 menuItem.forceActiveFocus();
273 })
274 } else {281 } else {
275 root.unityMenuModel.activate(__ownIndex);282 root.unityMenuModel.activate(__ownIndex);
283 root.childActivated();
276 }284 }
277 }285 }
278286
@@ -377,6 +385,7 @@
377385
378 property var unityMenuModel: null386 property var unityMenuModel: null
379 signal retreat()387 signal retreat()
388 signal childActivated()
380389
381 Binding {390 Binding {
382 target: item391 target: item
@@ -392,6 +401,11 @@
392401
393 Keys.onLeftPressed: retreat()402 Keys.onLeftPressed: retreat()
394403
404 Connections {
405 target: item
406 onChildActivated: childActivated();
407 }
408
395 Component.onCompleted: item.select(0);409 Component.onCompleted: item.select(0);
396 onVisibleChanged: if (visible) { item.select(0); }410 onVisibleChanged: if (visible) { item.select(0); }
397 }411 }
398412
=== modified file 'tests/qmltests/ApplicationMenus/tst_MenuBar.qml'
--- tests/qmltests/ApplicationMenus/tst_MenuBar.qml 2017-01-24 07:41:35 +0000
+++ tests/qmltests/ApplicationMenus/tst_MenuBar.qml 2017-01-26 09:02:07 +0000
@@ -180,6 +180,41 @@
180 tryCompare(priv, "currentItem", menuItem);180 tryCompare(priv, "currentItem", menuItem);
181 }181 }
182182
183 function test_menuActivateClosesMenu() {
184 menuBackend.modelData = appMenuData.generateTestData(3,3,0,0,"menu");
185 var priv = findInvisibleChild(menuBar, "d");
186
187 var menuItem = findChild(menuBar, "menuBar-item0");
188 menuItem.show();
189 compare(priv.currentItem, menuItem, "CurrentItem should be set to item 0");
190 compare(priv.currentItem.popupVisible, true, "Popup should be visible");
191
192 var actionItem = findChild(menuBar, "menuBar-item0-menu-item0-actionItem");
193 mouseClick(actionItem);
194 compare(priv.currentItem, null, "CurrentItem should be null");
195 }
196
197 function test_subMenuActivateClosesMenu() {
198 menuBackend.modelData = appMenuData.generateTestData(3,4,1,0,"menu");
199 var priv = findInvisibleChild(menuBar, "d");
200
201 var menuItem = findChild(menuBar, "menuBar-item0");
202 menuItem.show();
203 compare(priv.currentItem, menuItem, "CurrentItem should be set to item 0");
204 compare(priv.currentItem.popupVisible, true, "Popup should be visible");
205
206 var actionItem = findChild(menuBar, "menuBar-item0-menu-item0-actionItem");
207 mouseClick(actionItem);
208
209 actionItem = findChild(menuBar, "menuBar-item0-menu-item0-menu-item0-actionItem");
210 mouseClick(actionItem);
211
212 actionItem = findChild(menuBar, "menuBar-item0-menu-item0-menu-item0-menu-item0-actionItem");
213 mouseClick(actionItem);
214
215 compare(priv.currentItem, null, "CurrentItem should be null");
216 }
217
183 function test_openAppMenuShortcut() {218 function test_openAppMenuShortcut() {
184 var priv = findInvisibleChild(menuBar, "d");219 var priv = findInvisibleChild(menuBar, "d");
185220
@@ -192,5 +227,20 @@
192 keyClick(Qt.Key_F10, Qt.AltModifier);227 keyClick(Qt.Key_F10, Qt.AltModifier);
193 compare(priv.currentItem, menuItem1, "First enabled item should be opened");228 compare(priv.currentItem, menuItem1, "First enabled item should be opened");
194 }229 }
230
231 function test_clickOpenMenuClosesMenu() {
232 menuBackend.modelData = appMenuData.generateTestData(3,3,0,0,"menu");
233 var priv = findInvisibleChild(menuBar, "d");
234
235 var menuItem = findChild(menuBar, "menuBar-item0");
236 waitForRendering(menuItem);
237 mouseClick(menuItem);
238 compare(priv.currentItem, menuItem, "CurrentItem should be set to item 0");
239 compare(priv.currentItem.popupVisible, true, "Popup should be visible");
240
241 waitForRendering(menuItem);
242 mouseClick(menuItem);
243 compare(priv.currentItem, null, "CurrentItem should be null");
244 }
195 }245 }
196}246}

Subscribers

People subscribed via source and target branches