diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qsgpositioners/data/grid-row-column-spacing.qml | 43 | ||||
-rw-r--r-- | tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp | 34 |
2 files changed, 77 insertions, 0 deletions
diff --git a/tests/auto/declarative/qsgpositioners/data/grid-row-column-spacing.qml b/tests/auto/declarative/qsgpositioners/data/grid-row-column-spacing.qml new file mode 100644 index 0000000000..49bbd337e7 --- /dev/null +++ b/tests/auto/declarative/qsgpositioners/data/grid-row-column-spacing.qml @@ -0,0 +1,43 @@ +import QtQuick 2.0 + +Item { + width: 640 + height: 480 + Grid { + objectName: "grid" + columns: 3 + spacing: 4 + rowSpacing: 7 + columnSpacing: 11 + 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/qsgpositioners/tst_qsgpositioners.cpp b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp index 3b2a504ff4..497f511335 100644 --- a/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp +++ b/tests/auto/declarative/qsgpositioners/tst_qsgpositioners.cpp @@ -76,6 +76,7 @@ private slots: void test_grid_topToBottom(); void test_grid_rightToLeft(); void test_grid_spacing(); + void test_grid_row_column_spacing(); void test_grid_animated(); void test_grid_animated_rightToLeft(); void test_grid_zero_columns(); @@ -622,6 +623,39 @@ void tst_qsgpositioners::test_grid_spacing() delete canvas; } +void tst_qsgpositioners::test_grid_row_column_spacing() +{ + QSGView *canvas = createView(SRCDIR "/data/grid-row-column-spacing.qml"); + + QSGRectangle *one = canvas->rootObject()->findChild<QSGRectangle*>("one"); + QVERIFY(one != 0); + QSGRectangle *two = canvas->rootObject()->findChild<QSGRectangle*>("two"); + QVERIFY(two != 0); + QSGRectangle *three = canvas->rootObject()->findChild<QSGRectangle*>("three"); + QVERIFY(three != 0); + QSGRectangle *four = canvas->rootObject()->findChild<QSGRectangle*>("four"); + QVERIFY(four != 0); + QSGRectangle *five = canvas->rootObject()->findChild<QSGRectangle*>("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 61.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 92.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 0.0); + QCOMPARE(four->y(), 57.0); + QCOMPARE(five->x(), 61.0); + QCOMPARE(five->y(), 57.0); + + QSGItem *grid = canvas->rootObject()->findChild<QSGItem*>("grid"); + QCOMPARE(grid->width(), 142.0); + QCOMPARE(grid->height(), 107.0); + + delete canvas; +} + void tst_qsgpositioners::test_grid_animated() { QSGView *canvas = createView(SRCDIR "/data/grid-animated.qml"); |