diff options
author | Joona Petrell <joona.t.petrell@nokia.com> | 2010-06-29 02:39:30 (GMT) |
---|---|---|
committer | Joona Petrell <joona.t.petrell@nokia.com> | 2010-06-29 03:10:19 (GMT) |
commit | f54353bf2f566335e44d20b5263fe19d5ac33d1e (patch) | |
tree | 5470e997ef138b2d0a6562ef4f24cb2f747fcc41 /tests/auto/declarative/qdeclarativepositioners | |
parent | b1b46d4e5bd9e4ef355d8bbc13900d7489fb4bf9 (diff) | |
download | Qt-f54353bf2f566335e44d20b5263fe19d5ac33d1e.zip Qt-f54353bf2f566335e44d20b5263fe19d5ac33d1e.tar.gz Qt-f54353bf2f566335e44d20b5263fe19d5ac33d1e.tar.bz2 |
Fix flow layout not taking into account whether it's width and height are implicit or not.
Task-number: QTBUG-11778
Reviewed-by: Martin Jones
Diffstat (limited to 'tests/auto/declarative/qdeclarativepositioners')
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml | 16 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp | 23 |
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml b/tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml new file mode 100644 index 0000000..6dd108e --- /dev/null +++ b/tests/auto/declarative/qdeclarativepositioners/data/flow-testimplicitsize.qml @@ -0,0 +1,16 @@ +import Qt 4.7 + +Rectangle { + width: 300; height: 200; + + property bool leftToRight: false + + Flow { + objectName: "flow" + flow: leftToRight ? Flow.LeftToRight : Flow.TopToBottom + spacing: 20 + anchors.horizontalCenter: parent.horizontalCenter + Rectangle { color: "red"; width: 100; height: 50 } + Rectangle { color: "blue"; width: 100; height: 50 } + } +}
\ No newline at end of file diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 62ec707..0663991 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -75,6 +75,7 @@ private slots: void test_repeater(); void test_flow(); void test_flow_resize(); + void test_flow_implicit_resize(); void test_conflictinganchors(); private: QDeclarativeView *createView(const QString &filename); @@ -655,6 +656,28 @@ void tst_QDeclarativePositioners::test_flow_resize() delete canvas; } +void tst_QDeclarativePositioners::test_flow_implicit_resize() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/flow-testimplicitsize.qml"); + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeFlow *flow = canvas->rootObject()->findChild<QDeclarativeFlow*>("flow"); + QVERIFY(flow != 0); + + QCOMPARE(flow->width(), 100.0); + QCOMPARE(flow->height(), 120.0); + + canvas->rootObject()->setProperty("leftToRight", true); + QCOMPARE(flow->width(), 220.0); + QCOMPARE(flow->height(), 50.0); + + canvas->rootObject()->setProperty("leftToRight", false); + QCOMPARE(flow->width(), 100.0); + QCOMPARE(flow->height(), 120.0); + + delete canvas; +} + QString warningMessage; void interceptWarnings(QtMsgType type, const char *msg) |