diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-04-15 03:34:07 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-04-15 03:34:07 (GMT) |
commit | 451f1f33fa65ba213b1585592225c358f124146a (patch) | |
tree | 6f24ff4af2bcd42bbc6f4f10254e7a4182484127 /tests | |
parent | c0eb81664f2bae225dcaca897c23564d6f97a3d1 (diff) | |
download | Qt-451f1f33fa65ba213b1585592225c358f124146a.zip Qt-451f1f33fa65ba213b1585592225c358f124146a.tar.gz Qt-451f1f33fa65ba213b1585592225c358f124146a.tar.bz2 |
Add flow property to Grid, adding TopToBottom mode.
Task-number: QTBUG-9183
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/grid-toptobottom.qml | 41 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp | 32 |
2 files changed, 73 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativepositioners/data/grid-toptobottom.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid-toptobottom.qml new file mode 100644 index 0000000..34a84bf --- /dev/null +++ b/tests/auto/declarative/qdeclarativepositioners/data/grid-toptobottom.qml @@ -0,0 +1,41 @@ +import Qt 4.6 + +Item { + width: 640 + height: 480 + Grid { + objectName: "grid" + rows: 3 + flow: Grid.TopToBottom + Rectangle { + objectName: "one" + color: "red" + width: 50 + height: 50 + } + Rectangle { + objectName: "two" + color: "green" + width: 20 + height: 50 + } + Rectangle { + objectName: "three" + color: "blue" + width: 50 + height: 20 + } + Rectangle { + objectName: "four" + color: "cyan" + width: 50 + height: 50 + } + Rectangle { + objectName: "five" + color: "magenta" + width: 10 + height: 10 + } + } +} diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 8692596..b4ac0e1 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -61,6 +61,7 @@ private slots: void test_vertical_spacing(); void test_vertical_animated(); void test_grid(); + void test_grid_topToBottom(); void test_grid_spacing(); void test_grid_animated(); void test_grid_zero_columns(); @@ -305,6 +306,37 @@ void tst_QDeclarativePositioners::test_grid() QCOMPARE(grid->height(), 100.0); } +void tst_QDeclarativePositioners::test_grid_topToBottom() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/grid-toptobottom.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + QDeclarativeRectangle *four = canvas->rootObject()->findChild<QDeclarativeRectangle*>("four"); + QVERIFY(four != 0); + QDeclarativeRectangle *five = canvas->rootObject()->findChild<QDeclarativeRectangle*>("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 0.0); + QCOMPARE(two->y(), 50.0); + QCOMPARE(three->x(), 0.0); + QCOMPARE(three->y(), 100.0); + QCOMPARE(four->x(), 50.0); + QCOMPARE(four->y(), 0.0); + QCOMPARE(five->x(), 50.0); + QCOMPARE(five->y(), 50.0); + + QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); + QCOMPARE(grid->width(), 100.0); + QCOMPARE(grid->height(), 120.0); +} + void tst_QDeclarativePositioners::test_grid_spacing() { QDeclarativeView *canvas = createView(SRCDIR "/data/grid-spacing.qml"); |