aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicktextinput
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-09-10 12:35:31 +0200
committerLars Knoll <lars.knoll@theqtcompany.com>2015-09-14 12:04:32 +0000
commitea89d156afaf7d22c069e92a1666be584f01d5ac (patch)
treef5751f3458c0a105b7e8a25d4f7d3b0e712f5b26 /tests/auto/quick/qquicktextinput
parent3713120cc8b7f8a95aa670d759b8f9ed3b72425a (diff)
Fix autotests
Commit 35793cea28c4bd1d6d8fbae884d9ae3c19745c61 caused changes to font metrics on Mac when running our autotests. This change adjust auto tests to pass again after the change. Fix QQuickText::fontSizeMode autotests. The calculations are font dependent, and with small differences in the fonts between different OSes it's difficult to find values that work everywhere. Also fix the baseline calculations for some items that were using the wrong fonts (exchanging empty and non empty calculations). Fix language dependent differences on metrics calculations in tst_qquicktextinput. Change-Id: I7d0c7c79c8c62a4619b2f0e95ef53660b7feb782 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'tests/auto/quick/qquicktextinput')
-rw-r--r--tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
index 079f73ae34..85123c6f92 100644
--- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
+++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp
@@ -3092,14 +3092,16 @@ void tst_qquicktextinput::cursorRectangle()
} else {
QCOMPARE(r.left(), input.width());
}
- QVERIFY(r.top() >= line.height() - 1);
+ // we can't be exact here, as the space character can have a different ascent/descent from the arabic chars
+ // this then leads to different line heights between the wrapped and non wrapped texts
+ QVERIFY(r.top() >= line.height() - 5);
COMPARE_INPUT_METHOD_QUERY(QRectF, (&input), Qt::ImCursorRectangle, toRectF, r);
QCOMPARE(input.positionToRectangle(11), r);
for (int i = wrapPosition + 1; i < text.length(); ++i) {
input.setCursorPosition(i);
r = input.cursorRectangle();
- QVERIFY(r.top() >= line.height() - 1);
+ QVERIFY(r.top() >= line.height() - 5);
COMPARE_INPUT_METHOD_QUERY(QRectF, (&input), Qt::ImCursorRectangle, toRectF, r);
QCOMPARE(input.positionToRectangle(i), r);
}