~macslow/unity8/swipe-dismiss-snap-decisions

« back to all changes in this revision

Viewing changes to tests/qmltests/Stages/tst_PhoneStage.qml

Merge from wizard-import

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
            var startX = phoneStage.width - 2;
129
129
            var startY = phoneStage.height / 2;
130
130
            var endY = startY;
131
 
            var endX = units.gu(2);
 
131
            var endX = phoneStage.width / 2;
132
132
 
133
133
            touchFlick(phoneStage, startX, startY, endX, endY,
134
134
                       true /* beginTouch */, true /* endTouch */, units.gu(10), 50);
 
135
 
 
136
            tryCompare(spreadView, "phase", 2);
 
137
            waitForRendering(phoneStage);
135
138
        }
136
139
 
137
140
        function test_shortFlick() {
138
141
            addApps(2)
139
142
            var startX = phoneStage.width - units.gu(1);
140
143
            var startY = phoneStage.height / 2;
141
 
            var endX = phoneStage.width / 2;
 
144
            var endX = startX - units.gu(4);
142
145
            var endY = startY;
143
146
 
144
147
            var activeApp = ApplicationManager.get(0);
164
167
                {tag: "<position2 (non-linear)", positionMarker: "positionMarker2", linear: false, offset: -1, endPhase: 0, targetPhase: 0, newFocusedIndex: 1 },
165
168
                {tag: ">position2", positionMarker: "positionMarker2", linear: true, offset: +1, endPhase: 1, targetPhase: 0, newFocusedIndex: 1 },
166
169
                {tag: "<position3", positionMarker: "positionMarker3", linear: true, offset: -1, endPhase: 1, targetPhase: 0, newFocusedIndex: 1 },
167
 
                {tag: ">position3", positionMarker: "positionMarker3", linear: true, offset: +1, endPhase: 2, targetPhase: 2, newFocusedIndex: 2 },
 
170
                {tag: ">position3", positionMarker: "positionMarker3", linear: true, offset: +1, endPhase: 1, targetPhase: 2, newFocusedIndex: 2 },
168
171
            ];
169
172
        }
170
173
 
274
277
            compare(ApplicationManager.focusedApplicationId, selectedApp.appId);
275
278
        }
276
279
 
277
 
        function test_orientation_change_sent_to_focused_app() {
 
280
        function test_orientationChangeSentToFocusedApp() {
278
281
            phoneStage.orientation = Qt.PortraitOrientation;
279
282
            addApps(1);
280
283
 
286
289
            tryCompare(app, "orientation", Qt.LandscapeOrientation);
287
290
        }
288
291
 
289
 
        function test_orientation_change_not_sent_to_apps_while_spread_open() {
 
292
        function test_orientationChangeNotSentToAppsWhileSpreadOpen() {
290
293
            phoneStage.orientation = Qt.PortraitOrientation;
291
294
            addApps(1);
292
295
 
299
302
            tryCompare(app, "orientation", Qt.PortraitOrientation);
300
303
        }
301
304
 
302
 
        function test_orientation_change_not_sent_to_unfocused_app_until_it_focused() {
 
305
        function test_orientationChangeNotSentToUnfocusedAppUntilItFocused() {
303
306
            phoneStage.orientation = Qt.PortraitOrientation;
304
307
            addApps(1);
305
308
 
357
360
            tryCompare(firstApp, "state", ApplicationInfoInterface.Running);
358
361
            tryCompare(firstApp, "focused", true);
359
362
        }
 
363
 
 
364
        function test_cantCloseWhileSnapping() {
 
365
            addApps(2);
 
366
 
 
367
            goToSpread();
 
368
 
 
369
            var spreadView = findChild(phoneStage, "spreadView");
 
370
            var selectedApp = ApplicationManager.get(2);
 
371
 
 
372
            goToSpread();
 
373
 
 
374
            var app0 = findChild(spreadView, "appDelegate0");
 
375
            var app1 = findChild(spreadView, "appDelegate1");
 
376
            var app2 = findChild(spreadView, "appDelegate2");
 
377
 
 
378
            var dragArea0 = findChild(app0, "dragArea");
 
379
            var dragArea1 = findChild(app1, "dragArea");
 
380
            var dragArea2 = findChild(app2, "dragArea");
 
381
 
 
382
            compare(dragArea0.enabled, true);
 
383
            compare(dragArea1.enabled, true);
 
384
            compare(dragArea2.enabled, true);
 
385
 
 
386
            phoneStage.select(selectedApp.appId);
 
387
 
 
388
            // Make sure all drag areas are disabled instantly. Don't use tryCompare here!
 
389
            compare(dragArea0.enabled, false);
 
390
            compare(dragArea1.enabled, false);
 
391
            compare(dragArea2.enabled, false);
 
392
 
 
393
            tryCompare(spreadView, "contentX", -spreadView.shift)
 
394
        }
360
395
    }
361
396
}