diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2016-08-11 10:48:17 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2016-08-12 03:59:23 +0000 |
commit | 8e29d463dc6f5f91dc03f638115b491732c1ff76 (patch) | |
tree | cfccca8c4a7e29b1d0e15a2cf1edff0ed439c588 | |
parent | 7833f7bc06e073165a629e08afa0945d7cf211b7 (diff) |
Make imageAt and formatAt more robus against different font metrics
Don't try to locate the text by coordinates at the edge of the text but
simply aim at the center vertically _and_ horizontally.
Task-number: QTBUG-52991
Change-Id: Ia9e84fc5d12491840e739c4eea730fe13058f3c7
Reviewed-by: Simo Fält <simo.falt@theqtcompany.com>
-rw-r--r-- | tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST | 7 | ||||
-rw-r--r-- | tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp | 4 |
2 files changed, 2 insertions, 9 deletions
diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST b/tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST deleted file mode 100644 index fa033cee09..0000000000 --- a/tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST +++ /dev/null @@ -1,7 +0,0 @@ -#QTBUG-53648 -[imageAt] -opensuse-42.1 -rhel-7.2 -#QTBUG-52991 -[formatAt] -opensuse-42.1 diff --git a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp index 9542d306ba..be3ef968ef 100644 --- a/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp +++ b/tests/auto/gui/text/qabstracttextdocumentlayout/tst_qabstracttextdocumentlayout.cpp @@ -194,7 +194,7 @@ void tst_QAbstractTextDocumentLayout::imageAt() QCOMPARE(documentLayout->anchorAt(imagePoint), QString("link")); // imageAt on start returns nothing (there's the "foo" text) - QPointF fooPoint(fooBr.width() + blockStart.x(), (fooBr.height() / 2) + blockStart.y()); + QPointF fooPoint(blockStart.x() + (fooBr.width() / 2), (fooBr.height() / 2) + blockStart.y()); QCOMPARE(documentLayout->imageAt(fooPoint), QString()); } @@ -221,7 +221,7 @@ void tst_QAbstractTextDocumentLayout::formatAt() QVERIFY(format.isImageFormat()); // move over the unformatted "foo" text) - QPointF fooPoint(fooBr.width() + blockStart.x(), (fooBr.height() / 2) + blockStart.y()); + QPointF fooPoint(blockStart.x() + (fooBr.width() / 2), (fooBr.height() / 2) + blockStart.y()); format = documentLayout->formatAt(fooPoint); QVERIFY(format.isCharFormat()); QVERIFY(!format.toCharFormat().isAnchor()); |