on xenial help sign in
remove tsts_Stage. Stage is not more.
a8fac2fMichael Zanetti
tests/plugins/Ubuntu/Gestures/CMakeLists.txt+1−1
@@ -41,7 +41,7 @@ macro(add_gesture_test CLASSNAME)
41 ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures)
41 ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures)
42
42
43 add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp)
43 add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp)
44− qt5_use_modules(${CLASSNAME}TestExec Test Core)
44+ qt5_use_modules(${CLASSNAME}TestExec Test Core Qml)
45 target_link_libraries(${CLASSNAME}TestExec UbuntuGestureQml)
45 target_link_libraries(${CLASSNAME}TestExec UbuntuGestureQml)
46endmacro(add_gesture_test)
46endmacro(add_gesture_test)
47
47
tests/qmltests/Components/tst_Stage.qmldeleted−278
@@ -1,278 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import QtTest 1.0
19−import ".."
20−import "../../../qml/Components"
21−import Unity.Application 0.1
22−import Ubuntu.Components 0.1
23−import Unity.Test 0.1 as UT
24−import "tst_Stage"
25−
26−Rectangle {
27− width: units.gu(70)
28− height: stageRect.height
29−
30− // Even though we replace the ApplicationScreenshot instances in Stage
31− // with our own fake ones, ApplicationScreenshot.qml still gives out a warning
32− // if shell.importUbuntuApplicationAvailable is missing.
33− // For we have this here for the sake of keeping a clean log output.
34− Item {
35− id: shell
36− property bool importUbuntuApplicationAvailable: false
37− }
38−
39− // A fake ApplicationManager implementation to be passed to Stage
40− QtObject {
41− id: fakeAppManager
42− property ListModel mainStageApplications: ListModel {}
43− property ListModel sideStageApplications: ListModel {}
44− property var mainStageFocusedApplication
45−
46− property Component fakeAppWindowComponent: Component {
47− Rectangle {
48− width: stage.width
49− height: stage.height
50− property alias text : txt.text
51− Text {id:txt}
52− }
53− }
54−
55− function activateApplication(desktopFile, argument) {
56− var appWindow = fakeAppWindowComponent.createObject(fakeWindowContainer)
57− var application = {
58− 'icon': "foo",
59− 'handle': desktopFile,
60− 'name': "Foo",
61− 'fullscreen': false,
62− 'desktopFile': desktopFile,
63− 'stage': ApplicationInfo.MainStage,
64− 'argument': 0,
65− 'color': desktopFile,
66− 'window': appWindow
67− };
68− appWindow.color = application.color
69− appWindow.text = desktopFile + " actual";
70−
71− mainStageApplications.append(application)
72− updateZOrderOfWindows(mainStageApplications)
73−
74− return application
75− }
76−
77− function focusApplication(application) {
78− mainStageFocusedApplication = application
79− }
80−
81− function getApplicationFromDesktopFile(desktopFile, stageType) {
82− var sideStage = (stage == ApplicationInfo.SideStage);
83− var applications = sideStage ? sideStageApplications
84− : mainStageApplications;
85−
86− for (var i = 0; i < applications.count; i++ ) {
87− var application = applications.get(i);
88− if (application.desktopFile === desktopFile) {
89− return application;
90− }
91− }
92− return null;
93− }
94−
95− function moveRunningApplicationStackPosition(from, to, stage) {
96− var sideStage = (stage == ApplicationInfo.SideStage);
97− var applications = sideStage ? sideStageApplications
98− : mainStageApplications;
99−
100− if (from !== to && applications.count > 0 && from >= 0 && to >= 0) {
101− applications.move(from, to, 1);
102− }
103−
104− updateZOrderOfWindows(applications)
105− }
106−
107− function updateZOrderOfWindows(applications) {
108− var nextZ = 100
109− for (var i = 0; i < applications.count; i++ ) {
110− var application = applications.get(i);
111− application.window.z = nextZ--;
112− }
113− }
114−
115− function deacticateApplication(desktopFile) {
116− for (var i = 0; i < mainStageApplications.count; i++ ) {
117− var application = mainStageApplications.get(i)
118− if (application.desktopFile === desktopFile) {
119− focusApplication(null)
120− application.window.destroy();
121− mainStageApplications.remove(i)
122− updateZOrderOfWindows(mainStageApplications)
123− return;
124− }
125− }
126− }
127− }
128−
129− Rectangle {
130− id: stageRect
131− x:0
132− y:0
133− width: childrenRect.width
134− height: childrenRect.height
135−
136− color: "grey"
137−
138− // This is where the fake windows are held.
139− // They stay behind the stage, so that the stage's screenshots are shown
140− // on top of them
141− // On a real usage scenario, the current application's surface is composited behind
142− // the shell's surface (where Stage lives). fakeWindowContainer simulates this stacking
143− Item {
144− id: fakeWindowContainer
145− anchors.fill: parent
146− }
147−
148−
149− // A black rectangle behind the stage so that the window switch animations
150− // look good, just like in Stage's real usage.
151− Rectangle {
152− anchors.fill: parent
153− color: "black"
154− visible: stage.usingScreenshots
155− }
156−
157− Stage {
158− id: stage
159− y: 0
160− shouldUseScreenshots: false
161− applicationManager: fakeAppManager
162− rightEdgeDraggingAreaWidth: units.gu(2)
163− fullyShown: true
164− fullyHidden: false
165− newApplicationScreenshot: FakeApplicationScreenshot {
166− id: newAppScreenshot
167− parent: stage
168− width: stage.width
169− height: stage.height - stage.y}
170− oldApplicationScreenshot: FakeApplicationScreenshot {
171− id: oldAppScreenshot
172− parent: stage
173− width: stage.width
174− height: stage.height - stage.y}
175− }
176− }
177−
178− Rectangle {
179− id: controlsRect
180− anchors.top: parent.top
181− anchors.bottom: parent.bottom
182− anchors.left: stageRect.right
183− anchors.right: parent.right
184− color: "lightgrey"
185−
186− Column {
187− id: controls
188− spacing: units.gu(1)
189− AppControl {id: redControl; desktopFile:"red"}
190− AppControl {id: greenControl; desktopFile:"green"}
191− AppControl {id: blueControl; desktopFile:"blue"}
192− }
193− }
194−
195− UT.UnityTestCase {
196− name: "Stage"
197− when: windowShown
198−
199− function isCurrentAppFadingOut() {
200− // it should get a bit translucent and smaller
201− return oldAppScreenshot.opacity < 0.99
202− && oldAppScreenshot.opacity >= 0.1
203− && oldAppScreenshot.scale < 0.99
204− && oldAppScreenshot.scale >= 0.1
205− && oldAppScreenshot.visible
206− }
207−
208− function init() {
209− redControl.checked = false;
210− greenControl.checked = false;
211− blueControl.checked = false;
212− // give some room for animations to start
213− wait(50)
214− // wait until animations end, if any
215− tryCompare(stage, "usingScreenshots", false)
216− }
217−
218− /* If you flick from the right edge of the stage leftwards it should cause an
219− application switch. */
220− function test_dragFromRightEdgeToSwitchApplication() {
221− redControl.checked = true
222−
223− tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
224− tryCompare(stage, "usingScreenshots", false) // and then for it to end
225− compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
226− compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
227−
228− greenControl.checked = true
229−
230− tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
231− tryCompare(stage, "usingScreenshots", false) // and then for it to end
232− compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "green")
233− compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "green")
234−
235− var touchX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
236− var touchY = stage.height / 2
237− touchFlick(stage, touchX, touchY, stage.width * 0.25, touchY)
238−
239− // wait until animations end, if any
240− tryCompare(stage, "usingScreenshots", false)
241−
242− // "red" should be the new topmost, focused, application
243− compare(fakeAppManager.mainStageFocusedApplication.desktopFile, "red")
244− compare(fakeAppManager.mainStageApplications.get(0).desktopFile, "red")
245− }
246−
247− /* When an application is launched, it needs a background before it's drawn on screen
248− so that the user does not see the previous running app while the new one is launching.
249− When switching between applications, backgrounds are unnecessary, 'cause the
250− applications are in front of them. */
251− function test_background() {
252− redControl.checked = true
253− tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
254−
255− compare(newAppScreenshot.withBackground, true, "starting app screenshot does not have background enabled")
256−
257− tryCompare(stage, "usingScreenshots", false) // wait for the animation to finish
258−
259− greenControl.checked = true
260− tryCompare(stage, "usingScreenshots", true) // wait for the animation to start
261− tryCompare(stage, "usingScreenshots", false) // and finish
262−
263− var draggingAreaCenterX = stage.width - (stage.rightEdgeDraggingAreaWidth / 2)
264− var draggingAreaCenterY = stage.height / 2
265− var finalTouchX = draggingAreaCenterX - units.gu(5)
266− touchFlick(stage, draggingAreaCenterX, draggingAreaCenterY,
267− finalTouchX, draggingAreaCenterY,
268− true /* beginTouch */, false /* endTouch */)
269−
270− // wait for the animation to start
271− tryCompare(stage, "usingScreenshots", true)
272−
273− compare(newAppScreenshot.withBackground, false, "switched app does have background enabled")
274−
275− touchRelease(stage, finalTouchX, draggingAreaCenterY)
276− }
277− }
278−}
tests/qmltests/Components/tst_Stage/AppControl.qmldeleted−42
@@ -1,42 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−
20−Row {
21− id: root
22− property string desktopFile
23− spacing: units.gu(1)
24−
25− property alias checked: checkbox.checked
26−
27− Label {text: root.desktopFile
28− anchors.verticalCenter: parent.verticalCenter
29− width:units.gu(5)}
30−
31− CheckBox {
32− id: checkbox
33− onCheckedChanged: {
34− if (checked) {
35− var app = fakeAppManager.activateApplication(root.desktopFile)
36− stage.activateApplication(root.desktopFile)
37− } else {
38− fakeAppManager.deacticateApplication(root.desktopFile)
39− }
40− }
41− }
42−}
tests/qmltests/Components/tst_Stage/FakeApplicationScreenshot.qmldeleted−53
@@ -1,53 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
12− *
13− * You should have received a copy of the GNU General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− */
16−
17−import QtQuick 2.0
18−
19−Item {
20− property var application
21− property bool withBackground: true
22− property bool ready: application != undefined
23−
24− function setApplication(app) {
25− application = app
26− }
27−
28− function clearApplication() {
29− setApplication(undefined)
30− }
31−
32− function scheduleUpdate() {}
33−
34− function updateFromCache() {}
35−
36− Rectangle {
37− id: rect
38− anchors.fill: parent
39− Text {id:text}
40− }
41−
42− onApplicationChanged: {
43− if (application) {
44− rect.color = application.color
45− text.text = application.desktopFile + " screenshot"
46− rect.visible = true
47− } else {
48− rect.color = "white"
49− text.text = "<NULL> screenshot"
50− rect.visible = false
51− }
52− }
53−}