aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-03 07:58:19 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-03 10:23:11 +0200
commite9855d8ac8afed5371330f4f83f7b7dd51d9026f (patch)
treec1f70cbc64d9fe5d07911601880c571b4d3cd8f0 /tests
parent508bb6ddde831fb0d0b7065b39d99be01b4e4771 (diff)
parent1b7b2d7ddb6a02fd2ccd1f29a431005b9e693723 (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Also update expected line numbers in tst_swipedelegate. Conflicts: .qmake.conf src/quicktemplates2/qquicktextarea.cpp src/quicktemplates2/qquicktextarea_p.h tests/auto/controls/data/tst_swipedelegate.qml Change-Id: I36323e3a633c1c750d23014e56a7c881963a1a30
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_swipedelegate.qml81
-rw-r--r--tests/auto/controls/data/tst_textarea.qml24
2 files changed, 104 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_swipedelegate.qml b/tests/auto/controls/data/tst_swipedelegate.qml
index 17aab877..255c1d6d 100644
--- a/tests/auto/controls/data/tst_swipedelegate.qml
+++ b/tests/auto/controls/data/tst_swipedelegate.qml
@@ -1161,4 +1161,85 @@ TestCase {
control.destroy();
}
+
+ Component {
+ id: backgroundFillComponent
+ SwipeDelegate {
+ background: Item { anchors.fill: parent }
+ }
+ }
+
+ Component {
+ id: backgroundCenterInComponent
+ SwipeDelegate {
+ background: Item { anchors.centerIn: parent }
+ }
+ }
+
+ Component {
+ id: backgroundLeftComponent
+ SwipeDelegate {
+ background: Item { anchors.left: parent.left }
+ }
+ }
+
+ Component {
+ id: backgroundRightComponent
+ SwipeDelegate {
+ background: Item { anchors.right: parent.right }
+ }
+ }
+
+ Component {
+ id: contentItemFillComponent
+ SwipeDelegate {
+ contentItem: Item { anchors.fill: parent }
+ }
+ }
+
+ Component {
+ id: contentItemCenterInComponent
+ SwipeDelegate {
+ contentItem: Item { anchors.centerIn: parent }
+ }
+ }
+
+ Component {
+ id: contentItemLeftComponent
+ SwipeDelegate {
+ contentItem: Item { anchors.left: parent.left }
+ }
+ }
+
+ Component {
+ id: contentItemRightComponent
+ SwipeDelegate {
+ contentItem: Item { anchors.right: parent.right }
+ }
+ }
+
+ function test_horizontalAnchors_data() {
+ return [
+ { tag: "background, fill", component: backgroundFillComponent, itemName: "background", warningLocation: ":1168:25" },
+ { tag: "background, centerIn", component: backgroundCenterInComponent, itemName: "background", warningLocation: ":1175:25" },
+ { tag: "background, left", component: backgroundLeftComponent, itemName: "background", warningLocation: ":1182:25" },
+ { tag: "background, right", component: backgroundRightComponent, itemName: "background", warningLocation: ":1189:25" },
+ { tag: "contentItem, fill", component: contentItemFillComponent, itemName: "contentItem", warningLocation: ":1196:26" },
+ { tag: "contentItem, centerIn", component: contentItemCenterInComponent, itemName: "contentItem", warningLocation: ":1203:26" },
+ { tag: "contentItem, left", component: contentItemLeftComponent, itemName: "contentItem", warningLocation: ":1210:26" },
+ { tag: "contentItem, right", component: contentItemRightComponent, itemName: "contentItem", warningLocation: ":1217: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."
+
+ ignoreWarning(warningMessage);
+
+ var control = data.component.createObject(testCase);
+ verify(control.contentItem);
+
+ control.destroy();
+ }
}
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml
index 1c5c5cc8..5d3e8d55 100644
--- a/tests/auto/controls/data/tst_textarea.qml
+++ b/tests/auto/controls/data/tst_textarea.qml
@@ -154,7 +154,7 @@ TestCase {
}
function test_flickable() {
- var control = flickable.createObject(testCase, {text:"line0"})
+ var control = flickable.createObject(testCase, {text:"line0", selectByMouse: true})
verify(control)
var textArea = control.TextArea.flickable
@@ -169,6 +169,28 @@ TestCase {
compare(control.contentWidth, textArea.contentWidth + textArea.leftPadding + textArea.rightPadding)
compare(control.contentHeight, textArea.contentHeight + textArea.topPadding + textArea.bottomPadding)
+ compare(textArea.cursorPosition, 0)
+
+ var center = textArea.positionAt(control.width / 2, control.height / 2)
+ verify(center > 0)
+ mouseClick(textArea, control.width / 2, control.height / 2)
+ compare(textArea.cursorPosition, center)
+
+ // click inside text area, but below flickable
+ var below = textArea.positionAt(control.width / 2, control.height + 1)
+ verify(below > center)
+ mouseClick(textArea, control.width / 2, control.height + 1)
+ compare(textArea.cursorPosition, center) // no change
+
+ // scroll down
+ control.contentY = -(control.contentHeight - control.height) / 2
+
+ // click inside textarea, but above flickable
+ var above = textArea.positionAt(control.width / 2, textArea.topPadding)
+ verify(above > 0 && above < center)
+ mouseClick(textArea, control.width / 2, 0)
+ compare(textArea.cursorPosition, center) // no change
+
control.destroy()
}