on xenial help sign in
Fix tests, add one for the none case
35d7b3fMichael Terry
Components/EdgeDemo.qml+9−8
@@ -52,9 +52,9 @@ Item {
52 }
52 }
53
53
54 function stopDemo() {
54 function stopDemo() {
55− launcherEnabled = true;
55+ launcherEnabled = true
56− dashEnabled = true;
56+ dashEnabled = true
57− panelEnabled = true;
57+ panelEnabled = true
58 if (d.rightEdgeDemo) d.rightEdgeDemo.destroy()
58 if (d.rightEdgeDemo) d.rightEdgeDemo.destroy()
59 if (d.topEdgeDemo) d.topEdgeDemo.destroy()
59 if (d.topEdgeDemo) d.topEdgeDemo.destroy()
60 if (d.bottomEdgeDemo) d.bottomEdgeDemo.destroy()
60 if (d.bottomEdgeDemo) d.bottomEdgeDemo.destroy()
@@ -100,7 +100,7 @@ Item {
100 target: demo.greeter
100 target: demo.greeter
101
101
102 function hide() {
102 function hide() {
103− if (d.rightEdgeDemo) {
103+ if (d.rightEdgeDemo && d.rightEdgeDemo.active) {
104 d.rightEdgeDemo.hide()
104 d.rightEdgeDemo.hide()
105 hideEdgeDemoInGreeter()
105 hideEdgeDemoInGreeter()
106 startTopEdgeDemo()
106 startTopEdgeDemo()
@@ -112,7 +112,7 @@ Item {
112
112
113 onSelected: {
113 onSelected: {
114 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
114 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
115− showEdgeDemo = true;///AccountsService.getUserProperty(user, "demo-edges")
115+ showEdgeDemo = AccountsService.getUserProperty(user, "demo-edges")
116 }
116 }
117 }
117 }
118
118
@@ -134,7 +134,7 @@ Item {
134 Connections {
134 Connections {
135 target: demo.indicators
135 target: demo.indicators
136 onFullyOpenedChanged: {
136 onFullyOpenedChanged: {
137− if (d.topEdgeDemo && demo.indicators.fullyOpened) {
137+ if (d.topEdgeDemo && d.topEdgeDemo.active && demo.indicators.fullyOpened) {
138 d.topEdgeDemo.hideNow()
138 d.topEdgeDemo.hideNow()
139 startBottomEdgeDemo()
139 startBottomEdgeDemo()
140 }
140 }
@@ -158,7 +158,7 @@ Item {
158 Connections {
158 Connections {
159 target: demo.indicators
159 target: demo.indicators
160 onPartiallyOpenedChanged: {
160 onPartiallyOpenedChanged: {
161− if (d.bottomEdgeDemo && !demo.indicators.partiallyOpened && !demo.indicators.fullyOpened) {
161+ if (d.bottomEdgeDemo && d.bottomEdgeDemo.active && !demo.indicators.partiallyOpened && !demo.indicators.fullyOpened) {
162 d.bottomEdgeDemo.hideNow()
162 d.bottomEdgeDemo.hideNow()
163 startLeftEdgeDemo()
163 startLeftEdgeDemo()
164 }
164 }
@@ -184,8 +184,9 @@ Item {
184 Connections {
184 Connections {
185 target: demo.launcher
185 target: demo.launcher
186 onStateChanged: {
186 onStateChanged: {
187− if (d.leftEdgeDemo && launcher.state == "visible") {
187+ if (d.leftEdgeDemo && d.leftEdgeDemo.active && launcher.state == "visible") {
188 d.leftEdgeDemo.hide()
188 d.leftEdgeDemo.hide()
189+ launcher.hide()
189 startFinalEdgeDemo()
190 startFinalEdgeDemo()
190 }
191 }
191 }
192 }
Components/EdgeDemoOverlay.qml+2
@@ -82,6 +82,8 @@ Showable {
82 }
82 }
83
83
84 Rectangle {
84 Rectangle {
85+ objectName: "backgroundShade"
86+
85 anchors.fill: parent
87 anchors.fill: parent
86 color: "black"
88 color: "black"
87 opacity: 0.8
89 opacity: 0.8
tests/qmltests/CMakeLists.txt+1−1
@@ -28,9 +28,9 @@ set(qmltest_DEFAULT_PROPERTIES "")
28
28
29add_qml_test(. Shell IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks
29add_qml_test(. Shell IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks
30 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
30 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
31−add_qml_test(Components DemoOverlay)
32add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
31add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
33add_qml_test(Components DraggingArea)
32add_qml_test(Components DraggingArea)
33+add_qml_test(Components EdgeDemoOverlay)
34add_qml_test(Components FilterGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins)
34add_qml_test(Components FilterGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins)
35add_qml_test(Components ResponsiveFlowView)
35add_qml_test(Components ResponsiveFlowView)
36add_qml_test(Components ResponsiveGridView)
36add_qml_test(Components ResponsiveGridView)
tests/qmltests/Components/tst_DemoOverlay.qml → tests/qmltests/Components/tst_EdgeDemoOverlay.qmlrenamed+48−24
@@ -21,61 +21,74 @@ import "../../../Components"
21
21
22Item {
22Item {
23 id: root
23 id: root
24− width: 700
24+ width: boxWidth * 3
25− height: 500
25+ height: boxHeight * 2
26
26
27− DemoOverlay {
27+ property int boxWidth: 250
28+ property int boxHeight: 250
29+
30+ EdgeDemoOverlay {
28 id: top
31 id: top
29 edge: "top"
32 edge: "top"
30 title: "Top"
33 title: "Top"
31 text: "Displayed on top left"
34 text: "Displayed on top left"
32− x: 0
35+ anchors.left: parent.left
33− y: 0
36+ anchors.top: parent.top
34− width: parent.width/2
37+ width: boxWidth
35− height: parent.height/2
38+ height: boxHeight
36 }
39 }
37
40
38− DemoOverlay {
41+ EdgeDemoOverlay {
39 id: right
42 id: right
40 edge: "right"
43 edge: "right"
41 title: "Right"
44 title: "Right"
42 text: "Displayed on top right"
45 text: "Displayed on top right"
43− x: parent.width/2
46+ anchors.right: parent.right
44− y: 0
47+ anchors.top: parent.top
45− width: parent.width/2
48+ width: boxWidth
46− height: parent.height/2
49+ height: boxHeight
47 }
50 }
48
51
49− DemoOverlay {
52+ EdgeDemoOverlay {
50 id: left
53 id: left
51 edge: "left"
54 edge: "left"
52 title: "Left"
55 title: "Left"
53 text: "Displayed on bottom right"
56 text: "Displayed on bottom right"
54− x: parent.width/2
57+ anchors.right: parent.right
55− y: parent.height/2
58+ anchors.bottom: parent.bottom
56− width: parent.width/2
59+ width: boxWidth
57− height: parent.height/2
60+ height: boxHeight
58 available: false
61 available: false
59 }
62 }
60
63
61− DemoOverlay {
64+ EdgeDemoOverlay {
62 id: bottom
65 id: bottom
63 edge: "bottom"
66 edge: "bottom"
64 title: "Bottom"
67 title: "Bottom"
65 text: "Displayed on bottom left"
68 text: "Displayed on bottom left"
66− x: 0
69+ anchors.left: parent.left
67− y: parent.height/2
70+ anchors.bottom: parent.bottom
68− width: parent.width/2
71+ width: boxWidth
69− height: parent.height/2
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
70 }
84 }
71
85
72 SignalSpy {
86 SignalSpy {
73 id: signalSpy
87 id: signalSpy
74− target: bottom
75 }
88 }
76
89
77 UT.UnityTestCase {
90 UT.UnityTestCase {
78− name: "DemoOverlay"
91+ name: "EdgeDemoOverlay"
79 when: windowShown
92 when: windowShown
80
93
81 function test_animations() {
94 function test_animations() {
@@ -89,6 +102,7 @@ Item {
89 }
102 }
90
103
91 function test_skip() {
104 function test_skip() {
105+ signalSpy.target = bottom
92 signalSpy.signalName = "skip"
106 signalSpy.signalName = "skip"
93 signalSpy.clear()
107 signalSpy.clear()
94 var bottomSkip = findChild(bottom, "skipLabel")
108 var bottomSkip = findChild(bottom, "skipLabel")
@@ -96,6 +110,16 @@ Item {
96 mouseRelease(bottomSkip, 1, 1)
110 mouseRelease(bottomSkip, 1, 1)
97 signalSpy.wait()
111 signalSpy.wait()
98 compare(bottom.available, false)
112 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)
99 }
123 }
100 }
124 }
101}
125}