From 8b2528e377663254ae36b0ee4cbb1481e9365ce2 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 20 Mar 2017 12:18:26 +0100 Subject: Revert "Temporarily comment out line number-dependent SwipeDelegate tests" This reverts commit 6a5e030fbfa5f2adeabc6284f6ae3993e3d658c7. The qt5.git integration went through, so this can be reverted now to make way for a proper fix. Change-Id: I73f9aef29683172360e85026e1c8c93b8409eeae Reviewed-by: Liang Qi --- tests/auto/controls/data/tst_swipedelegate.qml | 207 ++++++++++++------------- 1 file changed, 103 insertions(+), 104 deletions(-) (limited to 'tests/auto/controls') diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml index 413b7d53..b9c72da9 100644 --- a/tests/auto/controls/data/tst_swipedelegate.qml +++ b/tests/auto/controls/data/tst_swipedelegate.qml @@ -119,29 +119,28 @@ TestCase { } } - // Temporary solution to allow qt5 merge to go through; see: QTBUG-59536 -// function test_horizontalAnchors_data() { -// return [ -// { tag: "background, fill", component: backgroundFillComponent, itemName: "background", warningLocation: ":69:25" }, -// { tag: "background, centerIn", component: backgroundCenterInComponent, itemName: "background", warningLocation: ":76:25" }, -// { tag: "background, left", component: backgroundLeftComponent, itemName: "background", warningLocation: ":83:25" }, -// { tag: "background, right", component: backgroundRightComponent, itemName: "background", warningLocation: ":90:25" }, -// { tag: "contentItem, fill", component: contentItemFillComponent, itemName: "contentItem", warningLocation: ":97:26" }, -// { tag: "contentItem, centerIn", component: contentItemCenterInComponent, itemName: "contentItem", warningLocation: ":104:26" }, -// { tag: "contentItem, left", component: contentItemLeftComponent, itemName: "contentItem", warningLocation: ":111:26" }, -// { tag: "contentItem, right", component: contentItemRightComponent, itemName: "contentItem", warningLocation: ":118:26" } -// ]; -// } + function test_horizontalAnchors_data() { + return [ + { tag: "background, fill", component: backgroundFillComponent, itemName: "background", warningLocation: ":69:25" }, + { tag: "background, centerIn", component: backgroundCenterInComponent, itemName: "background", warningLocation: ":76:25" }, + { tag: "background, left", component: backgroundLeftComponent, itemName: "background", warningLocation: ":83:25" }, + { tag: "background, right", component: backgroundRightComponent, itemName: "background", warningLocation: ":90:25" }, + { tag: "contentItem, fill", component: contentItemFillComponent, itemName: "contentItem", warningLocation: ":97:26" }, + { tag: "contentItem, centerIn", component: contentItemCenterInComponent, itemName: "contentItem", warningLocation: ":104:26" }, + { tag: "contentItem, left", component: contentItemLeftComponent, itemName: "contentItem", warningLocation: ":111:26" }, + { tag: "contentItem, right", component: contentItemRightComponent, itemName: "contentItem", warningLocation: ":118:26" } + ]; + } -// function test_horizontalAnchors(data) { -// var warningMessage = Qt.resolvedUrl("tst_swipedelegate.qml") + data.warningLocation -// + ": QML : SwipeDelegate: cannot use horizontal anchors with " + data.itemName + "; unable to layout the item." + function test_horizontalAnchors(data) { + var warningMessage = Qt.resolvedUrl("tst_swipedelegate.qml") + data.warningLocation + + ": QML : SwipeDelegate: cannot use horizontal anchors with " + data.itemName + "; unable to layout the item." -// ignoreWarning(warningMessage); + ignoreWarning(warningMessage); -// var control = createTemporaryObject(data.component, testCase); -// verify(control.contentItem); -// } + var control = createTemporaryObject(data.component, testCase); + verify(control.contentItem); + } Component { id: greenLeftComponent @@ -212,90 +211,90 @@ TestCase { } } -// function test_settingDelegates() { -// var control = createTemporaryObject(swipeDelegateComponent, testCase); -// verify(control); - -// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + -// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties") -// control.swipe.behind = itemComponent; - -// // Shouldn't be any warnings when unsetting delegates. -// control.swipe.left = null; -// compare(control.swipe.leftItem, null); - -// // right is still set. -// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + -// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties") -// control.swipe.behind = itemComponent; - -// control.swipe.right = null; -// compare(control.swipe.rightItem, null); - -// control.swipe.behind = itemComponent; - -// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + -// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties") -// control.swipe.left = itemComponent; - -// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + -// ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties") -// control.swipe.right = itemComponent; - -// 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.swipe.left; -// var oldLeftItem = control.swipe.leftItem; -// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + -// ":168: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.swipe.right; -// var oldRightItem = control.swipe.rightItem; -// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + -// ":168: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); - -// tryCompare(control.background, "x", 0, 1000); - -// // Try the same thing with the behind item. -// 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.swipe.behind; -// var oldBehindItem = control.swipe.behindItem; -// ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + -// ":168: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); -// } + function test_settingDelegates() { + var control = createTemporaryObject(swipeDelegateComponent, testCase); + verify(control); + + ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + + ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties") + control.swipe.behind = itemComponent; + + // Shouldn't be any warnings when unsetting delegates. + control.swipe.left = null; + compare(control.swipe.leftItem, null); + + // right is still set. + ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + + ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties") + control.swipe.behind = itemComponent; + + control.swipe.right = null; + compare(control.swipe.rightItem, null); + + control.swipe.behind = itemComponent; + + ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + + ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties") + control.swipe.left = itemComponent; + + ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + + ":168:9: QML SwipeDelegate: cannot set both behind and left/right properties") + control.swipe.right = itemComponent; + + 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.swipe.left; + var oldLeftItem = control.swipe.leftItem; + ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + + ":168: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.swipe.right; + var oldRightItem = control.swipe.rightItem; + ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + + ":168: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); + + tryCompare(control.background, "x", 0, 1000); + + // Try the same thing with the behind item. + 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.swipe.behind; + var oldBehindItem = control.swipe.behindItem; + ignoreWarning(Qt.resolvedUrl("tst_swipedelegate.qml") + + ":168: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); + } function test_defaults() { var control = createTemporaryObject(swipeDelegateComponent, testCase); -- cgit v1.2.3