on xenial help sign in
Fix tests, add one for the none case
commit35d7b3ff9c7d6cb13b1c82f2f2f44210c4cade4c authorMichael Terry <michael.terry@canonical.com> dateThu 22 Aug 2013, 15:57 (13 years ago) parenta31fbb6
4 files changed+60−33
Components/EdgeDemo.qml+9−8 Components/EdgeDemoOverlay.qml+2 tests/qmltests/CMakeLists.txt+1−1 tests/qmltests/Components/tst_DemoOverlay.qml → tests/qmltests/Components/tst_EdgeDemoOverlay.qml+48−24
Components/EdgeDemo.qml+9−8
@@ -52,9 +52,9 @@ Item {
5252 }
5353
5454 function stopDemo() {
55− launcherEnabled = true;
56− dashEnabled = true;
57− panelEnabled = true;
55+ launcherEnabled = true
56+ dashEnabled = true
57+ panelEnabled = true
5858 if (d.rightEdgeDemo) d.rightEdgeDemo.destroy()
5959 if (d.topEdgeDemo) d.topEdgeDemo.destroy()
6060 if (d.bottomEdgeDemo) d.bottomEdgeDemo.destroy()
@@ -100,7 +100,7 @@ Item {
100100 target: demo.greeter
101101
102102 function hide() {
103− if (d.rightEdgeDemo) {
103+ if (d.rightEdgeDemo && d.rightEdgeDemo.active) {
104104 d.rightEdgeDemo.hide()
105105 hideEdgeDemoInGreeter()
106106 startTopEdgeDemo()
@@ -112,7 +112,7 @@ Item {
112112
113113 onSelected: {
114114 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
115− showEdgeDemo = true;///AccountsService.getUserProperty(user, "demo-edges")
115+ showEdgeDemo = AccountsService.getUserProperty(user, "demo-edges")
116116 }
117117 }
118118
@@ -134,7 +134,7 @@ Item {
134134 Connections {
135135 target: demo.indicators
136136 onFullyOpenedChanged: {
137− if (d.topEdgeDemo && demo.indicators.fullyOpened) {
137+ if (d.topEdgeDemo && d.topEdgeDemo.active && demo.indicators.fullyOpened) {
138138 d.topEdgeDemo.hideNow()
139139 startBottomEdgeDemo()
140140 }
@@ -158,7 +158,7 @@ Item {
158158 Connections {
159159 target: demo.indicators
160160 onPartiallyOpenedChanged: {
161− if (d.bottomEdgeDemo && !demo.indicators.partiallyOpened && !demo.indicators.fullyOpened) {
161+ if (d.bottomEdgeDemo && d.bottomEdgeDemo.active && !demo.indicators.partiallyOpened && !demo.indicators.fullyOpened) {
162162 d.bottomEdgeDemo.hideNow()
163163 startLeftEdgeDemo()
164164 }
@@ -184,8 +184,9 @@ Item {
184184 Connections {
185185 target: demo.launcher
186186 onStateChanged: {
187− if (d.leftEdgeDemo && launcher.state == "visible") {
187+ if (d.leftEdgeDemo && d.leftEdgeDemo.active && launcher.state == "visible") {
188188 d.leftEdgeDemo.hide()
189+ launcher.hide()
189190 startFinalEdgeDemo()
190191 }
191192 }
Components/EdgeDemoOverlay.qml+2
@@ -82,6 +82,8 @@ Showable {
8282 }
8383
8484 Rectangle {
85+ objectName: "backgroundShade"
86+
8587 anchors.fill: parent
8688 color: "black"
8789 opacity: 0.8
tests/qmltests/CMakeLists.txt+1−1
@@ -28,9 +28,9 @@ set(qmltest_DEFAULT_PROPERTIES "")
2828
2929add_qml_test(. Shell IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks
3030 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
31−add_qml_test(Components DemoOverlay)
3231add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
3332add_qml_test(Components DraggingArea)
33+add_qml_test(Components EdgeDemoOverlay)
3434add_qml_test(Components FilterGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins)
3535add_qml_test(Components ResponsiveFlowView)
3636add_qml_test(Components ResponsiveGridView)
tests/qmltests/Components/tst_DemoOverlay.qml → tests/qmltests/Components/tst_EdgeDemoOverlay.qmlrenamed+48−24
@@ -21,61 +21,74 @@ import "../../../Components"
2121
2222Item {
2323 id: root
24− width: 700
25− height: 500
24+ width: boxWidth * 3
25+ height: boxHeight * 2
2626
27− DemoOverlay {
27+ property int boxWidth: 250
28+ property int boxHeight: 250
29+
30+ EdgeDemoOverlay {
2831 id: top
2932 edge: "top"
3033 title: "Top"
3134 text: "Displayed on top left"
32− x: 0
33− y: 0
34− width: parent.width/2
35− height: parent.height/2
35+ anchors.left: parent.left
36+ anchors.top: parent.top
37+ width: boxWidth
38+ height: boxHeight
3639 }
3740
38− DemoOverlay {
41+ EdgeDemoOverlay {
3942 id: right
4043 edge: "right"
4144 title: "Right"
4245 text: "Displayed on top right"
43− x: parent.width/2
44− y: 0
45− width: parent.width/2
46− height: parent.height/2
46+ anchors.right: parent.right
47+ anchors.top: parent.top
48+ width: boxWidth
49+ height: boxHeight
4750 }
4851
49− DemoOverlay {
52+ EdgeDemoOverlay {
5053 id: left
5154 edge: "left"
5255 title: "Left"
5356 text: "Displayed on bottom right"
54− x: parent.width/2
55− y: parent.height/2
56− width: parent.width/2
57− height: parent.height/2
57+ anchors.right: parent.right
58+ anchors.bottom: parent.bottom
59+ width: boxWidth
60+ height: boxHeight
5861 available: false
5962 }
6063
61− DemoOverlay {
64+ EdgeDemoOverlay {
6265 id: bottom
6366 edge: "bottom"
6467 title: "Bottom"
6568 text: "Displayed on bottom left"
66− x: 0
67− y: parent.height/2
68− width: parent.width/2
69− height: parent.height/2
69+ anchors.left: parent.left
70+ anchors.bottom: parent.bottom
71+ width: boxWidth
72+ height: boxHeight
73+ }
74+
75+ EdgeDemoOverlay {
76+ id: none
77+ edge: "none"
78+ title: "None"
79+ text: "Displayed on top middle"
80+ anchors.horizontalCenter: parent.horizontalCenter
81+ anchors.top: parent.top
82+ width: boxWidth
83+ height: boxHeight
7084 }
7185
7286 SignalSpy {
7387 id: signalSpy
74− target: bottom
7588 }
7689
7790 UT.UnityTestCase {
78− name: "DemoOverlay"
91+ name: "EdgeDemoOverlay"
7992 when: windowShown
8093
8194 function test_animations() {
@@ -89,6 +102,7 @@ Item {
89102 }
90103
91104 function test_skip() {
105+ signalSpy.target = bottom
92106 signalSpy.signalName = "skip"
93107 signalSpy.clear()
94108 var bottomSkip = findChild(bottom, "skipLabel")
@@ -96,6 +110,16 @@ Item {
96110 mouseRelease(bottomSkip, 1, 1)
97111 signalSpy.wait()
98112 compare(bottom.available, false)
113+
114+ // Test that the 'none' edge skips anywhere
115+ signalSpy.target = none
116+ signalSpy.clear()
117+ var backgroundShade = findChild(none, "backgroundShade")
118+ tryCompare(none, "opacity", 1)
119+ mousePress(backgroundShade, 1, 1)
120+ mouseRelease(backgroundShade, 1, 1)
121+ signalSpy.wait()
122+ compare(none.available, false)
99123 }
100124 }
101125}