diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-04 10:24:46 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-06-04 10:28:48 +0200 |
commit | 9556f6d075b61fa95d6e1057f305e522a26f71d6 (patch) | |
tree | 53190472453390810c47b9b5a47b23188a00267e /tests/auto/quick/qquicktext/tst_qquicktext.cpp | |
parent | 42ffe9b193a5bd958b0853233fd0d94170722bd1 (diff) | |
parent | 1fd0cdc6a2e01775d8a79c6614910cc5a2fbf2b3 (diff) |
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts:
src/qml/jsruntime/qv4engine_p.h
src/quick/items/qquickitemsmodule.cpp
src/quick/items/qquicktext.cpp
src/quick/util/qquickpixmapcache.cpp
tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
Change-Id: I90ecaad6a4bfaa4f36149a7463f4d7141f4a516a
Diffstat (limited to 'tests/auto/quick/qquicktext/tst_qquicktext.cpp')
-rw-r--r-- | tests/auto/quick/qquicktext/tst_qquicktext.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 00c3957bad..c1d454e5df 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -106,6 +106,7 @@ private slots: void implicitSize_data(); void implicitSize(); + void dependentImplicitSizes(); void contentSize(); void implicitSizeBinding_data(); void implicitSizeBinding(); @@ -2216,6 +2217,62 @@ void tst_qquicktext::implicitSize() delete textObject; } +void tst_qquicktext::dependentImplicitSizes() +{ + QQmlComponent component(&engine, testFile("implicitSizes.qml")); + QScopedPointer<QObject> object(component.create()); + QVERIFY(object.data()); + + QQuickText *reference = object->findChild<QQuickText *>("reference"); + QQuickText *fixedWidthAndHeight = object->findChild<QQuickText *>("fixedWidthAndHeight"); + QQuickText *implicitWidthFixedHeight = object->findChild<QQuickText *>("implicitWidthFixedHeight"); + QQuickText *fixedWidthImplicitHeight = object->findChild<QQuickText *>("fixedWidthImplicitHeight"); + QQuickText *cappedWidthAndHeight = object->findChild<QQuickText *>("cappedWidthAndHeight"); + QQuickText *cappedWidthFixedHeight = object->findChild<QQuickText *>("cappedWidthFixedHeight"); + QQuickText *fixedWidthCappedHeight = object->findChild<QQuickText *>("fixedWidthCappedHeight"); + + QVERIFY(reference); + QVERIFY(fixedWidthAndHeight); + QVERIFY(implicitWidthFixedHeight); + QVERIFY(fixedWidthImplicitHeight); + QVERIFY(cappedWidthAndHeight); + QVERIFY(cappedWidthFixedHeight); + QVERIFY(fixedWidthCappedHeight); + + QCOMPARE(reference->width(), reference->implicitWidth()); + QCOMPARE(reference->height(), reference->implicitHeight()); + + QVERIFY(fixedWidthAndHeight->width() < fixedWidthAndHeight->implicitWidth()); + QVERIFY(fixedWidthAndHeight->height() < fixedWidthAndHeight->implicitHeight()); + QCOMPARE(fixedWidthAndHeight->implicitWidth(), reference->implicitWidth()); + QVERIFY(fixedWidthAndHeight->implicitHeight() > reference->implicitHeight()); + + QCOMPARE(implicitWidthFixedHeight->width(), implicitWidthFixedHeight->implicitWidth()); + QVERIFY(implicitWidthFixedHeight->height() < implicitWidthFixedHeight->implicitHeight()); + QCOMPARE(implicitWidthFixedHeight->implicitWidth(), reference->implicitWidth()); + QCOMPARE(implicitWidthFixedHeight->implicitHeight(), reference->implicitHeight()); + + QVERIFY(fixedWidthImplicitHeight->width() < fixedWidthImplicitHeight->implicitWidth()); + QCOMPARE(fixedWidthImplicitHeight->height(), fixedWidthImplicitHeight->implicitHeight()); + QCOMPARE(fixedWidthImplicitHeight->implicitWidth(), reference->implicitWidth()); + QCOMPARE(fixedWidthImplicitHeight->implicitHeight(), fixedWidthAndHeight->implicitHeight()); + + QVERIFY(cappedWidthAndHeight->width() < cappedWidthAndHeight->implicitWidth()); + QVERIFY(cappedWidthAndHeight->height() < cappedWidthAndHeight->implicitHeight()); + QCOMPARE(cappedWidthAndHeight->implicitWidth(), reference->implicitWidth()); + QCOMPARE(cappedWidthAndHeight->implicitHeight(), fixedWidthAndHeight->implicitHeight()); + + QVERIFY(cappedWidthFixedHeight->width() < cappedWidthAndHeight->implicitWidth()); + QVERIFY(cappedWidthFixedHeight->height() < cappedWidthFixedHeight->implicitHeight()); + QCOMPARE(cappedWidthFixedHeight->implicitWidth(), reference->implicitWidth()); + QCOMPARE(cappedWidthFixedHeight->implicitHeight(), fixedWidthAndHeight->implicitHeight()); + + QVERIFY(fixedWidthCappedHeight->width() < fixedWidthCappedHeight->implicitWidth()); + QVERIFY(fixedWidthCappedHeight->height() < fixedWidthCappedHeight->implicitHeight()); + QCOMPARE(fixedWidthCappedHeight->implicitWidth(), reference->implicitWidth()); + QCOMPARE(fixedWidthCappedHeight->implicitHeight(), fixedWidthAndHeight->implicitHeight()); +} + void tst_qquicktext::contentSize() { QString componentStr = "import QtQuick 2.0\nText { width: 75; height: 16; font.pixelSize: 10 }"; |