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

Proposed by Albert Astals Cid
Status: Rejected
Rejected by: Albert Astals Cid
Proposed branch: lp:~aacid/unity8/correctly_sized_menus_v2
Merge into: lp:unity8
Diff against target: 130 lines (+82/-5)
3 files modified
qml/ApplicationMenus/MenuPopup.qml (+8/-5)
tests/qmltests/ApplicationMenuDataLoader.qml (+59/-0)
tests/qmltests/ApplicationMenus/tst_MenuPopup.qml (+15/-0)
To merge this branch: bzr merge lp:~aacid/unity8/correctly_sized_menus_v2
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Unity Team Pending
Review via email: mp+314927@code.launchpad.net

Commit message

Make the MenuPopup size be the one of the biggest menu

Sadly introduces a binding loop, but we need it

Description of the change

See https://code.launchpad.net/~aacid/unity8/correctly_sized_menus/+merge/314920 for an alternative solution

* 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:2769
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2923/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3814
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2210
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2210
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3842
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3685
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3685/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3685
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3685/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3685
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3685/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3685
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3685/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3685
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3685/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3685
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3685/artifact/output/*zip*/output.zip

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

review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Unmerged revisions

2769. By Albert Astals Cid

Make the MenuPopup size be the one of the biggest menu

Sadly introduces a binding loop, but we need it

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/ApplicationMenus/MenuPopup.qml'
2--- qml/ApplicationMenus/MenuPopup.qml 2017-01-09 15:26:05 +0000
3+++ qml/ApplicationMenus/MenuPopup.qml 2017-01-17 16:04:15 +0000
4@@ -154,10 +154,7 @@
5 objectName: "listView"
6 Layout.fillHeight: true
7 Layout.fillWidth: true
8- contentWidth: MathUtils.clamp(contentItem.childrenRect.width,
9- __minimumWidth,
10- __maximumWidth)
11-
12+ contentWidth: contentItem.childrenRect.width
13 orientation: Qt.Vertical
14 interactive: contentHeight > height
15 clip: interactive
16@@ -222,7 +219,13 @@
17
18 property int __ownIndex: index
19
20- width: root.width
21+ width: {
22+ if (listView.contentWidth > implicitWidth) {
23+ return listView.contentWidth;
24+ } else {
25+ return MathUtils.clamp(implicitWidth, __minimumWidth, __maximumWidth)
26+ }
27+ }
28 enabled: model.isSeparator ? false : model.sensitive
29
30 sourceComponent: {
31
32=== modified file 'tests/qmltests/ApplicationMenuDataLoader.qml'
33--- tests/qmltests/ApplicationMenuDataLoader.qml 2017-01-06 14:07:36 +0000
34+++ tests/qmltests/ApplicationMenuDataLoader.qml 2017-01-17 16:04:15 +0000
35@@ -72,4 +72,63 @@
36 "shortcut": "Alt+F"
37 }
38 }]
39+
40+ property var differentSizesMenu: [{
41+ "rowData": { // 1.1
42+ "label": "Short",
43+ "sensitive": true,
44+ "isSeparator": false,
45+ "icon": "",
46+ "type": "com.canonical.indicator.test",
47+ "ext": {},
48+ "action": "menu0",
49+ "actionState": {},
50+ "isCheck": false,
51+ "isRadio": false,
52+ "isToggled": false,
53+ "shortcut": "Alt+F"
54+ }}, {
55+ "rowData": { // 1.2
56+ "label": "This is Medium",
57+ "sensitive": true,
58+ "isSeparator": false,
59+ "icon": "",
60+ "type": "com.canonical.indicator.test",
61+ "ext": {},
62+ "action": "menu1",
63+ "actionState": {},
64+ "isCheck": false,
65+ "isRadio": false,
66+ "isToggled": false,
67+ }}, {
68+ "rowData": { // row 1.2
69+ "label": "This is Medium v2",
70+ "sensitive": true,
71+ "isSeparator": false,
72+ "icon": "",
73+ "type": "com.canonical.indicator.test",
74+ "ext": {},
75+ "action": "menu2",
76+ "actionState": {},
77+ "isCheck": false,
78+ "isRadio": false,
79+ "isToggled": false,
80+ "shortcut": "Alt+G"
81+ }}, {
82+ "rowData": { // row 1.2
83+ "label": "This is really Looong",
84+ "sensitive": true,
85+ "isSeparator": false,
86+ "icon": "",
87+ "type": "com.canonical.indicator.test",
88+ "ext": {},
89+ "action": "menu2",
90+ "actionState": {},
91+ "isCheck": false,
92+ "isRadio": false,
93+ "isToggled": false,
94+ "shortcut": "Ctrl+Shift+T"
95+ }}
96+ ];
97+
98 }
99
100=== modified file 'tests/qmltests/ApplicationMenus/tst_MenuPopup.qml'
101--- tests/qmltests/ApplicationMenus/tst_MenuPopup.qml 2017-01-09 15:26:05 +0000
102+++ tests/qmltests/ApplicationMenus/tst_MenuPopup.qml 2017-01-17 16:04:15 +0000
103@@ -90,6 +90,7 @@
104 // recurse into submenu
105 var submenu = rows[i]["submenu"];
106 if (submenu) {
107+ waitForRendering(menuItem);
108 mouseClick(menuItem, menuItem.width/2, menuItem.height/2);
109 tryCompare(menuPriv, "currentItem", menuItem);
110
111@@ -203,5 +204,19 @@
112 keyClick(Qt.Key_Left, Qt.NoModifier);
113 tryCompareFunction(function() { return menuItem.popup !== null && menuItem.popup.visible }, false);
114 }
115+
116+ function test_differentSizes() {
117+ menuBackend.modelData = appMenuData.differentSizesMenu;
118+
119+ waitForRendering(page);
120+ var longWidth = page.width;
121+
122+ var menuData = appMenuData.differentSizesMenu;
123+ menuData.pop();
124+ menuBackend.modelData = menuData;
125+
126+ waitForRendering(page);
127+ verify(page.width < longWidth);
128+ }
129 }
130 }

Subscribers

People subscribed via source and target branches