2
* Copyright 2014 Canonical Ltd.
2
* Copyright 2014-2015 Canonical Ltd.
4
4
* This program is free software; you can redistribute it and/or modify
5
5
* it under the terms of the GNU General Public License as published by
117
116
session: sessionContainerLoader.item ? sessionContainerLoader.item.session : null
122
anchors { left: parent.left; right: parent.right }
123
text: "Rotate device \u27F3"
125
var orientation = sessionContainerLoader.item.orientation
126
if (orientation == Qt.PortraitOrientation) {
127
orientation = Qt.LandscapeOrientation;
128
} else if (orientation == Qt.LandscapeOrientation) {
129
orientation = Qt.InvertedPortraitOrientation;
130
} else if (orientation == Qt.InvertedPortraitOrientation) {
131
orientation = Qt.InvertedLandscapeOrientation;
133
orientation = Qt.PortraitOrientation;
135
sessionContainerLoader.item.orientation = orientation;
324
305
// wait for animation to end
325
306
tryCompareFunction(function() { return isContainerAnimating(childContainer); }, false);
328
function test_orientationPropagatedToChildren_data() {
329
return [ { tag: "count=1", count: 1 },
330
{ tag: "count=4", count: 4 } ];
333
/* Test orientation changes are propagated to all children immediately */
334
function test_orientationPropagatedToChildren(data) {
335
sessionCheckbox.checked = true;
336
var rootSessionContainer = sessionContainerLoader.item;
337
compare(rootSessionContainer.childSessions.count(), 0);
341
for (i = 0; i < data.count; i++) {
342
var session = ApplicationTest.addChildSession(rootSessionContainer.session,
344
session.createSurface();
345
rootSessionContainer.session.addChildSession(session);
347
// Check child SessionContainer has orientation matching the parent
348
var delegate = findChild(rootSessionContainer, "childDelegate" + i);
349
var childSessionContainer = findChild(delegate, "sessionContainer");
351
tryCompare(rootSessionContainer, "orientation", childSessionContainer.orientation);
353
sessions.push(session);
356
// Change orientation and verify all children updated
357
rootSessionContainer.orientation = Qt.LandscapeOrientation;
359
for (i = 0; i < data.count; i++) {
360
var delegate = findChild(rootSessionContainer, "childDelegate" + i);
361
var childSessionContainer = findChild(delegate, "sessionContainer");
363
tryCompare(rootSessionContainer, "orientation", childSessionContainer.orientation);
367
for (i = data.count-1; i >= 0; i--) {
368
ApplicationTest.removeSession(sessions[i]);