~saviq/unity8/build-arm64

« back to all changes in this revision

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

  • Committer: Michał Sawicz
  • Date: 2016-07-15 09:51:02 UTC
  • mfrom: (2400.1.142 unity8)
  • Revision ID: michal.sawicz@canonical.com-20160715095102-hf5ac4iqnfn1itpw
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
                    enabled: parent.promptSurfaceList !== null && parent.promptSurfaceList.count > 0
107
107
                    activeFocusOnPress: false
108
108
                    text: "Remove"
109
 
                    onClicked: { parent.promptSurfaceList.get(parent.promptSurfaceList.count - 1).close(); }
 
109
                    onClicked: { parent.promptSurfaceList.get(0).close(); }
110
110
                }
111
111
 
112
112
                Button {
241
241
 
242
242
            surfaceCheckbox.checked = false;
243
243
 
244
 
            console.log("killApps() start");
245
244
            killApps();
246
 
            console.log("killApps() end");
247
245
 
248
246
            root.fakeApplication = ApplicationManager.add("gallery-app");
249
247
            root.fakeApplication.manualSurfaceCreation = true;
449
447
            for (i = 0; i < 3; i++) {
450
448
                promptSurfaceList.createSurface();
451
449
                compare(promptSurfaces.count, i+1);
452
 
                waitUntilSurfaceContainerStopsAnimating(promptSurfaces.itemAt(promptSurfaces.count - 1));
 
450
                waitUntilSurfaceContainerStopsAnimating(promptSurfaces.itemAt(0));
453
451
            }
454
452
 
455
 
            for (i = 2; i >= 0; --i) {
456
 
                var promptSurface = promptSurfaceList.get(i);
 
453
            for (i = 3; i > 0; --i) {
 
454
                var promptSurface = promptSurfaceList.get(0);
457
455
                compare(promptSurface.activeFocus, true);
458
456
 
459
457
                promptSurface.close();
460
 
                tryCompareFunction(function() { return promptSurfaces.count; }, i);
 
458
                promptSurface = null;
 
459
                tryCompareFunction(function() { return promptSurfaces.count; }, i-1);
461
460
 
462
 
                if (i > 0) {
463
 
                    // active focus should have gone to the yongest remaining sibling
464
 
                    var previousPromptSurface = promptSurfaceList.get(i-1);
465
 
                    tryCompare(previousPromptSurface, "activeFocus", true);
 
461
                if (promptSurfaces.count > 0) {
 
462
                    // active focus should have gone to the new head of the list
 
463
                    promptSurface = promptSurfaceList.get(0);
 
464
                    tryCompare(promptSurface, "activeFocus", true);
466
465
                } else {
467
466
                    // active focus should have gone to the application surface
468
467
                    tryCompare(applicationWindow.surface, "activeFocus", true);
498
497
            delegate.surface.close();
499
498
            tryCompare(promptSurfaces, "count", 0);
500
499
        }
 
500
 
 
501
        // Check that the z value of SurfaceContainers for prompt surfaces go from highest
 
502
        // for index 0 to lowest for the last index in the prompt surface list.
 
503
        // Regression test for https://bugs.launchpad.net/bugs/1586219
 
504
        function test_promptSurfacesZOrdering() {
 
505
            var promptSurfaceList = root.fakeApplication.promptSurfaceList;
 
506
            var promptSurfaces = testCase.findChild(applicationWindow, "promptSurfacesRepeater");
 
507
 
 
508
            promptSurfaceList.createSurface();
 
509
 
 
510
            for (var i = 2; i <= 3; i++) {
 
511
                promptSurfaceList.createSurface();
 
512
                tryCompare(promptSurfaces, "count", i);
 
513
                waitUntilSurfaceContainerStopsAnimating(promptSurfaces.itemAt(0));
 
514
 
 
515
                for (var j = 1; j < promptSurfaces.count; j++) {
 
516
                    var delegate = promptSurfaces.itemAt(j);
 
517
                    var previousDelegate = promptSurfaces.itemAt(j-1);
 
518
                    verify(previousDelegate.z > delegate.z);
 
519
                }
 
520
            }
 
521
 
 
522
            // clean up
 
523
            while (promptSurfaceList.count > 0) {
 
524
                var currentCount = promptSurfaceList.count;
 
525
                promptSurfaceList.get(0).close();
 
526
                tryCompare(promptSurfaceList, "count", currentCount - 1);
 
527
            }
 
528
        }
501
529
    }
502
530
}