diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-03-31 06:46:02 (GMT) |
---|---|---|
committer | Andrew den Exter <andrew.den-exter@nokia.com> | 2011-04-01 00:27:24 (GMT) |
commit | 1ff7c423308feeaa73e1eab6e20147f5c3d2ccd3 (patch) | |
tree | 50dc486b7be0e3872386776ba0619ce1f336a427 /tests | |
parent | ea304fb207b681ee084c4ce9bc61d1dd847bd7b0 (diff) | |
download | Qt-1ff7c423308feeaa73e1eab6e20147f5c3d2ccd3.zip Qt-1ff7c423308feeaa73e1eab6e20147f5c3d2ccd3.tar.gz Qt-1ff7c423308feeaa73e1eab6e20147f5c3d2ccd3.tar.bz2 |
Fix TextInput auto test failure on mac.
Allow for some error due to additional padding on mac.
Change-Id: Iee9ce8eb9c4cec2f96c22340162f628ffcbd44d1
Reviewed-by: Bea Lam
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 81713e0..ef32ee3 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -1741,7 +1741,7 @@ void tst_qdeclarativetextinput::cursorRectangle() // Check the cursor rectangle remains within the input bounding rect when auto scrolling. QVERIFY(r.left() < input.boundingRect().width()); - QVERIFY(r.right() >= input.width()); + QVERIFY(r.right() >= input.width() - error); for (int i = 6; i < text.length(); ++i) { input.setCursorPosition(i); @@ -2242,18 +2242,25 @@ void tst_qdeclarativetextinput::preeditAutoScroll() QCOMPARE(input.positionAt(0), 0); QCOMPARE(input.positionAt(input.width()), 5); + // some tolerance for different fonts. +#ifdef Q_OS_LINUX + const int error = 2; +#else + const int error = 5; +#endif + // test if the preedit is larger than the text input that the // character preceding the cursor is still visible. qreal x = input.positionToRectangle(0).x(); for (int i = 0; i < 3; ++i) { ic.sendPreeditText(preeditText, i + 1); - QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i))); + QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)) - error); QVERIFY(input.positionToRectangle(0).x() < x); 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))); + QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)) - error); QVERIFY(input.positionToRectangle(0).x() > x); x = input.positionToRectangle(0).x(); } |