aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklayouts
diff options
context:
space:
mode:
authorJan Arve Sæther <jan-arve.saether@qt.io>2018-02-15 15:41:37 +0100
committerJan Arve Sæther <jan-arve.saether@qt.io>2018-02-19 16:27:59 +0000
commitb8dbe476f01a38afc921f9693d89f3c72396651a (patch)
treecb6adbd83195adbff53cb5f2e38d9a6903626c0d /tests/auto/quick/qquicklayouts
parent047f161b1a706e81034ccd8d4700a3126c16dfe4 (diff)
Only warn about actual *anchors* in layout children
Do not warn if they don't actually pose a problem, such as having just anchors.margins: 42 in a layout child item (as demonstrated by the test) Change-Id: I01e4515e91d7d0df3ae6bf9061cebe5c51802998 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicklayouts')
-rw-r--r--tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
index 4ff1017116..4e9e41d42e 100644
--- a/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
+++ b/tests/auto/quick/qquicklayouts/data/tst_rowlayout.qml
@@ -1004,5 +1004,66 @@ Item {
// Shouldn't crash upon destroying containerUser.
}
+
+
+ Component {
+ id: itemsWithAnchorsLayout_Component
+ RowLayout {
+ spacing: 2
+ Item {
+ anchors.fill: parent
+ implicitWidth: 10
+ implicitHeight: 10
+ }
+ Item {
+ anchors.centerIn: parent
+ implicitWidth: 10
+ implicitHeight: 10
+ }
+ Item {
+ anchors.left: parent.left
+ implicitWidth: 10
+ implicitHeight: 10
+ }
+ Item {
+ anchors.right: parent.right
+ implicitWidth: 10
+ implicitHeight: 10
+ }
+ Item {
+ anchors.top: parent.top
+ implicitWidth: 10
+ implicitHeight: 10
+ }
+ Item {
+ anchors.bottom: parent.bottom
+ implicitWidth: 10
+ implicitHeight: 10
+ }
+ Item {
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.verticalCenter: parent.verticalCenter
+ implicitWidth: 10
+ implicitHeight: 10
+ }
+ Item {
+ anchors.margins: 42 // although silly, it should not cause a warning from the Layouts POV
+ implicitWidth: 10
+ implicitHeight: 10
+ }
+ }
+ }
+
+ function test_warnAboutLayoutItemsWithAnchors()
+ {
+ var fullPath = Qt.resolvedUrl("tst_rowlayout.qml")
+ for (var i = 0; i < 7; ++i) {
+ ignoreWarning(fullPath + ":" + (1013 + 5*i) +":17: QML Item: Detected anchors on an item that is part of a layout. This is undefined behavior.")
+ }
+ var layout = itemsWithAnchorsLayout_Component.createObject(container)
+ waitForRendering(layout)
+ layout.destroy()
+ }
+
}
}