aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoona Petrell <joona.t.petrell@nokia.com>2011-09-30 13:37:51 +0300
committerQt by Nokia <qt-info@nokia.com>2011-10-05 16:25:17 +0200
commit8a1b17f80c131a2bf6681070db43604029b3a8c0 (patch)
treee44b085f470527b08fe65e0242f8e84086d3d5b2
parent1c9e8db29e883328f78cd9ab668b066fddc54525 (diff)
Fix TextInput and TextEdit cursorRectangleSize autotests
Task-number: QTBUG-21691 Change-Id: I7fdcbcb0fd8b3442f5af91aa87f4337c7597f95b Reviewed-on: http://codereview.qt-project.org/5865 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Pekka Vuorela <pekka.ta.vuorela@nokia.com> Reviewed-by: Andrew den Exter <andrew.den-exter@nokia.com>
-rw-r--r--tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp10
-rw-r--r--tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp13
2 files changed, 9 insertions, 14 deletions
diff --git a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
index 16fc63b275..b3577f1084 100644
--- a/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
+++ b/tests/auto/declarative/qsgtextedit/tst_qsgtextedit.cpp
@@ -2426,10 +2426,6 @@ void tst_qsgtextedit::inputMethodComposing()
void tst_qsgtextedit::cursorRectangleSize()
{
-#ifdef QTBUG_21691
- QEXPECT_FAIL("", QTBUG_21691_MESSAGE, Abort);
- QVERIFY(false);
-#else
QSGView *canvas = new QSGView(QUrl::fromLocalFile(SRCDIR "/data/CursorRect.qml"));
QVERIFY(canvas->rootObject() != 0);
canvas->show();
@@ -2441,13 +2437,15 @@ void tst_qsgtextedit::cursorRectangleSize()
textEdit->setFocus(Qt::OtherFocusReason);
QRectF cursorRect = textEdit->positionToRectangle(textEdit->cursorPosition());
QRectF microFocusFromScene = canvas->inputMethodQuery(Qt::ImCursorRectangle).toRectF();
- QRectF microFocusFromApp= QGuiApplication::focusWidget()->inputMethodQuery(Qt::ImCursorRectangle).toRectF();
+ QInputMethodQueryEvent event(Qt::ImCursorRectangle);
+ qApp->sendEvent(qApp->inputPanel()->inputItem(), &event);
+
+ QRectF microFocusFromApp = event.value(Qt::ImCursorRectangle).toRectF();
QCOMPARE(microFocusFromScene.size(), cursorRect.size());
QCOMPARE(microFocusFromApp.size(), cursorRect.size());
delete canvas;
-#endif
}
QTEST_MAIN(tst_qsgtextedit)
diff --git a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
index 0fecb54e08..89e5b02864 100644
--- a/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
+++ b/tests/auto/declarative/qsgtextinput/tst_qsgtextinput.cpp
@@ -2593,15 +2593,10 @@ void tst_qsgtextinput::inputMethodComposing()
void tst_qsgtextinput::cursorRectangleSize()
{
-#ifdef QTBUG_21691
- QEXPECT_FAIL("", QTBUG_21691_MESSAGE, Abort);
- QVERIFY(false);
-#else
QSGView *canvas = new QSGView(QUrl::fromLocalFile(SRCDIR "/data/positionAt.qml"));
QVERIFY(canvas->rootObject() != 0);
canvas->show();
- canvas->setFocus();
- QGuiApplication::setActiveWindow(canvas);
+ canvas->requestActivateWindow();
QTest::qWaitForWindowShown(canvas);
QSGTextInput *textInput = qobject_cast<QSGTextInput *>(canvas->rootObject());
@@ -2609,13 +2604,15 @@ void tst_qsgtextinput::cursorRectangleSize()
textInput->setFocus(Qt::OtherFocusReason);
QRectF cursorRect = textInput->positionToRectangle(textInput->cursorPosition());
QRectF microFocusFromScene = canvas->inputMethodQuery(Qt::ImCursorRectangle).toRectF();
- QRectF microFocusFromApp= QGuiApplication::focusWidget()->inputMethodQuery(Qt::ImCursorRectangle).toRectF();
+ QInputMethodQueryEvent event(Qt::ImCursorRectangle);
+ qApp->sendEvent(qApp->inputPanel()->inputItem(), &event);
+
+ QRectF microFocusFromApp = event.value(Qt::ImCursorRectangle).toRectF();
QCOMPARE(microFocusFromScene.size(), cursorRect.size());
QCOMPARE(microFocusFromApp.size(), cursorRect.size());
delete canvas;
-#endif
}
void tst_qsgtextinput::tripleClickSelectsAll()