From 8e29d463dc6f5f91dc03f638115b491732c1ff76 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 11 Aug 2016 10:48:17 +0200 Subject: Make imageAt and formatAt more robus against different font metrics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST | 7 ------- .../tst_qabstracttextdocumentlayout.cpp | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) delete mode 100644 tests/auto/gui/text/qabstracttextdocumentlayout/BLACKLIST 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()); -- cgit v1.2.3