Search
SailfishOS Open Build Service
>
Projects
>
home:kaltsi
:
tnhlbug
>
qt
> 0027-Fix-TextInput-test-failures.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File 0027-Fix-TextInput-test-failures.patch of Package qt
From 262ca69cbad13d4e6c11c48dc0c6226da053e607 Mon Sep 17 00:00:00 2001 From: Andrew den Exter <andrew.den-exter@nokia.com> Date: Mon, 5 Sep 2011 17:42:08 +1000 Subject: [PATCH 27/29] 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> --- src/gui/widgets/qlinecontrol.cpp | 2 ++ .../tst_qdeclarativetextinput.cpp | 18 ++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index d626bde..f1972f6 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -664,6 +664,8 @@ bool QLineControl::finishChange(int validateFromState, bool update, bool edited) m_selDirty = false; emit selectionChanged(); } + if (m_cursor == m_lastCursorPos) + updateMicroFocus(); emitCursorPositionChanged(); return true; } diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index d3f5670..7568409 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -2525,13 +2525,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 @@ -2547,14 +2549,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(); } @@ -2566,12 +2570,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. -- 1.7.10.3