Merge lp:~mterry/unity8/robustify-testEdgeDemoOverlay into lp:unity8

Proposed by Michael Terry
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 512
Merged at revision: 512
Proposed branch: lp:~mterry/unity8/robustify-testEdgeDemoOverlay
Merge into: lp:unity8
Diff against target: 27 lines (+4/-2)
2 files modified
Components/EdgeDemoOverlay.qml (+2/-0)
tests/qmltests/Components/tst_EdgeDemoOverlay.qml (+2/-2)
To merge this branch: bzr merge lp:~mterry/unity8/robustify-testEdgeDemoOverlay
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Albert Astals Cid (community) Approve
Review via email: mp+194461@code.launchpad.net

Commit message

Make EdgeDemoOverlay test more reliable by testing for what we really care about, not an indirect indicator of it.

Description of the change

Make EdgeDemoOverlay test more reliable by testing for what we really care about, not an indirect indicator of it.

Turns out that tryCompare(obj, "prop", 1.0) will possibly return successfully at values like 0.999992, before other qml bindings on that property would consider it to be at value 1.0. So it's not wise to tryCompare on a value, expecting that a successful return will mean related qml bindings will have triggered at the same time.

The EdgeDemoOverlay qmltest was relying on just such an indirect test. Fixed to test what we really care about.

To post a comment you must log in.
Revision history for this message
Albert Astals Cid (aacid) wrote :

Robust++ :-)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Components/EdgeDemoOverlay.qml'
2--- Components/EdgeDemoOverlay.qml 2013-09-27 23:33:47 +0000
3+++ Components/EdgeDemoOverlay.qml 2013-11-08 08:28:38 +0000
4@@ -105,6 +105,8 @@
5 visible: overlay.active
6
7 MouseArea {
8+ objectName: "backgroundShadeMouseArea"
9+
10 anchors.fill: parent
11 enabled: overlay.edge == "none" && overlay.opacity == 1.0
12 onClicked: overlay.doSkip()
13
14=== modified file 'tests/qmltests/Components/tst_EdgeDemoOverlay.qml'
15--- tests/qmltests/Components/tst_EdgeDemoOverlay.qml 2013-08-27 13:46:35 +0000
16+++ tests/qmltests/Components/tst_EdgeDemoOverlay.qml 2013-11-08 08:28:38 +0000
17@@ -112,8 +112,8 @@
18 // Test that the 'none' edge skips anywhere
19 signalSpy.target = none
20 signalSpy.clear()
21- var backgroundShade = findChild(none, "backgroundShade")
22- tryCompare(none, "opacity", 1)
23+ var backgroundShade = findChild(none, "backgroundShadeMouseArea")
24+ tryCompare(backgroundShade, "enabled", true)
25 mousePress(backgroundShade, 1, 1)
26 mouseRelease(backgroundShade, 1, 1)
27 signalSpy.wait()

Subscribers

People subscribed via source and target branches