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

Proposed by Albert Astals Cid
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 2870
Merged at revision: 2903
Proposed branch: lp:~aacid/unity8/stray_menus
Merge into: lp:unity8
Diff against target: 89 lines (+42/-1)
3 files modified
qml/ApplicationMenus/MenuBar.qml (+7/-0)
qml/ApplicationMenus/MenuPopup.qml (+10/-1)
tests/qmltests/ApplicationMenus/tst_MenuBar.qml (+25/-0)
To merge this branch: bzr merge lp:~aacid/unity8/stray_menus
Reviewer Review Type Date Requested Status
Lukáš Tinkl (community) Approve
Unity8 CI Bot continuous-integration Approve
Review via email: mp+319785@code.launchpad.net

Commit message

Make sure we destroy the popups when the item goes away

Another way of doing this would be changing the parent in the createObject calls
but if we change that we have to change the x,y logic and since that's quite
delicate i decided to go the easy route to not cause regressions

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 :

PASSED: Continuous integration, rev:2868
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3362/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4431
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2656
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2656
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4459
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4292
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4292/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4292
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4292/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4292
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4292/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4292
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4292/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4292
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4292/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4292
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4292/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Fancy adding a test? :)

review: Needs Information
lp:~aacid/unity8/stray_menus updated
2869. By Albert Astals Cid

Add test

Revision history for this message
Albert Astals Cid (aacid) wrote :

> Fancy adding a test? :)

Added

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

PASSED: Continuous integration, rev:2869
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3372/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4445
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2661
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2661
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4473
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4303
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4303/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4303
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4303/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4303
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4303/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4303
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4303/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4303
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4303/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4303
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4303/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

Just a note, this is conflicting with other menu branches in silo 2555, might not rebasing

lp:~aacid/unity8/stray_menus updated
2870. By Albert Astals Cid

Merge

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

PASSED: Continuous integration, rev:2870
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3519/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4653
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2813
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2813
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4681
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4506
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4506/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4506
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4506/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4506
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4506/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4506
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4506/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4506
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4506/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4506
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4506/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

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

Yes

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

Yes

review: Approve

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-03-21 10:56:10 +0000
+++ qml/ApplicationMenus/MenuBar.qml 2017-03-24 08:30:38 +0000
@@ -224,6 +224,13 @@
224 }224 }
225 }225 }
226 }226 }
227
228 Component.onDestruction: {
229 if (__popup) {
230 __popup.destroy();
231 __popup = null;
232 }
233 }
227 } // Item ( delegate )234 } // Item ( delegate )
228 } // Repeater235 } // Repeater
229 } // Row236 } // Row
230237
=== modified file 'qml/ApplicationMenus/MenuPopup.qml'
--- qml/ApplicationMenus/MenuPopup.qml 2017-03-21 10:56:10 +0000
+++ qml/ApplicationMenus/MenuPopup.qml 2017-03-24 08:30:38 +0000
@@ -297,6 +297,8 @@
297297
298 width: MathUtils.clamp(implicitWidth, d.__minimumWidth, d.__maximumWidth)298 width: MathUtils.clamp(implicitWidth, d.__minimumWidth, d.__maximumWidth)
299299
300 property Item popup: null
301
300 action.onTriggered: {302 action.onTriggered: {
301 submenuHoverTimer.stop();303 submenuHoverTimer.stop();
302304
@@ -351,6 +353,13 @@
351 }353 }
352 }354 }
353 }355 }
356
357 Component.onDestruction: {
358 if (popup) {
359 popup.destroy();
360 popup = null;
361 }
362 }
354 }363 }
355 }364 }
356365
@@ -373,7 +382,7 @@
373 id: loader382 id: loader
374 objectName: root.objectName + "-item" + __ownIndex383 objectName: root.objectName + "-item" + __ownIndex
375384
376 property Item popup: null385 readonly property var popup: item ? item.popup : null
377 property var __menuData: model386 property var __menuData: model
378 property int __ownIndex: index387 property int __ownIndex: index
379 property bool __isSeparator: model.isSeparator388 property bool __isSeparator: model.isSeparator
380389
=== modified file 'tests/qmltests/ApplicationMenus/tst_MenuBar.qml'
--- tests/qmltests/ApplicationMenus/tst_MenuBar.qml 2017-03-21 10:56:10 +0000
+++ tests/qmltests/ApplicationMenus/tst_MenuBar.qml 2017-03-24 08:30:38 +0000
@@ -339,6 +339,31 @@
339 }, true);339 }, true);
340 }340 }
341341
342 function test_stray_submenus() {
343 menuBackend.modelData = appMenuData.generateTestData(3,4,1,0,"menu");
344 var priv = findInvisibleChild(menuBar, "d");
345
346 var menuItem = findChild(menuBar, "menuBar-item0");
347 menuItem.show();
348 compare(priv.currentItem, menuItem, "CurrentItem should be set to item 0");
349 compare(priv.currentItem.popupVisible, true, "Popup should be visible");
350
351 var actionItem = findChild(menuBar, "menuBar-item0-menu-item0-actionItem");
352 mouseClick(actionItem);
353
354 actionItem = findChild(menuBar, "menuBar-item0-menu-item0-menu-item0-actionItem");
355 mouseClick(actionItem);
356
357 actionItem = findChild(menuBar, "menuBar-item0-menu-item0-menu-item0-menu-item0-actionItem");
358
359 // There's one popup
360 tryCompareFunction(function() { return findChildsByType(root, "MenuPopup").length; }, 3);
361
362 menuBackend.modelData = null;
363
364 tryCompareFunction(function() { return findChildsByType(root, "MenuPopup").length; }, 0);
365 }
366
342 function test_firstDisabled() {367 function test_firstDisabled() {
343 var data = appMenuData.generateTestData(10,5,2,3);368 var data = appMenuData.generateTestData(10,5,2,3);
344 data[0].submenu[1].submenu[0].rowData.sensitive = false;369 data[0].submenu[1].submenu[0].rowData.sensitive = false;

Subscribers

People subscribed via source and target branches