on xenial help sign in
added a test to check for correct fullscreen behavior
c81ca0aMichael Zanetti
tests/qmltests/Stages/tst_PhoneStage.qml+55−16
@@ -83,6 +83,18 @@ Item {
83 }
83 }
84 }
84 }
85
85
86+ function goToSpread() {
87+ var spreadView = findChild(phoneStage, "spreadView");
88+
89+ var startX = phoneStage.width;
90+ var startY = phoneStage.height / 2;
91+ var endY = startY;
92+ var endX = units.gu(2);
93+
94+ touchFlick(phoneStage, startX, startY, endX, endY,
95+ true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
96+ }
97+
86 function test_shortFlick() {
98 function test_shortFlick() {
87 addApps(2)
99 addApps(2)
88 var startX = phoneStage.width - units.gu(1);
100 var startX = phoneStage.width - units.gu(1);
@@ -175,13 +187,7 @@ Item {
175
187
176 var spreadView = findChild(phoneStage, "spreadView");
188 var spreadView = findChild(phoneStage, "spreadView");
177
189
178− var startX = phoneStage.width;
190+ goToSpread();
179− var startY = phoneStage.height / 2;
180− var endY = startY;
181− var endX = spreadView.width - (spreadView.width * spreadView.positionMarker3) - 1 - phoneStage.dragAreaWidth;
182−
183− touchFlick(phoneStage, startX, startY, endX, endY,
184− true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
185
191
186 tryCompare(spreadView, "phase", 2);
192 tryCompare(spreadView, "phase", 2);
187
193
@@ -190,7 +196,11 @@ Item {
190
196
191 if (tile.mapToItem(spreadView).x > spreadView.width) {
197 if (tile.mapToItem(spreadView).x > spreadView.width) {
192 // Item is not visible... Need to flick the spread
198 // Item is not visible... Need to flick the spread
199+ var startX = phoneStage.width - units.gu(1);
200+ var startY = phoneStage.height / 2;
201+ var endY = startY;
202+ var endX = units.gu(2);
193− touchFlick(phoneStage, startX - units.gu(1), startY, endX, endY, true, true, units.gu(10), 50)
203+ touchFlick(phoneStage, startX, startY, endX, endY, true, true, units.gu(10), 50)
194 tryCompare(spreadView, "flicking", false);
204 tryCompare(spreadView, "flicking", false);
195 tryCompare(spreadView, "moving", false);
205 tryCompare(spreadView, "moving", false);
196// waitForRendering(phoneStage);
206// waitForRendering(phoneStage);
@@ -224,16 +234,9 @@ Item {
224 addApps(5);
234 addApps(5);
225
235
226 var spreadView = findChild(phoneStage, "spreadView");
236 var spreadView = findChild(phoneStage, "spreadView");
227−
228− var startX = phoneStage.width;
229− var startY = phoneStage.height / 2;
230− var endY = startY;
231− var endX = units.gu(2);
232−
233 var selectedApp = ApplicationManager.get(data.index);
237 var selectedApp = ApplicationManager.get(data.index);
234
238
235− touchFlick(phoneStage, startX, startY, endX, endY,
239+ goToSpread();
236− true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
237
240
238 phoneStage.select(selectedApp.appId);
241 phoneStage.select(selectedApp.appId);
239
242
@@ -241,6 +244,42 @@ Item {
241 compare(ApplicationManager.focusedApplicationId, selectedApp.appId);
244 compare(ApplicationManager.focusedApplicationId, selectedApp.appId);
242 }
245 }
243
246
247+ function test_fullscreenMode() {
248+ for (var i = 0; i < 5; i++) {
249+ addApps(1);
250+ tryCompare(phoneStage, "fullscreen", ApplicationManager.get(0).fullscreen);
251+ }
252+
253+ var fullscreenApp = null;
254+ var normalApp = null;
255+
256+ for (var i = 0; i < ApplicationManager.count; i++) {
257+ if (ApplicationManager.get(i).fullscreen && fullscreenApp == null) {
258+ fullscreenApp = ApplicationManager.get(i);
259+ }
260+ if (!ApplicationManager.get(i).fullscreen && normalApp == null) {
261+ normalApp = ApplicationManager.get(i);
262+ }
263+ }
264+ verify(fullscreenApp != null); // Can't continue the test without having a fullscreen app
265+ verify(normalApp != null); // Can't continue the test without having a non-fullscreen app
266+
267+ // Select a normal app
268+ goToSpread();
269+ phoneStage.select(normalApp.appId);
270+ tryCompare(phoneStage, "fullscreen", false);
271+
272+ // Select a fullscreen app
273+ goToSpread();
274+ phoneStage.select(fullscreenApp.appId);
275+ tryCompare(phoneStage, "fullscreen", true);
276+
277+ // Select a normal app
278+ goToSpread();
279+ phoneStage.select(normalApp.appId);
280+ tryCompare(phoneStage, "fullscreen", false);
281+ }
282+
244 function cleanup() {
283 function cleanup() {
245 while (ApplicationManager.count > 0) {
284 while (ApplicationManager.count > 0) {
246 var oldCount = ApplicationManager.count;
285 var oldCount = ApplicationManager.count;