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
1=== modified file 'qml/ApplicationMenus/MenuBar.qml'
2--- qml/ApplicationMenus/MenuBar.qml 2017-03-21 10:56:10 +0000
3+++ qml/ApplicationMenus/MenuBar.qml 2017-03-24 08:30:38 +0000
4@@ -224,6 +224,13 @@
5 }
6 }
7 }
8+
9+ Component.onDestruction: {
10+ if (__popup) {
11+ __popup.destroy();
12+ __popup = null;
13+ }
14+ }
15 } // Item ( delegate )
16 } // Repeater
17 } // Row
18
19=== modified file 'qml/ApplicationMenus/MenuPopup.qml'
20--- qml/ApplicationMenus/MenuPopup.qml 2017-03-21 10:56:10 +0000
21+++ qml/ApplicationMenus/MenuPopup.qml 2017-03-24 08:30:38 +0000
22@@ -297,6 +297,8 @@
23
24 width: MathUtils.clamp(implicitWidth, d.__minimumWidth, d.__maximumWidth)
25
26+ property Item popup: null
27+
28 action.onTriggered: {
29 submenuHoverTimer.stop();
30
31@@ -351,6 +353,13 @@
32 }
33 }
34 }
35+
36+ Component.onDestruction: {
37+ if (popup) {
38+ popup.destroy();
39+ popup = null;
40+ }
41+ }
42 }
43 }
44
45@@ -373,7 +382,7 @@
46 id: loader
47 objectName: root.objectName + "-item" + __ownIndex
48
49- property Item popup: null
50+ readonly property var popup: item ? item.popup : null
51 property var __menuData: model
52 property int __ownIndex: index
53 property bool __isSeparator: model.isSeparator
54
55=== modified file 'tests/qmltests/ApplicationMenus/tst_MenuBar.qml'
56--- tests/qmltests/ApplicationMenus/tst_MenuBar.qml 2017-03-21 10:56:10 +0000
57+++ tests/qmltests/ApplicationMenus/tst_MenuBar.qml 2017-03-24 08:30:38 +0000
58@@ -339,6 +339,31 @@
59 }, true);
60 }
61
62+ function test_stray_submenus() {
63+ menuBackend.modelData = appMenuData.generateTestData(3,4,1,0,"menu");
64+ var priv = findInvisibleChild(menuBar, "d");
65+
66+ var menuItem = findChild(menuBar, "menuBar-item0");
67+ menuItem.show();
68+ compare(priv.currentItem, menuItem, "CurrentItem should be set to item 0");
69+ compare(priv.currentItem.popupVisible, true, "Popup should be visible");
70+
71+ var actionItem = findChild(menuBar, "menuBar-item0-menu-item0-actionItem");
72+ mouseClick(actionItem);
73+
74+ actionItem = findChild(menuBar, "menuBar-item0-menu-item0-menu-item0-actionItem");
75+ mouseClick(actionItem);
76+
77+ actionItem = findChild(menuBar, "menuBar-item0-menu-item0-menu-item0-menu-item0-actionItem");
78+
79+ // There's one popup
80+ tryCompareFunction(function() { return findChildsByType(root, "MenuPopup").length; }, 3);
81+
82+ menuBackend.modelData = null;
83+
84+ tryCompareFunction(function() { return findChildsByType(root, "MenuPopup").length; }, 0);
85+ }
86+
87 function test_firstDisabled() {
88 var data = appMenuData.generateTestData(10,5,2,3);
89 data[0].submenu[1].submenu[0].rowData.sensitive = false;

Subscribers

People subscribed via source and target branches