aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktextinput
diff options
context:
space:
mode:
authorAndreas Buhr <andreas@andreasbuhr.de>2022-04-20 07:09:39 +0200
committerAndreas Buhr <andreas@andreasbuhr.de>2022-04-25 11:44:25 +0200
commitf6c00214203924fb38c5d6c2af875f6355b11081 (patch)
tree948d2b6c8ede8a261fa0ddeb6087da0ac6596f0d /tests/auto/quick/qquicktextinput
parentd37263490c9934108bff637ac3da0604c02c5b08 (diff)
Fix tst_qquicktextinput on Android
In tst_qquicktextinput a mouseclick at position 5 of the string "Hello World" was simulated. Then it was checked that the cursor position is not zero. However, on Android, the cursor is placed at the beginning of the word which is clicked. The visible cursor is still where the click was, but the whole word goes to the uncommited state and thus the program sees the cursor at the beginning of the word. As the click was in the first word, the cursor position becomes zero and the test fails. This patch changes the test to click in the third word of the string "Hello my wonderful world". Pick-to: 6.2 6.3 Task-number: QTBUG-101865 Change-Id: I70b241af1ecefe64fcfd7723f808e93f70bfe0b8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicktextinput')
-rw-r--r--tests/auto/quick/qquicktextinput/data/cursorTest.qml2
-rw-r--r--tests/auto/quick/qquicktextinput/data/cursorTestExternal.qml2
-rw-r--r--tests/auto/quick/qquicktextinput/data/cursorTestInline.qml2
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp8
4 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/quick/qquicktextinput/data/cursorTest.qml b/tests/auto/quick/qquicktextinput/data/cursorTest.qml
index 363d37174b..44e81f9522 100644
--- a/tests/auto/quick/qquicktextinput/data/cursorTest.qml
+++ b/tests/auto/quick/qquicktextinput/data/cursorTest.qml
@@ -2,7 +2,7 @@ import QtQuick 2.0
Rectangle { id:rect; width: 300; height: 300; color: "white"
property string contextualProperty: "Hello"
- TextInput { text: "Hello world!"; id: textInputObject; objectName: "textInputObject"
+ TextInput { text: "Hello my wonderful world!"; id: textInputObject; objectName: "textInputObject"
width: 300; height: 300
resources: [ Component { id:cursor; Item { id:cursorInstance; objectName: "cursorInstance"; property string localProperty: contextualProperty } } ]
cursorDelegate: cursor
diff --git a/tests/auto/quick/qquicktextinput/data/cursorTestExternal.qml b/tests/auto/quick/qquicktextinput/data/cursorTestExternal.qml
index 31ee01db99..1e2c91e9cc 100644
--- a/tests/auto/quick/qquicktextinput/data/cursorTestExternal.qml
+++ b/tests/auto/quick/qquicktextinput/data/cursorTestExternal.qml
@@ -3,7 +3,7 @@ import QtQuick 2.0
Rectangle { width: 300; height: 300; color: "white"
property string contextualProperty: "Hello"
TextInput {
- text: "Hello world!"
+ text: "Hello my wonderful world!"
id: textInputObject;
objectName: "textInputObject"
width: 300; height: 300
diff --git a/tests/auto/quick/qquicktextinput/data/cursorTestInline.qml b/tests/auto/quick/qquicktextinput/data/cursorTestInline.qml
index b699ed2752..b7ad69962e 100644
--- a/tests/auto/quick/qquicktextinput/data/cursorTestInline.qml
+++ b/tests/auto/quick/qquicktextinput/data/cursorTestInline.qml
@@ -3,7 +3,7 @@ import QtQuick 2.0
Rectangle { width: 300; height: 300; color: "white"
property string contextualProperty: "Hello"
TextInput {
- text: "Hello world!"
+ text: "Hello my wonderful world!"
id: textInputObject
objectName: "textInputObject"
width: 300; height: 300
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index cb6f61d845..291165eef3 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -2884,7 +2884,7 @@ void tst_qquicktextinput::cursorDelegate()
// Test delegate gets moved on mouse press.
textInputObject->setSelectByMouse(true);
textInputObject->setCursorPosition(0);
- const QPoint point1 = textInputObject->positionToRectangle(5).center().toPoint();
+ const QPoint point1 = textInputObject->positionToRectangle(10).center().toPoint();
QTest::qWait(400); //ensure this isn't treated as a double-click
QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, point1);
QTest::qWait(50);
@@ -2894,7 +2894,7 @@ void tst_qquicktextinput::cursorDelegate()
// Test delegate gets moved on mouse drag
textInputObject->setCursorPosition(0);
- const QPoint point2 = textInputObject->positionToRectangle(10).center().toPoint();
+ const QPoint point2 = textInputObject->positionToRectangle(15).center().toPoint();
QTest::qWait(400); //ensure this isn't treated as a double-click
QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, point1);
QMouseEvent mv(QEvent::MouseMove, point2, textInputObject->mapToGlobal(point2),
@@ -2908,7 +2908,7 @@ void tst_qquicktextinput::cursorDelegate()
textInputObject->setReadOnly(true);
textInputObject->setCursorPosition(0);
QTest::qWait(400); //ensure this isn't treated as a double-click
- QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textInputObject->positionToRectangle(5).center().toPoint());
+ QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textInputObject->positionToRectangle(10).center().toPoint());
QTest::qWait(50);
QTRY_VERIFY(textInputObject->cursorPosition() != 0);
QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());
@@ -2916,7 +2916,7 @@ void tst_qquicktextinput::cursorDelegate()
textInputObject->setCursorPosition(0);
QTest::qWait(400); //ensure this isn't treated as a double-click
- QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textInputObject->positionToRectangle(5).center().toPoint());
+ QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textInputObject->positionToRectangle(10).center().toPoint());
QTest::qWait(50);
QTRY_VERIFY(textInputObject->cursorPosition() != 0);
QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x());