diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-09-05 07:42:08 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-01-23 11:26:45 (GMT) |
commit | d3e0355c56f39d33e0fdedc5ef12ab9ba4c7202e (patch) | |
tree | 7902f9699b23a950135662c37cd39463fd4c050b /tests | |
parent | 4e41d42c17e2aab6e6a8ebedc9595d9b0854c9e5 (diff) | |
download | Qt-d3e0355c56f39d33e0fdedc5ef12ab9ba4c7202e.zip Qt-d3e0355c56f39d33e0fdedc5ef12ab9ba4c7202e.tar.gz Qt-d3e0355c56f39d33e0fdedc5ef12ab9ba4c7202e.tar.bz2 |
Fix TextInput test failures.
emitCursorPositionChanged won't emit cursorPositionChanged if the
cursor position hasn't changed but that doesn't mean the micro focus
hasn't changed, so emit updateMicroFocus changed when
cursorPositionChanged isn't.
Task-number: QTBUG-21017
Task-number: QTBUG-21011
Task-number: QTBUG-20719
Reviewed-by: Joona Petrell <joona.t.petrell@nokia.com>
(cherry picked from commit 6e0e834e0398192a6da11d1e1bca6b74769fb75d)
Change-Id: Ia0d244eea051f2a870a084742c4c22f5a45a87bc
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 5305ed0..4466d9e 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -2536,13 +2536,15 @@ void tst_qdeclarativetextinput::preeditAutoScroll() ic.sendPreeditText(preeditText.mid(0, 3), 1); QVERIFY(input.positionAt(0) != 0); QVERIFY(input.cursorRectangle().left() < input.boundingRect().width()); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QVERIFY(cursorRectangleSpy.count() > cursorRectangleChanges); + cursorRectangleChanges = cursorRectangleSpy.count(); // test the text is scrolled back when the preedit is removed. ic.sendEvent(QInputMethodEvent()); QCOMPARE(input.positionAt(0), 0); QCOMPARE(input.positionAt(input.width()), 5); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QVERIFY(cursorRectangleSpy.count() > cursorRectangleChanges); + cursorRectangleChanges = cursorRectangleSpy.count(); // some tolerance for different fonts. #ifdef Q_OS_LINUX @@ -2558,14 +2560,16 @@ void tst_qdeclarativetextinput::preeditAutoScroll() ic.sendPreeditText(preeditText, i + 1); QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)) - error); QVERIFY(input.positionToRectangle(0).x() < x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QVERIFY(cursorRectangleSpy.count() > cursorRectangleChanges); + cursorRectangleChanges = cursorRectangleSpy.count(); x = input.positionToRectangle(0).x(); } for (int i = 1; i >= 0; --i) { ic.sendPreeditText(preeditText, i + 1); QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)) - error); QVERIFY(input.positionToRectangle(0).x() > x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QVERIFY(cursorRectangleSpy.count() > cursorRectangleChanges); + cursorRectangleChanges = cursorRectangleSpy.count(); x = input.positionToRectangle(0).x(); } @@ -2577,12 +2581,14 @@ void tst_qdeclarativetextinput::preeditAutoScroll() for (int i = 2; i >= 0; --i) { ic.sendPreeditText(preeditText, preeditText.length() - i); QCOMPARE(input.positionToRectangle(0).x(), x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QVERIFY(cursorRectangleSpy.count() > cursorRectangleChanges); + cursorRectangleChanges = cursorRectangleSpy.count(); } for (int i = 1; i < 3; ++i) { ic.sendPreeditText(preeditText, preeditText.length() - i); QCOMPARE(input.positionToRectangle(0).x(), x); - QCOMPARE(cursorRectangleSpy.count(), ++cursorRectangleChanges); + QVERIFY(cursorRectangleSpy.count() > cursorRectangleChanges); + cursorRectangleChanges = cursorRectangleSpy.count(); } // Test disabling auto scroll. |