aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
authorAndreas Buhr <andreas@andreasbuhr.de>2022-04-20 07:09:39 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-05-07 13:42:53 +0000
commitbcf7a2d77db5a0c4e99603dfcbacfbef26f76376 (patch)
treee3a0bcfd3ec18d45cdd5a9e87e8161183a8c1ff9 /tests/auto/quick
parentad13739f57e3835ac63ca288844f4b11e714ca48 (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". Task-number: QTBUG-101865 Change-Id: I70b241af1ecefe64fcfd7723f808e93f70bfe0b8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit f6c00214203924fb38c5d6c2af875f6355b11081) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/quick')
-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 8f80070b76..f3c813711b 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -2883,7 +2883,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);
@@ -2893,7 +2893,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, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
@@ -2906,7 +2906,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());
@@ -2914,7 +2914,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());