aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/tst_swipedelegate.qml
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2016-05-23 09:54:56 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-05-23 09:49:04 +0000
commit11d5a011e87b9137b33626032eed336b999395a0 (patch)
tree9aaeaa1046223bb357a5f1d2f55710cf95a5c0f6 /tests/auto/controls/data/tst_swipedelegate.qml
parentd5dd0409f3d2e84289207a7b191ddc0cf1e79771 (diff)
SwipeDelegate: rename exposure to swipe, active to complete
"swipe" is both shorter and easier to understand. "complete" is easier to understand. Task-number: QTBUG-53519 Change-Id: I87ecba4ac878f033111ee56fa618b80b227858a7 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/auto/controls/data/tst_swipedelegate.qml')
-rw-r--r--tests/auto/controls/data/tst_swipedelegate.qml408
1 files changed, 204 insertions, 204 deletions
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml
index 59b37e8d..6666589f 100644
--- a/tests/auto/controls/data/tst_swipedelegate.qml
+++ b/tests/auto/controls/data/tst_swipedelegate.qml
@@ -79,8 +79,8 @@ TestCase {
id: swipeDelegate
text: "SwipeDelegate"
width: 150
- exposure.left: greenLeftComponent
- exposure.right: redRightComponent
+ swipe.left: greenLeftComponent
+ swipe.right: redRightComponent
}
}
@@ -89,9 +89,9 @@ TestCase {
verify(control);
compare(control.baselineOffset, control.contentItem.y + control.contentItem.baselineOffset);
- compare(control.exposure.position, 0);
+ compare(control.swipe.position, 0);
verify(!control.pressed);
- verify(!control.exposure.active);
+ verify(!control.swipe.complete);
control.destroy();
}
@@ -105,25 +105,25 @@ TestCase {
// Assumes that the delegate is smaller than the width of the control.
function swipe(control, from, to) {
// Sanity check.
- compare(control.exposure.position, from);
+ compare(control.swipe.position, from);
var distance = (to - from) * control.width;
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton);
mouseMove(control, control.width / 2 + distance, control.height / 2, Qt.LeftButton);
mouseRelease(control, control.width / 2 + distance, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, to);
-
- if (control.exposure.position === -1.0) {
- if (control.exposure.right)
- verify(control.exposure.rightItem);
- else if (control.exposure.behind)
- verify(control.exposure.behindItem);
- } else if (control.exposure.position === 1.0) {
- if (control.exposure.left)
- verify(control.exposure.leftItem);
- else if (control.exposure.behind)
- verify(control.exposure.behindItem);
+ compare(control.swipe.position, to);
+
+ if (control.swipe.position === -1.0) {
+ if (control.swipe.right)
+ verify(control.swipe.rightItem);
+ else if (control.swipe.behind)
+ verify(control.swipe.behindItem);
+ } else if (control.swipe.position === 1.0) {
+ if (control.swipe.left)
+ verify(control.swipe.leftItem);
+ else if (control.swipe.behind)
+ verify(control.swipe.behindItem);
}
}
@@ -133,57 +133,57 @@ TestCase {
ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
":78:9: QML SwipeDelegate: cannot set both behind and left/right properties")
- control.exposure.behind = itemComponent;
+ control.swipe.behind = itemComponent;
// Shouldn't be any warnings when unsetting delegates.
- control.exposure.left = null;
- compare(control.exposure.leftItem, null);
+ control.swipe.left = null;
+ compare(control.swipe.leftItem, null);
// right is still set.
ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
":78:9: QML SwipeDelegate: cannot set both behind and left/right properties")
- control.exposure.behind = itemComponent;
+ control.swipe.behind = itemComponent;
- control.exposure.right = null;
- compare(control.exposure.rightItem, null);
+ control.swipe.right = null;
+ compare(control.swipe.rightItem, null);
- control.exposure.behind = itemComponent;
+ control.swipe.behind = itemComponent;
ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
":78:9: QML SwipeDelegate: cannot set both behind and left/right properties")
- control.exposure.left = itemComponent;
+ control.swipe.left = itemComponent;
ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
":78:9: QML SwipeDelegate: cannot set both behind and left/right properties")
- control.exposure.right = itemComponent;
+ control.swipe.right = itemComponent;
- control.exposure.behind = null;
- control.exposure.left = greenLeftComponent;
- control.exposure.right = redRightComponent;
+ control.swipe.behind = null;
+ control.swipe.left = greenLeftComponent;
+ control.swipe.right = redRightComponent;
// Test that the user is warned when attempting to set or unset left or
// right item while they're exposed.
// First, try the left item.
swipe(control, 0.0, 1.0);
- var oldLeft = control.exposure.left;
- var oldLeftItem = control.exposure.leftItem;
+ var oldLeft = control.swipe.left;
+ var oldLeftItem = control.swipe.leftItem;
ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
- ":78:9: QML SwipeDelegate: left/right/behind properties may only be set when exposure.position is 0")
- control.exposure.left = null;
- compare(control.exposure.left, oldLeft);
- compare(control.exposure.leftItem, oldLeftItem);
+ ":78:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
+ control.swipe.left = null;
+ compare(control.swipe.left, oldLeft);
+ compare(control.swipe.leftItem, oldLeftItem);
// Try the same thing with the right item.
swipe(control, 1.0, -1.0);
- var oldRight = control.exposure.right;
- var oldRightItem = control.exposure.rightItem;
+ var oldRight = control.swipe.right;
+ var oldRightItem = control.swipe.rightItem;
ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
- ":78:9: QML SwipeDelegate: left/right/behind properties may only be set when exposure.position is 0")
- control.exposure.right = null;
- compare(control.exposure.right, oldRight);
- compare(control.exposure.rightItem, oldRightItem);
+ ":78:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
+ control.swipe.right = null;
+ compare(control.swipe.right, oldRight);
+ compare(control.swipe.rightItem, oldRightItem);
// Return to the default position.
swipe(control, -1.0, 0.0);
@@ -191,25 +191,25 @@ TestCase {
tryCompare(control.background, "x", 0, 1000);
// Try the same thing with the behind item.
- control.exposure.left = null;
- verify(!control.exposure.left);
- verify(!control.exposure.leftItem);
- control.exposure.right = null;
- verify(!control.exposure.right);
- verify(!control.exposure.rightItem);
- control.exposure.behind = greenLeftComponent;
- verify(control.exposure.behind);
- verify(!control.exposure.behindItem);
+ control.swipe.left = null;
+ verify(!control.swipe.left);
+ verify(!control.swipe.leftItem);
+ control.swipe.right = null;
+ verify(!control.swipe.right);
+ verify(!control.swipe.rightItem);
+ control.swipe.behind = greenLeftComponent;
+ verify(control.swipe.behind);
+ verify(!control.swipe.behindItem);
swipe(control, 0.0, 1.0);
- var oldBehind = control.exposure.behind;
- var oldBehindItem = control.exposure.behindItem;
+ var oldBehind = control.swipe.behind;
+ var oldBehindItem = control.swipe.behindItem;
ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") +
- ":78:9: QML SwipeDelegate: left/right/behind properties may only be set when exposure.position is 0")
- control.exposure.behind = null;
- compare(control.exposure.behind, oldBehind);
- compare(control.exposure.behindItem, oldBehindItem);
+ ":78:9: QML SwipeDelegate: left/right/behind properties may only be set when swipe.position is 0")
+ control.swipe.behind = null;
+ compare(control.swipe.behind, oldBehind);
+ compare(control.swipe.behindItem, oldBehindItem);
control.destroy();
}
@@ -229,89 +229,89 @@ TestCase {
mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }], "pressed"];
mousePress(control, control.width / 2, control.height / 2);
verify(control.pressed);
- compare(control.exposure.position, 0.0);
- verify(!control.exposure.active);
+ compare(control.swipe.position, 0.0);
+ verify(!control.swipe.complete);
verify(mouseSignalSequenceSpy.success);
- verify(!control.exposure.leftItem);
- verify(!control.exposure.rightItem);
+ verify(!control.swipe.leftItem);
+ verify(!control.swipe.rightItem);
// Drag to the right so that leftItem is created and visible.
mouseMove(control, control.width / 2 + overDragDistance, control.height / 2);
verify(control.pressed);
- compare(control.exposure.position, overDragDistance / control.width);
- verify(!control.exposure.active);
- verify(control.exposure.leftItem);
- verify(control.exposure.leftItem.visible);
- compare(control.exposure.leftItem.parent, control);
- compare(control.exposure.leftItem.objectName, "leftItem");
- verify(!control.exposure.rightItem);
+ compare(control.swipe.position, overDragDistance / control.width);
+ verify(!control.swipe.complete);
+ verify(control.swipe.leftItem);
+ verify(control.swipe.leftItem.visible);
+ compare(control.swipe.leftItem.parent, control);
+ compare(control.swipe.leftItem.objectName, "leftItem");
+ verify(!control.swipe.rightItem);
// Go back to 0.
mouseMove(control, control.width / 2, control.height / 2);
verify(control.pressed);
- compare(control.exposure.position, 0.0);
- verify(!control.exposure.active);
- verify(control.exposure.leftItem);
- verify(control.exposure.leftItem.visible);
- compare(control.exposure.leftItem.parent, control);
- compare(control.exposure.leftItem.objectName, "leftItem");
- verify(!control.exposure.rightItem);
+ compare(control.swipe.position, 0.0);
+ verify(!control.swipe.complete);
+ verify(control.swipe.leftItem);
+ verify(control.swipe.leftItem.visible);
+ compare(control.swipe.leftItem.parent, control);
+ compare(control.swipe.leftItem.objectName, "leftItem");
+ verify(!control.swipe.rightItem);
// Try the other direction. The right item should be created and visible,
// and the left item should be hidden.
mouseMove(control, control.width / 2 - overDragDistance, control.height / 2);
verify(control.pressed);
- compare(control.exposure.position, -overDragDistance / control.width);
- verify(!control.exposure.active);
- verify(control.exposure.leftItem);
- verify(!control.exposure.leftItem.visible);
- verify(control.exposure.rightItem);
- verify(control.exposure.rightItem.visible);
- compare(control.exposure.rightItem.parent, control);
- compare(control.exposure.rightItem.objectName, "rightItem");
+ compare(control.swipe.position, -overDragDistance / control.width);
+ verify(!control.swipe.complete);
+ verify(control.swipe.leftItem);
+ verify(!control.swipe.leftItem.visible);
+ verify(control.swipe.rightItem);
+ verify(control.swipe.rightItem.visible);
+ compare(control.swipe.rightItem.parent, control);
+ compare(control.swipe.rightItem.objectName, "rightItem");
// Now release outside the right edge of the control.
mouseMove(control, control.width * 1.1, control.height / 2);
verify(control.pressed);
- compare(control.exposure.position, 0.6);
- verify(!control.exposure.active);
- verify(control.exposure.leftItem);
- verify(control.exposure.leftItem.visible);
- verify(control.exposure.rightItem);
- verify(!control.exposure.rightItem.visible);
+ compare(control.swipe.position, 0.6);
+ verify(!control.swipe.complete);
+ verify(control.swipe.leftItem);
+ verify(control.swipe.leftItem.visible);
+ verify(control.swipe.rightItem);
+ verify(!control.swipe.rightItem.visible);
mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false }], "released", "clicked"];
mouseRelease(control, control.width / 2, control.height / 2);
verify(!control.pressed);
- compare(control.exposure.position, 1.0);
- verify(control.exposure.active);
+ compare(control.swipe.position, 1.0);
+ verify(control.swipe.complete);
verify(mouseSignalSequenceSpy.success);
- verify(control.exposure.leftItem);
- verify(control.exposure.leftItem.visible);
- verify(control.exposure.rightItem);
- verify(!control.exposure.rightItem.visible);
+ verify(control.swipe.leftItem);
+ verify(control.swipe.leftItem.visible);
+ verify(control.swipe.rightItem);
+ verify(!control.swipe.rightItem.visible);
tryCompare(control.contentItem, "x", control.width + control.leftPadding);
// Swiping from the right and releasing early should return position to 1.0.
mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }], "pressed"];
mousePress(control, control.width / 2, control.height / 2);
verify(control.pressed);
- compare(control.exposure.position, 1.0);
- // exposed should still be true, because we haven't moved yet, and hence
+ compare(control.swipe.position, 1.0);
+ // complete should still be true, because we haven't moved yet, and hence
// haven't started grabbing behind's mouse events.
- verify(control.exposure.active);
+ verify(control.swipe.complete);
verify(mouseSignalSequenceSpy.success);
mouseMove(control, control.width / 2 - overDragDistance, control.height / 2);
verify(control.pressed);
- verify(!control.exposure.active);
- compare(control.exposure.position, 1.0 - overDragDistance / control.width);
+ verify(!control.swipe.complete);
+ compare(control.swipe.position, 1.0 - overDragDistance / control.width);
mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false }], "released", "clicked"];
mouseRelease(control, control.width * 0.4, control.height / 2);
verify(!control.pressed);
- compare(control.exposure.position, 1.0);
- verify(control.exposure.active);
+ compare(control.swipe.position, 1.0);
+ verify(control.swipe.complete);
verify(mouseSignalSequenceSpy.success);
tryCompare(control.contentItem, "x", control.width + control.leftPadding);
@@ -319,20 +319,20 @@ TestCase {
mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }], "pressed"];
mousePress(control, control.width / 2, control.height / 2);
verify(control.pressed);
- compare(control.exposure.position, 1.0);
- verify(control.exposure.active);
+ compare(control.swipe.position, 1.0);
+ verify(control.swipe.complete);
verify(mouseSignalSequenceSpy.success);
mouseMove(control, control.width * -0.1, control.height / 2);
verify(control.pressed);
- verify(!control.exposure.active);
- compare(control.exposure.position, 0.4);
+ verify(!control.swipe.complete);
+ compare(control.swipe.position, 0.4);
mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": false }], "released", "clicked"];
mouseRelease(control, control.width * -0.1, control.height / 2);
verify(!control.pressed);
- compare(control.exposure.position, 0.0);
- verify(!control.exposure.active);
+ compare(control.swipe.position, 0.0);
+ verify(!control.swipe.complete);
verify(mouseSignalSequenceSpy.success);
tryCompare(control.contentItem, "x", control.leftPadding);
@@ -362,19 +362,19 @@ TestCase {
mouseSignalSequenceSpy.expectedSequence = [["pressedChanged", { "pressed": true }], "pressed"];
mousePress(control, control.width / 2, control.height / 2);
verify(control.pressed);
- compare(control.exposure.position, 0.0);
- verify(!control.exposure.active);
+ compare(control.swipe.position, 0.0);
+ verify(!control.swipe.complete);
verify(mouseSignalSequenceSpy.success);
- verify(!control.exposure.leftItem);
- verify(!control.exposure.rightItem);
+ verify(!control.swipe.leftItem);
+ verify(!control.swipe.rightItem);
// Swipe quickly to the side over a distance that is longer than the drag threshold,
// quicker than the expose velocity threshold, but shorter than the halfway mark.
mouseMove(control, control.width / 2 + distance, control.height / 2);
verify(control.pressed);
- compare(control.exposure.position, distance / control.width);
- verify(control.exposure.position < 0.5);
- verify(!control.exposure.active);
+ compare(control.swipe.position, distance / control.width);
+ verify(control.swipe.position < 0.5);
+ verify(!control.swipe.complete);
var expectedVisibleItem;
var expectedVisibleObjectName;
@@ -382,13 +382,13 @@ TestCase {
var expectedContentItemX;
if (distance > 0) {
expectedVisibleObjectName = "leftItem";
- expectedVisibleItem = control.exposure.leftItem;
- expectedHiddenItem = control.exposure.rightItem;
+ expectedVisibleItem = control.swipe.leftItem;
+ expectedHiddenItem = control.swipe.rightItem;
expectedContentItemX = control.width + control.leftPadding;
} else {
expectedVisibleObjectName = "rightItem";
- expectedVisibleItem = control.exposure.rightItem;
- expectedHiddenItem = control.exposure.leftItem;
+ expectedVisibleItem = control.swipe.rightItem;
+ expectedHiddenItem = control.swipe.leftItem;
expectedContentItemX = -control.width + control.leftPadding;
}
verify(expectedVisibleItem);
@@ -402,8 +402,8 @@ TestCase {
// and hence that the second timestamp isn't zero (can happen with e.g. release builds).
mouseRelease(control, control.width / 2 + distance, control.height / 2, Qt.LeftButton, Qt.NoModifier, 30);
verify(!control.pressed);
- compare(control.exposure.position, data.direction);
- verify(control.exposure.active);
+ compare(control.swipe.position, data.direction);
+ verify(control.swipe.complete);
verify(mouseSignalSequenceSpy.success);
verify(expectedVisibleItem);
verify(expectedVisibleItem.visible);
@@ -418,7 +418,7 @@ TestCase {
SwipeDelegate {
text: "SwipeDelegate"
width: 150
- exposure.right: Button {
+ swipe.right: Button {
width: parent.width
height: parent.height
text: "Boo!"
@@ -433,14 +433,14 @@ TestCase {
// The button should be pressed instead of the SwipeDelegate.
mouseDrag(control, control.width / 2, control.height / 2, -control.width, 0);
verify(!control.pressed);
- compare(control.exposure.position, -1.0);
- verify(control.exposure.rightItem);
- verify(control.exposure.rightItem.visible);
- compare(control.exposure.rightItem.parent, control);
+ compare(control.swipe.position, -1.0);
+ verify(control.swipe.rightItem);
+ verify(control.swipe.rightItem.visible);
+ compare(control.swipe.rightItem.parent, control);
mousePress(control, control.width / 2, control.height / 2);
verify(!control.pressed);
- var button = control.exposure.rightItem;
+ var button = control.swipe.rightItem;
verify(button.pressed);
mouseRelease(control, control.width / 2, control.height / 2);
@@ -449,7 +449,7 @@ TestCase {
// Returning back to a position of 0 and pressing on the control should
// result in the control being pressed.
mouseDrag(control, control.width / 2, control.height / 2, control.width * 0.6, 0);
- compare(control.exposure.position, 0);
+ compare(control.swipe.position, 0);
mousePress(control, control.width / 2, control.height / 2);
verify(control.pressed);
verify(!button.pressed);
@@ -524,7 +524,7 @@ TestCase {
text: modelData
width: listView.width
- onClicked: if (exposure.active) ListView.view.model.remove(index)
+ onClicked: if (swipe.complete) ListView.view.model.remove(index)
property alias removeAnimation: onRemoveAnimation
@@ -549,8 +549,8 @@ TestCase {
}
}
- exposure.left: Rectangle {
- color: rootDelegate.exposure.active && rootDelegate.pressed ? "#333" : "#444"
+ swipe.left: Rectangle {
+ color: rootDelegate.swipe.complete && rootDelegate.pressed ? "#333" : "#444"
anchors.fill: parent
Label {
@@ -573,18 +573,18 @@ TestCase {
var firstItem = listView.itemAt(0, 0);
mousePress(listView, firstItem.width / 2, firstItem.height / 2);
verify(firstItem.pressed);
- compare(firstItem.exposure.position, 0.0);
- verify(!firstItem.exposure.active);
+ compare(firstItem.swipe.position, 0.0);
+ verify(!firstItem.swipe.complete);
mouseMove(listView, firstItem.width * 1.1, firstItem.height / 2);
verify(firstItem.pressed);
- compare(firstItem.exposure.position, 0.6);
- verify(!firstItem.exposure.active);
+ compare(firstItem.swipe.position, 0.6);
+ verify(!firstItem.swipe.complete);
mouseRelease(listView, firstItem.width / 2, firstItem.height / 2);
verify(!firstItem.pressed);
- compare(firstItem.exposure.position, 1.0);
- verify(firstItem.exposure.active);
+ compare(firstItem.swipe.position, 1.0);
+ verify(firstItem.swipe.complete);
compare(listView.count, 3);
// Wait for it to settle down.
@@ -617,14 +617,14 @@ TestCase {
width: 150
text: "SwipeDelegate"
- exposure.left: Rectangle {
+ swipe.left: Rectangle {
x: delegate.background.x - width
width: delegate.width
height: delegate.height
color: "green"
}
- exposure.right: Rectangle {
+ swipe.right: Rectangle {
x: delegate.background.x + delegate.background.width
width: delegate.width
height: delegate.height
@@ -640,14 +640,14 @@ TestCase {
width: 150
text: "SwipeDelegate"
- exposure.left: Rectangle {
+ swipe.left: Rectangle {
anchors.right: delegate.background.left
width: delegate.width
height: delegate.height
color: "green"
}
- exposure.right: Rectangle {
+ swipe.right: Rectangle {
anchors.left: delegate.background.right
width: delegate.width
height: delegate.height
@@ -669,8 +669,8 @@ TestCase {
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton);
mouseMove(control, control.width, control.height / 2, Qt.LeftButton);
- verify(control.exposure.leftItem);
- compare(control.exposure.leftItem.x, -control.width / 2);
+ verify(control.swipe.leftItem);
+ compare(control.swipe.leftItem.x, -control.width / 2);
mouseRelease(control, control.width / 2, control.height / 2, Qt.LeftButton);
control.destroy();
@@ -683,11 +683,11 @@ TestCase {
// Should be limited within the range -1.0 to 1.0.
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton);
mouseMove(control, control.width * 1.5, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, 1.0);
+ compare(control.swipe.position, 1.0);
mouseMove(control, control.width * 1.6, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, 1.0);
+ compare(control.swipe.position, 1.0);
mouseMove(control, control.width * -1.6, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, -1.0);
+ compare(control.swipe.position, -1.0);
mouseRelease(control, control.width / 2, control.height / 2, Qt.LeftButton);
control.destroy();
@@ -712,34 +712,34 @@ TestCase {
}
}
- // exposure.position should be scaled to the width of the relevant delegate,
+ // swipe.position should be scaled to the width of the relevant delegate,
// and it shouldn't be possible to drag past the delegate (so that content behind the control is visible).
function test_delegateWidth() {
var control = emptySwipeDelegateComponent.createObject(testCase);
verify(control);
- control.exposure.left = smallLeftComponent;
+ control.swipe.left = smallLeftComponent;
// Ensure that the position is scaled to the width of the currently visible delegate.
var overDragDistance = dragDistance * 1.1;
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton);
mouseMove(control, control.width / 2 + overDragDistance, control.height / 2, Qt.LeftButton);
- verify(control.exposure.leftItem);
- compare(control.exposure.position, overDragDistance / control.exposure.leftItem.width);
+ verify(control.swipe.leftItem);
+ compare(control.swipe.position, overDragDistance / control.swipe.leftItem.width);
- mouseMove(control, control.width / 2 + control.exposure.leftItem.width, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, 1.0);
+ mouseMove(control, control.width / 2 + control.swipe.leftItem.width, control.height / 2, Qt.LeftButton);
+ compare(control.swipe.position, 1.0);
// Ensure that it's not possible to drag past the (left) delegate.
- mouseMove(control, control.width / 2 + control.exposure.leftItem.width + 1, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, 1.0);
+ mouseMove(control, control.width / 2 + control.swipe.leftItem.width + 1, control.height / 2, Qt.LeftButton);
+ compare(control.swipe.position, 1.0);
// Now release over the right side; the position should be 1.0 and the background
// should be "anchored" to the right side of the left delegate item.
- mouseMove(control, control.width / 2 + control.exposure.leftItem.width, control.height / 2, Qt.LeftButton);
- mouseRelease(control, control.width / 2 + control.exposure.leftItem.width, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, 1.0);
- tryCompare(control.background, "x", control.exposure.leftItem.width, 1000);
+ mouseMove(control, control.width / 2 + control.swipe.leftItem.width, control.height / 2, Qt.LeftButton);
+ mouseRelease(control, control.width / 2 + control.swipe.leftItem.width, control.height / 2, Qt.LeftButton);
+ compare(control.swipe.position, 1.0);
+ tryCompare(control.background, "x", control.swipe.leftItem.width, 1000);
control.destroy();
}
@@ -754,51 +754,51 @@ TestCase {
signalName: "visibleChanged"
}
- function test_positionAfterExposureMadeActive() {
+ function test_positionAfterSwipeCompleted() {
var control = swipeDelegateComponent.createObject(testCase);
verify(control);
// Ensure that both delegates are constructed.
mousePress(control, 0, control.height / 2, Qt.LeftButton);
mouseMove(control, control.width * 1.1, control.height / 2, Qt.LeftButton);
- verify(control.exposure.leftItem);
+ verify(control.swipe.leftItem);
mouseMove(control, control.width * -0.1, control.height / 2, Qt.LeftButton);
- verify(control.exposure.rightItem);
+ verify(control.swipe.rightItem);
// Expose the left delegate.
- mouseMove(control, control.exposure.leftItem.width, control.height / 2, Qt.LeftButton);
- mouseRelease(control, control.exposure.leftItem.width, control.height / 2);
- verify(control.exposure.active);
- compare(control.exposure.position, 1.0);
+ mouseMove(control, control.swipe.leftItem.width, control.height / 2, Qt.LeftButton);
+ mouseRelease(control, control.swipe.leftItem.width, control.height / 2);
+ verify(control.swipe.complete);
+ compare(control.swipe.position, 1.0);
- leftVisibleSpy.target = control.exposure.leftItem;
- rightVisibleSpy.target = control.exposure.rightItem;
+ leftVisibleSpy.target = control.swipe.leftItem;
+ rightVisibleSpy.target = control.swipe.rightItem;
// Swipe from right to left without exposing the right item,
// and make sure that the right item never becomes visible
// (and hence that the left item never loses visibility).
- mousePress(control, control.exposure.leftItem.width, control.height / 2, Qt.LeftButton);
+ mousePress(control, control.swipe.leftItem.width, control.height / 2, Qt.LeftButton);
compare(leftVisibleSpy.count, 0);
compare(rightVisibleSpy.count, 0);
- var newX = control.exposure.leftItem.width - dragDistance * 1.1;
+ var newX = control.swipe.leftItem.width - dragDistance * 1.1;
mouseMove(control, newX, control.height / 2, Qt.LeftButton, Qt.LeftButton);
compare(leftVisibleSpy.count, 0);
compare(rightVisibleSpy.count, 0);
- compare(control.exposure.position, newX / control.exposure.leftItem.width);
+ compare(control.swipe.position, newX / control.swipe.leftItem.width);
mouseMove(control, 0, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, 0);
+ compare(control.swipe.position, 0);
// Test swiping over a distance that is greater than the width of the left item.
mouseMove(control, -1, control.height / 2, Qt.LeftButton);
- verify(control.exposure.rightItem);
- compare(control.exposure.position, -1 / control.exposure.rightItem.width);
+ verify(control.swipe.rightItem);
+ compare(control.swipe.position, -1 / control.swipe.rightItem.width);
// Now go back to 1.0.
- mouseMove(control, control.exposure.leftItem.width, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, 1.0);
- tryCompare(control.background, "x", control.exposure.leftItem.width, 1000);
- mouseRelease(control, control.exposure.leftItem.width, control.height / 2, Qt.LeftButton);
+ mouseMove(control, control.swipe.leftItem.width, control.height / 2, Qt.LeftButton);
+ compare(control.swipe.position, 1.0);
+ tryCompare(control.background, "x", control.swipe.leftItem.width, 1000);
+ mouseRelease(control, control.swipe.leftItem.width, control.height / 2, Qt.LeftButton);
control.destroy();
}
@@ -808,22 +808,22 @@ TestCase {
// id: behindSwipeDelegateComponent
// SwipeDelegate {
// anchors.centerIn: parent
-// exposure.behind: Rectangle {
+// swipe.behind: Rectangle {
// onXChanged: print("x changed", x)
// anchors.left: {
-// print("anchors.left expression", exposure.position)
-// exposure.position < 0 ? parent.background.right : undefined
+// print("anchors.left expression", swipe.position)
+// swipe.position < 0 ? parent.background.right : undefined
// }
// anchors.right: {
-// print("anchors.right expression", exposure.position)
-// exposure.position > 0 ? parent.background.left : undefined
+// print("anchors.right expression", swipe.position)
+// swipe.position > 0 ? parent.background.left : undefined
// }
// width: parent.width
// height: parent.height
// color: "green"
// }
-// exposure.left: null
-// exposure.right: null
+// swipe.left: null
+// swipe.right: null
// Rectangle {
// anchors.fill: parent
// color: "transparent"
@@ -838,15 +838,15 @@ TestCase {
text: "SwipeDelegate"
width: 150
anchors.centerIn: parent
- exposure.behind: Rectangle {
- x: exposure.position < 0 ? parent.background.x + parent.background.width
- : (exposure.position > 0 ? parent.background.x - width : 0)
+ swipe.behind: Rectangle {
+ x: swipe.position < 0 ? parent.background.x + parent.background.width
+ : (swipe.position > 0 ? parent.background.x - width : 0)
width: parent.width
height: parent.height
color: "green"
}
- exposure.left: null
- exposure.right: null
+ swipe.left: null
+ swipe.right: null
}
}
@@ -855,34 +855,34 @@ TestCase {
verify(control);
swipe(control, 0.0, 1.0);
- verify(control.exposure.behindItem.visible);
- compare(control.exposure.behindItem.x, control.background.x - control.background.width);
+ verify(control.swipe.behindItem.visible);
+ compare(control.swipe.behindItem.x, control.background.x - control.background.width);
swipe(control, 1.0, -1.0);
- verify(control.exposure.behindItem.visible);
- compare(control.exposure.behindItem.x, control.background.x + control.background.width);
+ verify(control.swipe.behindItem.visible);
+ compare(control.swipe.behindItem.x, control.background.x + control.background.width);
swipe(control, -1.0, 1.0);
- verify(control.exposure.behindItem.visible);
- compare(control.exposure.behindItem.x, control.background.x - control.background.width);
+ verify(control.swipe.behindItem.visible);
+ compare(control.swipe.behindItem.x, control.background.x - control.background.width);
// Should be possible to "wrap" with a behind delegate specified.
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton);
- mouseMove(control, control.width / 2 + control.exposure.behindItem.width * 0.8, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, -0.2);
- mouseRelease(control, control.width / 2 + control.exposure.behindItem.width * 0.8, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, 0.0);
+ mouseMove(control, control.width / 2 + control.swipe.behindItem.width * 0.8, control.height / 2, Qt.LeftButton);
+ compare(control.swipe.position, -0.2);
+ mouseRelease(control, control.width / 2 + control.swipe.behindItem.width * 0.8, control.height / 2, Qt.LeftButton);
+ compare(control.swipe.position, 0.0);
// Try wrapping the other way.
swipe(control, 0.0, -1.0);
- verify(control.exposure.behindItem.visible);
- compare(control.exposure.behindItem.x, control.background.x + control.background.width);
+ verify(control.swipe.behindItem.visible);
+ compare(control.swipe.behindItem.x, control.background.x + control.background.width);
mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton);
- mouseMove(control, control.width / 2 - control.exposure.behindItem.width * 0.8, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, 0.2);
- mouseRelease(control, control.width / 2 - control.exposure.behindItem.width * 0.8, control.height / 2, Qt.LeftButton);
- compare(control.exposure.position, 0.0);
+ mouseMove(control, control.width / 2 - control.swipe.behindItem.width * 0.8, control.height / 2, Qt.LeftButton);
+ compare(control.swipe.position, 0.2);
+ mouseRelease(control, control.width / 2 - control.swipe.behindItem.width * 0.8, control.height / 2, Qt.LeftButton);
+ compare(control.swipe.position, 0.0);
control.destroy();
}