diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2014-01-21 14:22:10 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-22 23:35:33 +0100 |
commit | e8aaaaf3b9e4cf0fdf46ba1bce589d00259e0bad (patch) | |
tree | e0bd7f25291632b9093c1543246646681d4725f7 /tests/auto/quick/qquicktext | |
parent | fe6ad3ad4550c9efd2c07ca25ce3625c0615fcba (diff) |
QQuickText: fix layout mirroring
Task-number: QTBUG-35095
Change-Id: I8550821e01ecc931788c1ed73366ba1ceed7a817
Reviewed-by: Andrew den Exter <andrew.den.exter@qinetic.com.au>
Diffstat (limited to 'tests/auto/quick/qquicktext')
-rw-r--r-- | tests/auto/quick/qquicktext/tst_qquicktext.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 78e03be9c2..6a18323190 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -1694,6 +1694,12 @@ void tst_qquicktext::linkInteraction_data() << (PointVector() << metrics.characterRectangle(18, Qt::AlignRight, Qt::AlignBottom).center()) << singleLineLink << singleLineLink << singleLineLink; + QTest::newRow("click on mirrored link") + << singleLineText << 240. + << "horizontalAlignment: Text.AlignLeft; LayoutMirroring.enabled: true" + << (PointVector() << metrics.characterRectangle(18, Qt::AlignRight, Qt::AlignTop).center()) + << singleLineLink + << singleLineLink << singleLineLink; QTest::newRow("click on center aligned link") << singleLineText << 240. << "horizontalAlignment: Text.AlignHCenter; verticalAlignment: Text.AlignVCenter" @@ -2515,6 +2521,18 @@ void tst_qquicktext::boundingRect() QCOMPARE(text->boundingRect().width(), line.naturalTextWidth()); QCOMPARE(text->boundingRect().height(), line.height()); + QQuickItemPrivate::get(text)->setLayoutMirror(true); + QCOMPARE(text->boundingRect().x(), qreal(0)); + QCOMPARE(text->boundingRect().y(), qreal(0)); + QCOMPARE(text->boundingRect().width(), line.naturalTextWidth()); + QCOMPARE(text->boundingRect().height(), line.height()); + + text->setHAlign(QQuickText::AlignLeft); + QCOMPARE(text->boundingRect().x(), text->width() - line.naturalTextWidth()); + QCOMPARE(text->boundingRect().y(), qreal(0)); + QCOMPARE(text->boundingRect().width(), line.naturalTextWidth()); + QCOMPARE(text->boundingRect().height(), line.height()); + text->setWrapMode(QQuickText::Wrap); QCOMPARE(text->boundingRect().right(), text->width()); QCOMPARE(text->boundingRect().y(), qreal(0)); |