Commit dad6794d authored by Jan Arve Saether's avatar Jan Arve Saether Committed by The Qt Project
Browse files

Add test for dynamic adding and removing layout items


Change-Id: I7a92428e910435f0ecd63577cb12d5ce5b7653bc
Reviewed-by: default avatarRichard Moe Gustavsen <richard.gustavsen@digia.com>
parent b5b612ed
No related merge requests found
Showing with 67 additions and 0 deletions
...@@ -251,6 +251,73 @@ Item { ...@@ -251,6 +251,73 @@ Item {
col.destroy() col.destroy()
} }
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 { Component {
id: layout_alignment_Component id: layout_alignment_Component
RowLayout { RowLayout {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment