Merge lp:~tpeeters/ubuntu-ui-toolkit/freeze into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters on 2016-04-13
Status: Merged
Approved by: Christian Dywan on 2016-04-18
Approved revision: 1958
Merged at revision: 1945
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/freeze
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 250 lines (+208/-4)
3 files modified
src/Ubuntu/Components/Popups/1.3/PopupBase.qml (+3/-3)
src/Ubuntu/Components/Popups/1.3/popupUtils.js (+6/-1)
tests/unit_x11/tst_components/tst_popups_pagestack.qml (+199/-0)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/freeze
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve on 2016-04-18
Christian Dywan 2016-04-13 Approve on 2016-04-18
Review via email: mp+291814@code.launchpad.net

Commit Message

Fix app freeze after closing Dialog/Popover.

Description of the Change

Fix app freeze after closing Dialog/Popover.

To post a comment you must log in.
1945. By Tim Peeters on 2016-04-13

clean

FAILED: Continuous integration, rev:1944
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/freeze/+merge/291814/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-stable/684/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/2618/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-stable/684/rebuild

review: Needs Fixing (continuous-integration)

FAILED: Continuous integration, rev:1944
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/freeze/+merge/291814/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-devel/465/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/2619/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-devel/465/rebuild

review: Needs Fixing (continuous-integration)

FAILED: Continuous integration, rev:1944
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/freeze/+merge/291814/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-armhf-stable/651/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/2620/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-armhf-stable/651/rebuild

review: Needs Fixing (continuous-integration)

FAILED: Continuous integration, rev:1944
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/freeze/+merge/291814/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-i386-gles-stable/439/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/2621/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-i386-gles-stable/439/rebuild

review: Needs Fixing (continuous-integration)
review: Needs Fixing (continuous-integration)

FAILED: Continuous integration, rev:1945
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/freeze/+merge/291814/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-stable/685/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/2623/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-stable/685/rebuild

review: Needs Fixing (continuous-integration)

FAILED: Continuous integration, rev:1945
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/freeze/+merge/291814/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-devel/466/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/2624/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-amd64-devel/466/rebuild

review: Needs Fixing (continuous-integration)

FAILED: Continuous integration, rev:1945
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/freeze/+merge/291814/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-armhf-stable/652/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/2625/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-armhf-stable/652/rebuild

review: Needs Fixing (continuous-integration)

FAILED: Continuous integration, rev:1945
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/freeze/+merge/291814/+edit-commit-message

https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-i386-gles-stable/440/
Executed test runs:
    None: https://jenkins.ubuntu.com/ubuntu-sdk/job/generic-update-mp/2626/console

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/ubuntu-sdk/job/ubuntu-ui-toolkit-ci-i386-gles-stable/440/rebuild

review: Needs Fixing (continuous-integration)
review: Needs Fixing (continuous-integration)
1946. By Tim Peeters on 2016-04-14

improve test

1947. By Tim Peeters on 2016-04-14

void

1948. By Tim Peeters on 2016-04-14

wait for clicked signal

1949. By Tim Peeters on 2016-04-14

click button in the middle

1950. By Tim Peeters on 2016-04-14

try CI again

1951. By Tim Peeters on 2016-04-14

kick CI again to make sure we didn't just get one lucky pass for a flaky test

1952. By Tim Peeters on 2016-04-14

wait more

1953. By Tim Peeters on 2016-04-14

try CI again to be sure

1954. By Tim Peeters on 2016-04-14

one more time ;)

1955. By Tim Peeters on 2016-04-15

comment

Christian Dywan (kalikiana) wrote :

I think the unit test should also cover a popover explicitly - it's shared code but the differences between the components are extensive.

review: Needs Fixing
1956. By Tim Peeters on 2016-04-15

add popover unit test

1957. By Tim Peeters on 2016-04-15

sync staging

Christian Dywan (kalikiana) wrote :

> property alias popoverComponent: popoverComponent
> [...]
> if (data.tag === "Dialog component") {
> popup = PopupUtils.open(pageStack.currentPage.dialogComponent);
The property should have a name that is the same for both tests, for instance "property alias popupComponent" could be popoverComponent or dialogComponent respectively, instead of if-deffing based on the tag. And note how I'm explicitly suggesting to have unique names to make it less confusing and error-prone.

review: Needs Fixing
Tim Peeters (tpeeters) wrote :

An alias only points to one object, you cannot just set it to another.

The only thing I can do is create an additional property Component popupComponent, and then in the test do "if-deffing" to set popupComponent = (for example)dialogComponent. But with that we don't win anything, and it will only make the test code longer. So, what do you propose?

Tim Peeters (tpeeters) wrote :

The CI failure above looks like a flaky tst_slotslayout which causes a segfault. I reported a bug for that here https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1571426

Christian Dywan (kalikiana) wrote :

> An alias only points to one object, you cannot just set it to another.
>
> The only thing I can do is create an additional property Component
> popupComponent, and then in the test do "if-deffing" to set popupComponent =
> (for example)dialogComponent. But with that we don't win anything, and it will
> only make the test code longer. So, what do you propose?

My bad, I didn't explain it properly. You have to put either the buttons or the components into the data function.

Using the buttons you could do it like test_popover_follows_pointerTarget_bug1199502 in tst_popover(13).qml which only clicks the button from the data function which in turn opens the popover (so manual testing behavior is identical to the unit test).
Or you can simply have popupComponent in the data function and use that. No need for an if.

1958. By Tim Peeters on 2016-04-18

click buttons in test

Christian Dywan (kalikiana) wrote :

Lovely, thanks for getting rid of the if!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/Popups/1.3/PopupBase.qml'
2--- src/Ubuntu/Components/Popups/1.3/PopupBase.qml 2015-10-10 12:43:26 +0000
3+++ src/Ubuntu/Components/Popups/1.3/PopupBase.qml 2016-04-18 09:51:10 +0000
4@@ -110,6 +110,9 @@
5 */
6 function __closePopup() {
7 if (popupBase !== undefined) {
8+ if (eventGrabber.enabled) {
9+ stateWrapper.restoreActiveFocus();
10+ }
11 popupBase.destroy();
12 }
13 }
14@@ -250,9 +253,6 @@
15 ScriptAction {
16 script: {
17 popupBase.visible = false;
18- if (eventGrabber.enabled) {
19- stateWrapper.restoreActiveFocus();
20- }
21 }
22 }
23 }
24
25=== modified file 'src/Ubuntu/Components/Popups/1.3/popupUtils.js'
26--- src/Ubuntu/Components/Popups/1.3/popupUtils.js 2015-07-17 15:20:27 +0000
27+++ src/Ubuntu/Components/Popups/1.3/popupUtils.js 2016-04-18 09:51:10 +0000
28@@ -1,5 +1,5 @@
29 /*
30- * Copyright 2012 Canonical Ltd.
31+ * Copyright 2016 Canonical Ltd.
32 *
33 * This program is free software; you can redistribute it and/or modify
34 * it under the terms of the GNU Lesser General Public License as published by
35@@ -78,6 +78,11 @@
36 if (caller)
37 caller.Component.onDestruction.connect(popupObject.__closePopup);
38
39+ // Instantly (no fading) close and destroy the popup when the component
40+ // gets destroyed because that invalidates the QML context of the popup
41+ // and prevents the closing after fadeout. See bug 1568016.
42+ popupComponent.Component.destruction.connect(popupObject.__closePopup);
43+
44 popupObject.show();
45 popupObject.onVisibleChanged.connect(popupObject.__closeIfHidden);
46 return popupObject;
47
48=== added file 'tests/unit_x11/tst_components/tst_popups_pagestack.qml'
49--- tests/unit_x11/tst_components/tst_popups_pagestack.qml 1970-01-01 00:00:00 +0000
50+++ tests/unit_x11/tst_components/tst_popups_pagestack.qml 2016-04-18 09:51:10 +0000
51@@ -0,0 +1,199 @@
52+/*
53+ * Copyright 2016 Canonical Ltd.
54+ *
55+ * This program is free software; you can redistribute it and/or modify
56+ * it under the terms of the GNU Lesser General Public License as published by
57+ * the Free Software Foundation; version 3.
58+ *
59+ * This program is distributed in the hope that it will be useful,
60+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
61+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
62+ * GNU Lesser General Public License for more details.
63+ *
64+ * You should have received a copy of the GNU Lesser General Public License
65+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
66+ */
67+
68+import QtTest 1.0
69+import QtQuick 2.4
70+import Ubuntu.Components 1.3
71+import Ubuntu.Components.Popups 1.3
72+import Ubuntu.Test 1.3
73+
74+Item {
75+ id: root
76+ width: units.gu(50)
77+ height: units.gu(80)
78+
79+ MainView {
80+ anchors.fill: parent
81+ id: mainview
82+ objectName: "mainview"
83+
84+ PageStack {
85+ id: pageStack
86+ objectName: "stack"
87+ property var popup
88+
89+ Component.onCompleted: push(startPage)
90+
91+ Page {
92+ id: startPage
93+ objectName: "startpage"
94+ visible: false
95+ header: PageHeader {
96+ title: "Start page"
97+ trailingActionBar.actions: [
98+ Action {
99+ text: "Settings"
100+ iconName: "settings"
101+ }
102+ ]
103+ }
104+ Button {
105+ id: continueButton
106+ anchors.centerIn: parent
107+ text: "Continue"
108+ onClicked: {
109+ pageStack.push(secondPageComponent)
110+ }
111+ }
112+ }
113+
114+ Component {
115+ id: secondPageComponent
116+ Page {
117+ id: secondPage
118+ objectName: "secondpage"
119+ header: PageHeader {
120+ title: "2. Page"
121+ }
122+
123+ Column {
124+ anchors.centerIn: parent
125+
126+ Button {
127+ objectName: "open_dialog_button"
128+ text: "Open dialog"
129+ onClicked: {
130+ pageStack.popup = PopupUtils.open(dialogComponent);
131+ }
132+ }
133+ Button {
134+ objectName: "open_popover_button"
135+ text: "Open popover"
136+ onClicked: {
137+ pageStack.popup = PopupUtils.open(popoverComponent);
138+ }
139+ }
140+ }
141+
142+ property alias dialogComponent: dialogComponent
143+ Component {
144+ id: dialogComponent
145+ Dialog {
146+ id: dialog
147+ objectName: "dialog"
148+ title: "Dialog"
149+ Button {
150+ text: "Close and pop page"
151+ onClicked: {
152+ PopupUtils.close(pageStack.popup);
153+ pageStack.pop();
154+ }
155+ }
156+ }
157+ }
158+ property alias popoverComponent: popoverComponent
159+ Component {
160+ id: popoverComponent
161+ Popover {
162+ id: popover
163+ objectName: "popover"
164+ Rectangle {
165+ anchors {
166+ left: parent.left
167+ right: parent.right
168+ }
169+ height: units.gu(35)
170+ color: UbuntuColors.ash
171+
172+ Button {
173+ anchors.centerIn: parent
174+ text: "Close and pop page"
175+ onClicked: {
176+ PopupUtils.close(pageStack.popup);
177+ pageStack.pop();
178+ }
179+ }
180+ }
181+ }
182+ }
183+ }
184+ }
185+ }
186+ }
187+
188+ UbuntuTestCase {
189+ name: "Dialog"
190+ when: windowShown
191+ id: testCase
192+
193+ SignalSpy {
194+ id: popupCloseSpy
195+ signalName: "onDestruction"
196+ }
197+
198+ SignalSpy {
199+ id: buttonSpy
200+ signalName: 'clicked'
201+ target: continueButton
202+ }
203+
204+ function cleanup() {
205+ pageStack.clear();
206+ pageStack.push(startPage);
207+ }
208+
209+ function test_close_and_pop_bug1568016_data() {
210+ return [
211+ { tag: "Dialog component",
212+ buttonName: "open_dialog_button"
213+ },
214+ { tag: "Popover component",
215+ buttonName: "open_popover_button"
216+ }
217+ ];
218+ }
219+
220+ function test_close_and_pop_bug1568016(data) {
221+ pageStack.push(secondPageComponent);
222+ waitForHeaderAnimation(mainview); // wait for the push() to finish
223+
224+ var popupButton = findChild(pageStack.currentPage, data.buttonName);
225+ mouseClick(popupButton, popupButton.width/2, popupButton.height/2);
226+ waitForRendering(pageStack.currentPage);
227+ verify(pageStack.popup,
228+ "Clicking the popup button did not set pageStack.popup.");
229+
230+ var popup = pageStack.popup;
231+ popupCloseSpy.target = popup.Component;
232+ popupCloseSpy.clear();
233+
234+ PopupUtils.close(popup);
235+ pageStack.pop();
236+
237+ popupCloseSpy.wait();
238+ // Introduce a short delay to wait for the pagestack to finish.
239+ // Without this, the test becomes flaky.
240+ waitForHeaderAnimation(mainview);
241+
242+ compare(pageStack.depth, 1, "PageStack.pop() failed.");
243+ compare(pageStack.currentPage, startPage, "Incorrect current page on PageStack.");
244+
245+ buttonSpy.clear();
246+ mouseClick(continueButton, continueButton.width/2, continueButton.height/2);
247+ buttonSpy.wait();
248+ }
249+ }
250+}

Subscribers

People subscribed via source and target branches