diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-11-19 09:20:16 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-11-20 17:37:47 +0000 |
commit | 63ada5fa00ba37e0fbfcd7b70dcbd99580dd7c4f (patch) | |
tree | c5a1265ca20c5284a4b815cd5f5b4ad0fc5dedf7 /tests/auto/quick | |
parent | 9a7c5a925c4d62f4fe23d31b1f8636d415b6307c (diff) |
QQuickText: Signal content height/width changes also when resetting
If we change the content height or content width to the initial one, we
still need to signal the change.
Fixes: QTBUG-71684
Change-Id: Idf6e3f89423eab3d8f5310c164c5acc5108e0d8b
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Diffstat (limited to 'tests/auto/quick')
-rw-r--r-- | tests/auto/quick/qquicktext/data/contentHeight.qml | 7 | ||||
-rw-r--r-- | tests/auto/quick/qquicktext/tst_qquicktext.cpp | 14 |
2 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktext/data/contentHeight.qml b/tests/auto/quick/qquicktext/data/contentHeight.qml new file mode 100644 index 0000000000..472e97078e --- /dev/null +++ b/tests/auto/quick/qquicktext/data/contentHeight.qml @@ -0,0 +1,7 @@ +import QtQuick 2.9 + +Text{ + width: 200 + height: contentHeight + text: '' +} diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 63e023644f..a9c35e0cc4 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -159,6 +159,8 @@ private slots: void fontInfo(); + void initialContentHeight(); + private: QStringList standard; QStringList richText; @@ -4383,6 +4385,18 @@ void tst_qquicktext::fontInfo() QVERIFY(copy->font().pixelSize() < 1000); } +void tst_qquicktext::initialContentHeight() +{ + QQmlComponent component(&engine, testFile("contentHeight.qml")); + QVERIFY(component.isReady()); + QScopedPointer<QObject> object(component.create()); + QObject *root = object.data(); + QVERIFY(root); + QQuickText *text = qobject_cast<QQuickText *>(root); + QVERIFY(text); + QCOMPARE(text->height(), text->contentHeight()); +} + void tst_qquicktext::implicitSizeChangeRewrap() { QScopedPointer<QQuickView> window(new QQuickView); |