diff options
Diffstat (limited to 'tests/auto/controls/data')
-rw-r--r-- | tests/auto/controls/data/tst_splitview.qml | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/tests/auto/controls/data/tst_splitview.qml b/tests/auto/controls/data/tst_splitview.qml index 8e9522a2..55592eee 100644 --- a/tests/auto/controls/data/tst_splitview.qml +++ b/tests/auto/controls/data/tst_splitview.qml @@ -427,15 +427,45 @@ TestCase { compare(item2.height, testCase.height) } - function test_useAttachedPropertiesIncorrectly() { - var control = createTemporaryObject(splitViewComponent, testCase) - verify(control) + Component { + id: itemComponent + Item {} + } + + Component { + id: objectComponent + QtObject {} + } + + function test_useAttachedPropertiesIncorrectly_data() { + var properties = [ "fillWidth", "fillHeight", "minimumWidth", "minimumHeight", + "preferredWidth", "preferredHeight", "maximumWidth", "maximumHeight" ] + + var data = [] + + for (var i = 0; i < properties.length; ++i) { + var property = properties[i] + data.push({ tag: "Item," + property, component: itemComponent, property: property, + expectedWarning: /.*SplitView: attached properties must be accessed through a direct child of SplitView/ }) + } + + for (i = 0; i < properties.length; ++i) { + property = properties[i] + data.push({ tag: "QtObject," + property, component: objectComponent, property: property, + expectedWarning: /.*SplitView: attached properties can only be used on Items/ }) + } + + return data + } - var item = rectangleComponent.createObject(control, { implicitWidth: 25, color: "salmon" }) - verify(item) + function test_useAttachedPropertiesIncorrectly(data) { + // The object (whatever it may be) is not managed by a SplitView. + var object = createTemporaryObject(data.component, testCase, { objectName: data.tag }) + verify(object) - ignoreWarning(/.*SplitView: attached properties must be accessed through a direct child of SplitView/) - testCase.SplitView.fillWidth = true; + ignoreWarning(data.expectedWarning) + // Should warn, but not crash. + object.SplitView[data.property] = 1; } function test_sizes_data() { |