From 6cf36b2497f0fdcfced155cd85e403b64bfa269e Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Mon, 12 Mar 2012 10:55:25 +1000 Subject: [PATCH] Fix tst_qquicktextedit. Recent changes to mouse double-click handling mean that two calls to QTest::mouseClick with the same position will result in a double click, which was causing this test to fail. Change-Id: I21e6aa7ab2221b6ea82b1afd13e36b7ba0aef8dc Reviewed-by: Kent Hansen --- tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index 85a9033..c98e5eb 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -1855,6 +1855,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setSelectByMouse(true); textEditObject->setCursorPosition(0); const QPoint point1 = textEditObject->positionToRectangle(5).center().toPoint(); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mouseClick(&view, Qt::LeftButton, 0, point1); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); @@ -1864,6 +1865,7 @@ void tst_qquicktextedit::cursorDelegate() // Test delegate gets moved on mouse drag textEditObject->setCursorPosition(0); const QPoint point2 = textEditObject->positionToRectangle(10).center().toPoint(); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mousePress(&view, Qt::LeftButton, 0, point1); QMouseEvent mv(QEvent::MouseMove, point2, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QGuiApplication::sendEvent(&view, &mv); @@ -1874,6 +1876,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setReadOnly(true); textEditObject->setCursorPosition(0); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); @@ -1881,6 +1884,7 @@ void tst_qquicktextedit::cursorDelegate() QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); textEditObject->setCursorPosition(0); + QTest::qWait(400); //ensure this isn't treated as a double-click QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); -- 2.7.4