diff options
| author | Jan Arve Saether <jan-arve.saether@digia.com> | 2013-04-22 10:54:43 +0200 |
|---|---|---|
| committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-06 18:57:19 +0200 |
| commit | dad6794dbf6caa932329718418a06e24f29af850 (patch) | |
| tree | ecc270ef3fafecd67721a4dea70c75f782820556 | |
| parent | b5b612ed07df8cd5e6c03feb1a32b239981c5675 (diff) | |
Add test for dynamic adding and removing layout items
Change-Id: I7a92428e910435f0ecd63577cb12d5ce5b7653bc
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
| -rw-r--r-- | tests/auto/controls/data/tst_rowlayout.qml | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_rowlayout.qml b/tests/auto/controls/data/tst_rowlayout.qml index 42ffc09c7..d142a5965 100644 --- a/tests/auto/controls/data/tst_rowlayout.qml +++ b/tests/auto/controls/data/tst_rowlayout.qml @@ -252,6 +252,73 @@ Item { } Component { + id: layoutItem_Component + Rectangle { + implicitWidth: 20 + implicitHeight: 20 + } + } + + Component { + id: columnLayoutItem_Component + ColumnLayout { + } + } + + Component { + id: layout_addAndRemoveItems_Component + RowLayout { + spacing: 0 + } + } + + function test_addAndRemoveItems() + { + var layout = layout_addAndRemoveItems_Component.createObject(container) + compare(layout.implicitWidth, 0) + compare(layout.implicitHeight, 0) + + var rect0 = layoutItem_Component.createObject(layout) + compare(layout.implicitWidth, 20) + compare(layout.implicitHeight, 20) + + var rect1 = layoutItem_Component.createObject(layout) + rect1.Layout.preferredWidth = 30; + rect1.Layout.preferredHeight = 30; + compare(layout.implicitWidth, 50) + compare(layout.implicitHeight, 30) + + var col = columnLayoutItem_Component.createObject(layout) + var rect2 = layoutItem_Component.createObject(col) + rect2.Layout.fillHeight = true + var rect3 = layoutItem_Component.createObject(col) + rect3.Layout.fillHeight = true + + compare(layout.implicitWidth, 70) + compare(layout.implicitHeight, 30) + + rect3.destroy() + wait(0) // this will hopefully effectuate the destruction of the object + + col.destroy() + wait(0) + compare(layout.implicitWidth, 50) + compare(layout.implicitHeight, 30) + + rect0.destroy() + wait(0) + compare(layout.implicitWidth, 30) + compare(layout.implicitHeight, 30) + + rect1.destroy() + wait(0) + compare(layout.implicitWidth, 0) + compare(layout.implicitHeight, 0) + + layout.destroy() + } + + Component { id: layout_alignment_Component RowLayout { spacing: 0 |
