diff options
Diffstat (limited to 'tests/auto/qml/qqmlvaluetypes/data')
81 files changed, 1163 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType.qml b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType.qml new file mode 100644 index 0000000000..f625d081e5 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + property bool boldProperty: false + + font.bold: boldProperty +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType4.qml b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType4.qml new file mode 100644 index 0000000000..0bdccce5be --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType4.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + property int dataProperty: 7 + + point: Qt.point(dataProperty, dataProperty) +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType5.qml b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType5.qml new file mode 100644 index 0000000000..151c49971e --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/BindingsSpliceCorrectlyType5.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + property int dataProperty: 7 + + point.x: dataProperty +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.2.qml b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.2.qml new file mode 100644 index 0000000000..ce2e82d0f8 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.2.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + property int value: 10 + rect.x: value + + onRunScript: { rect = Qt.rect(10, 10, 10, 10) } +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.3.qml b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.3.qml new file mode 100644 index 0000000000..d431b4ae08 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.3.qml @@ -0,0 +1,10 @@ +import Test 1.0 + +MyTypeObject { + property variant value + + rect: value + + onRunScript: { rect.x = 44 } +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.qml b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.qml new file mode 100644 index 0000000000..a8a72f515b --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/autoBindingRemoval.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + property int value: 10 + rect.x: value + + onRunScript: { rect.x = 42; } +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.qml new file mode 100644 index 0000000000..a65218669b --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/bindingAssignment.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + property int value: 10 + + rect.x: value +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingConflict.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingConflict.qml new file mode 100644 index 0000000000..fd25c9f0a7 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/bindingConflict.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + property int value: 13 + + rect.x: value + rect: "10,10,10x10" +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingRead.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingRead.qml new file mode 100644 index 0000000000..538d776fba --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/bindingRead.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + property int value: rect.x +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingVariantCopy.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingVariantCopy.qml new file mode 100644 index 0000000000..3a48c8bdb1 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/bindingVariantCopy.qml @@ -0,0 +1,13 @@ +import Test 1.0 + +MyTypeObject { + property variant object + object: MyTypeObject { + rect.x: 19 + rect.y: 33 + rect.width: 5 + rect.height: 99 + } + + rect: object.rect +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.1.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.1.qml new file mode 100644 index 0000000000..2a1b936da6 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.1.qml @@ -0,0 +1,29 @@ +import Test 1.0 +import QtQuick 2.0 + +BindingsSpliceCorrectlyType { + property bool test: false + + property bool italicProperty: false + + font.italic: italicProperty + + Component.onCompleted: { + // Test initial state + if (font.italic != false) return; + if (font.bold != false) return; + + // Test italic binding worked + italicProperty = true; + + if (font.italic != true) return; + if (font.bold != false) return; + + // Test bold binding worked + boldProperty = true; + if (font.italic != true) return; + if (font.bold != true) return; + + test = true; + } +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.2.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.2.qml new file mode 100644 index 0000000000..84b465c565 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.2.qml @@ -0,0 +1,31 @@ +import Test 1.0 +import QtQuick 2.0 + +BindingsSpliceCorrectlyType { + property bool test: false + + property bool italicProperty: false + + font.italic: italicProperty + font.bold: false + + Component.onCompleted: { + // Test initial state + if (font.italic != false) return; + if (font.bold != false) return; + + // Test italic binding worked + italicProperty = true; + + if (font.italic != true) return; + if (font.bold != false) return; + + // Test bold binding was removed by constant write + boldProperty = true; + if (font.italic != true) return; + if (font.bold != false) return; + + test = true; + } +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.3.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.3.qml new file mode 100644 index 0000000000..f1212f8039 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.3.qml @@ -0,0 +1,36 @@ +import Test 1.0 +import QtQuick 2.0 + +BindingsSpliceCorrectlyType { + property bool test: false + + property bool italicProperty: false + property bool boldProperty2: false + + font.italic: italicProperty + font.bold: boldProperty2 + + Component.onCompleted: { + // Test initial state + if (font.italic != false) return; + if (font.bold != false) return; + + // Test italic binding worked + italicProperty = true; + + if (font.italic != true) return; + if (font.bold != false) return; + + // Test bold binding was overridden + boldProperty = true; + if (font.italic != true) return; + if (font.bold != false) return; + + boldProperty2 = true; + if (font.italic != true) return; + if (font.bold != true) return; + + test = true; + } +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.4.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.4.qml new file mode 100644 index 0000000000..9c5e950660 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.4.qml @@ -0,0 +1,27 @@ +import Test 1.0 +import QtQuick 2.0 + +BindingsSpliceCorrectlyType4 { + property bool test: false + + property int dataProperty2: 8 + + point.x: dataProperty2 + + Component.onCompleted: { + if (point.x != 8) return; + if (point.y != 4) return; + + dataProperty = 9; + + if (point.x != 8) return; + if (point.y != 4) return; + + dataProperty2 = 13; + + if (point.x != 13) return; + if (point.y != 4) return; + + test = true; + } +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.5.qml b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.5.qml new file mode 100644 index 0000000000..7d87ba1782 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/bindingsSpliceCorrectly.5.qml @@ -0,0 +1,27 @@ +import Test 1.0 +import QtQuick 2.0 + +BindingsSpliceCorrectlyType5 { + property bool test: false + + property int dataProperty2: 8 + + point: Qt.point(dataProperty2, dataProperty2); + + Component.onCompleted: { + if (point.x != 8) return; + if (point.y != 8) return; + + dataProperty = 9; + + if (point.x != 8) return; + if (point.y != 8) return; + + dataProperty2 = 13; + + if (point.x != 13) return; + if (point.y != 13) return; + + test = true; + } +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/color_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/color_compare.qml new file mode 100644 index 0000000000..8701dae612 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/color_compare.qml @@ -0,0 +1,37 @@ +import Test 1.0 + +MyTypeObject { + property real v_r: color.r + property real v_g: color.g + property real v_b: color.b + property real v_a: color.a + property variant copy: color + property string colorToString: color.toString() + + // compare different colors + property bool colorEqualsIdenticalRgba: (color == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // true + property bool colorEqualsDifferentAlpha: (color == Qt.rgba(0.2, 0.88, 0.6, 0.44)) // false + property bool colorEqualsDifferentRgba: (color == Qt.rgba(0.3, 0.98, 0.7, 0.44)) // false + + // compare different color.toString()s + property bool colorToStringEqualsColorString: (color.toString() == colorToString) // true + property bool colorToStringEqualsDifferentAlphaString: (color.toString() == Qt.rgba(0.2, 0.88, 0.6, 0.44).toString()) // true + property bool colorToStringEqualsDifferentRgbaString: (color.toString() == Qt.rgba(0.3, 0.98, 0.7, 0.44).toString()) // false + + // compare colors to strings + property bool colorEqualsColorString: (color == colorToString) // false + property bool colorEqualsDifferentAlphaString: (color == Qt.rgba(0.2, 0.88, 0.6, 0.44).toString()) // false + property bool colorEqualsDifferentRgbaString: (color == Qt.rgba(0.3, 0.98, 0.7, 0.44).toString()) // false + + // compare colors to various value types + property bool equalsColor: (color == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // true + property bool equalsVector3d: (color == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (color == Qt.size(1912, 1913)) // false + property bool equalsPoint: (color == Qt.point(10, 4)) // false + property bool equalsRect: (color == Qt.rect(2, 3, 109, 102)) // false + + // ensure comparison directionality doesn't matter + property bool equalsColorRHS: (Qt.rgba(0.2, 0.88, 0.6, 0.34) == color) // true + property bool colorEqualsCopy: (color == copy) // true + property bool copyEqualsColor: (copy == color) // true +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/color_read.qml b/tests/auto/qml/qqmlvaluetypes/data/color_read.qml new file mode 100644 index 0000000000..bc92b1e5f9 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/color_read.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + property real v_r: color.r + property real v_g: color.g + property real v_b: color.b + property real v_a: color.a + property variant copy: color +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/color_write.qml b/tests/auto/qml/qqmlvaluetypes/data/color_write.qml new file mode 100644 index 0000000000..3f1bad4aa6 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/color_write.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + color.r: if (true) 0.5 + color.g: if (true) 0.38 + color.b: if (true) 0.3 + color.a: if (true) 0.7 +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/conflicting.1.qml b/tests/auto/qml/qqmlvaluetypes/data/conflicting.1.qml new file mode 100644 index 0000000000..923922c55a --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/conflicting.1.qml @@ -0,0 +1,42 @@ +import QtQuick 2.0 + +Rectangle { + id: root + + width: 800 + height: 600 + + property alias font: myText.font + + property int myPixelSize: 12 + property int myPixelSize2: 24 + + Text { + id: other + font.pixelSize: 6 + } + + Text { + id: myText + + text: "Hello world!" + font.pixelSize: myPixelSize + } + + states: State { + name: "Swapped" + PropertyChanges { + target: myText + font: other.font + } + } + + function toggle() { + if (root.state == "") root.state = "Swapped"; else root.state = ""; + } + + MouseArea { + anchors.fill: parent + onClicked: { if (root.state == "") root.state = "Swapped"; else root.state = "";} + } +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/conflicting.2.qml b/tests/auto/qml/qqmlvaluetypes/data/conflicting.2.qml new file mode 100644 index 0000000000..9804af4df6 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/conflicting.2.qml @@ -0,0 +1,42 @@ +import QtQuick 2.0 + +Rectangle { + id: root + + width: 800 + height: 600 + + property alias font: myText.font + + property int myPixelSize: 12 + property int myPixelSize2: 24 + + Text { + id: other + font.pixelSize: 6 + } + + Text { + id: myText + + text: "Hello world!" + font: other.font + } + + states: State { + name: "Swapped" + PropertyChanges { + target: myText + font.pixelSize: myPixelSize + } + } + + function toggle() { + if (root.state == "") root.state = "Swapped"; else root.state = ""; + } + + MouseArea { + anchors.fill: parent + onClicked: { if (root.state == "") root.state = "Swapped"; else root.state = "";} + } +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/conflicting.3.qml b/tests/auto/qml/qqmlvaluetypes/data/conflicting.3.qml new file mode 100644 index 0000000000..b5bb7f8ccc --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/conflicting.3.qml @@ -0,0 +1,42 @@ +import QtQuick 2.0 + +Rectangle { + id: root + + width: 800 + height: 600 + + property alias font: myText.font + + property int myPixelSize: 12 + property int myPixelSize2: 24 + + Text { + id: other + font.pixelSize: 6 + } + + Text { + id: myText + + text: "Hello world!" + font.pixelSize: myPixelSize + } + + states: State { + name: "Swapped" + PropertyChanges { + target: myText + font.pixelSize: myPixelSize2 + } + } + + function toggle() { + if (root.state == "") root.state = "Swapped"; else root.state = ""; + } + + MouseArea { + anchors.fill: parent + onClicked: { if (root.state == "") root.state = "Swapped"; else root.state = "";} + } +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/deletedObject.js b/tests/auto/qml/qqmlvaluetypes/data/deletedObject.js new file mode 100644 index 0000000000..af298ffbd0 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/deletedObject.js @@ -0,0 +1,13 @@ +var savedReference; + +function startup() +{ + savedReference = object.rect; + console.log("Test: " + savedReference.x); +} + +function afterDelete() +{ + console.log("Test: " + savedReference.x); +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/deletedObject.qml b/tests/auto/qml/qqmlvaluetypes/data/deletedObject.qml new file mode 100644 index 0000000000..4f7ad39db0 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/deletedObject.qml @@ -0,0 +1,11 @@ +import Test 1.0 +import QtQuick 2.0 +import "deletedObject.js" as JS + +MyTypeObject { + property variant object + + object: MyTypeObject {} + Component.onCompleted: JS.startup() + onRunScript: JS.afterDelete() +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/enums.1.qml b/tests/auto/qml/qqmlvaluetypes/data/enums.1.qml new file mode 100644 index 0000000000..cb01a80669 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/enums.1.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + font.capitalization: "AllUppercase" +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/enums.2.qml b/tests/auto/qml/qqmlvaluetypes/data/enums.2.qml new file mode 100644 index 0000000000..93f1ed59bc --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/enums.2.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + font.capitalization: if (1) "AllUppercase" +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/enums.3.qml b/tests/auto/qml/qqmlvaluetypes/data/enums.3.qml new file mode 100644 index 0000000000..cc7861a122 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/enums.3.qml @@ -0,0 +1,6 @@ +import Test 1.0 +import QtQuick 2.0 + +MyTypeObject { + font.capitalization: Font.AllUppercase +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/enums.4.qml b/tests/auto/qml/qqmlvaluetypes/data/enums.4.qml new file mode 100644 index 0000000000..cf41c90b90 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/enums.4.qml @@ -0,0 +1,7 @@ +import Test 1.0 +import QtQuick 2.0 as MyQt + +MyTypeObject { + font.capitalization: MyQt.Font.AllUppercase +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/enums.5.qml b/tests/auto/qml/qqmlvaluetypes/data/enums.5.qml new file mode 100644 index 0000000000..de279dba6c --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/enums.5.qml @@ -0,0 +1,10 @@ +import Test 1.0 +import QtQuick 2.0 as MyQt + +MyTypeObject { + MyQt.Component.onCompleted: { + font.capitalization = MyQt.Font.AllUppercase + } +} + + diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/font_compare.qml new file mode 100644 index 0000000000..efbb0e3d0b --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/font_compare.qml @@ -0,0 +1,31 @@ +import Test 1.0 + +MyTypeObject { + property string f_family: font.family + property bool f_bold: font.bold + property int f_weight: font.weight + property bool f_italic: font.italic + property bool f_underline: font.underline + property bool f_overline: font.overline + property bool f_strikeout: font.strikeout + property real f_pointSize: font.pointSize + property int f_pixelSize: font.pixelSize + property int f_capitalization: font.capitalization + property real f_letterSpacing: font.letterSpacing + property real f_wordSpacing: font.wordSpacing; + property variant copy: font + property string tostring: font.toString() + + // compare to string + property bool equalsString: (font == tostring) + + // compare fonts to various value types + property bool equalsColor: (font == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (font == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (font == Qt.size(1912, 1913)) // false + property bool equalsPoint: (font == Qt.point(10, 4)) // false + property bool equalsRect: (font == Qt.rect(2, 3, 109, 102)) // false + + property bool equalsSelf: (font == font) // true +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_read.qml b/tests/auto/qml/qqmlvaluetypes/data/font_read.qml new file mode 100644 index 0000000000..d73bb132d3 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/font_read.qml @@ -0,0 +1,18 @@ +import Test 1.0 + +MyTypeObject { + property string f_family: font.family + property bool f_bold: font.bold + property int f_weight: font.weight + property bool f_italic: font.italic + property bool f_underline: font.underline + property bool f_overline: font.overline + property bool f_strikeout: font.strikeout + property real f_pointSize: font.pointSize + property int f_pixelSize: font.pixelSize + property int f_capitalization: font.capitalization + property real f_letterSpacing: font.letterSpacing + property real f_wordSpacing: font.wordSpacing; + property variant copy: font +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.2.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.2.qml new file mode 100644 index 0000000000..b559389efb --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.2.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + font.pixelSize: 10 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.3.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.3.qml new file mode 100644 index 0000000000..913ac50738 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.3.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + font.pixelSize: 10 + font.pointSize: 19 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.4.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.4.qml new file mode 100644 index 0000000000..2ec69d7281 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.4.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + font.pointSize: 19 + font.pixelSize: 10 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.5.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.5.qml new file mode 100644 index 0000000000..5297a8260d --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.5.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 +import Test 1.0 + +Item { + MyTypeObject { + objectName: "object1" + font.pixelSize: 19 + } + MyTypeObject { + objectName: "object2" + font.pointSize: 14 + } +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/font_write.qml b/tests/auto/qml/qqmlvaluetypes/data/font_write.qml new file mode 100644 index 0000000000..ff4d0a1004 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/font_write.qml @@ -0,0 +1,16 @@ +import Test 1.0 + +MyTypeObject { + font.family: if(1) "Helvetica" + font.bold: if(1) false + font.weight: "Normal" + font.italic: if(1) false + font.underline: if(1) false + font.overline: if(1) false + font.strikeout: if(1) false + font.pointSize: if(1) 15 + font.capitalization: "AllLowercase" + font.letterSpacing: if(1) 9.7 + font.wordSpacing: if(1) 11.2 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_compare.qml new file mode 100644 index 0000000000..94292302cc --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_compare.qml @@ -0,0 +1,35 @@ +import Test 1.0 + +MyTypeObject { + property real v_m11: matrix.m11 + property real v_m12: matrix.m12 + property real v_m13: matrix.m13 + property real v_m14: matrix.m14 + property real v_m21: matrix.m21 + property real v_m22: matrix.m22 + property real v_m23: matrix.m23 + property real v_m24: matrix.m24 + property real v_m31: matrix.m31 + property real v_m32: matrix.m32 + property real v_m33: matrix.m33 + property real v_m34: matrix.m34 + property real v_m41: matrix.m41 + property real v_m42: matrix.m42 + property real v_m43: matrix.m43 + property real v_m44: matrix.m44 + property variant copy: matrix + property string tostring: matrix.toString() + + // compare to string + property bool equalsString: (matrix == tostring) + + // compare matrix4x4s to various value types + property bool equalsColor: (matrix == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (matrix == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (matrix == Qt.size(1912, 1913)) // false + property bool equalsPoint: (matrix == Qt.point(10, 4)) // false + property bool equalsRect: (matrix == Qt.rect(2, 3, 109, 102)) // false + + property bool equalsSelf: (matrix == matrix) // true +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_read.qml b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_read.qml new file mode 100644 index 0000000000..6c4a68258c --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_read.qml @@ -0,0 +1,22 @@ +import Test 1.0 + +MyTypeObject { + property real v_m11: matrix.m11 + property real v_m12: matrix.m12 + property real v_m13: matrix.m13 + property real v_m14: matrix.m14 + property real v_m21: matrix.m21 + property real v_m22: matrix.m22 + property real v_m23: matrix.m23 + property real v_m24: matrix.m24 + property real v_m31: matrix.m31 + property real v_m32: matrix.m32 + property real v_m33: matrix.m33 + property real v_m34: matrix.m34 + property real v_m41: matrix.m41 + property real v_m42: matrix.m42 + property real v_m43: matrix.m43 + property real v_m44: matrix.m44 + property variant copy: matrix +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_write.qml b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_write.qml new file mode 100644 index 0000000000..2a9f154d6f --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/matrix4x4_write.qml @@ -0,0 +1,21 @@ +import Test 1.0 + +MyTypeObject { + matrix.m11: if (true) 11 + matrix.m12: if (true) 12 + matrix.m13: if (true) 13 + matrix.m14: if (true) 14 + matrix.m21: if (true) 21 + matrix.m22: if (true) 22 + matrix.m23: if (true) 23 + matrix.m24: if (true) 24 + matrix.m31: if (true) 31 + matrix.m32: if (true) 32 + matrix.m33: if (true) 33 + matrix.m34: if (true) 34 + matrix.m41: if (true) 41 + matrix.m42: if (true) 42 + matrix.m43: if (true) 43 + matrix.m44: if (true) 44 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/point_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/point_compare.qml new file mode 100644 index 0000000000..c0041b4bb1 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/point_compare.qml @@ -0,0 +1,22 @@ +import Test 1.0 + +MyTypeObject { + property int p_x: point.x + property int p_y: point.y + property variant copy: point + property string tostring: point.toString() + + // compare to string + property bool equalsString: (point == tostring) + + // compare points to various value types + property bool equalsColor: (point == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (point == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (point == Qt.size(1912, 1913)) // false + property bool equalsPoint: (point == Qt.point(10, 4)) // true + property bool equalsRect: (point == Qt.rect(2, 3, 109, 102)) // false + + property bool equalsSelf: (point == point) // true + property bool equalsOther: (point == Qt.point(15, 4)) // false + property bool pointEqualsPointf: (point == pointfpoint) // true +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/point_read.qml b/tests/auto/qml/qqmlvaluetypes/data/point_read.qml new file mode 100644 index 0000000000..4bb6c5384c --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/point_read.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + property int p_x: point.x + property int p_y: point.y + property variant copy: point +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/point_write.qml b/tests/auto/qml/qqmlvaluetypes/data/point_write.qml new file mode 100644 index 0000000000..063525a6f0 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/point_write.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + point.x: if (true) 11 + point.y: if (true) 12 +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/pointf_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/pointf_compare.qml new file mode 100644 index 0000000000..0d70137934 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/pointf_compare.qml @@ -0,0 +1,22 @@ +import Test 1.0 + +MyTypeObject { + property int p_x: point.x + property int p_y: point.y + property variant copy: point + property string tostring: pointf.toString() + + // compare to string + property bool equalsString: (pointf == tostring) + + // compare pointfs to various value types + property bool equalsColor: (pointf == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (pointf == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (pointf == Qt.size(1912, 1913)) // false + property bool equalsPoint: (pointf == Qt.point(11.3, -10.9)) // true + property bool equalsRect: (pointf == Qt.rect(2, 3, 109, 102)) // false + + property bool equalsSelf: (pointf == pointf) // true + property bool equalsOther: (pointf == Qt.point(6.3, -4.9)) // false + property bool pointfEqualsPoint: (pointfpoint == point) // true +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/pointf_read.qml b/tests/auto/qml/qqmlvaluetypes/data/pointf_read.qml new file mode 100644 index 0000000000..0eab6daabe --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/pointf_read.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + property real p_x: pointf.x + property real p_y: pointf.y + property variant copy: pointf +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/pointf_write.qml b/tests/auto/qml/qqmlvaluetypes/data/pointf_write.qml new file mode 100644 index 0000000000..9ee3fc1bda --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/pointf_write.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + pointf.x: if (true) 6.8 + pointf.y: if (true) 9.3 +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/quaternion_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/quaternion_compare.qml new file mode 100644 index 0000000000..0e82f596af --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/quaternion_compare.qml @@ -0,0 +1,23 @@ +import Test 1.0 + +MyTypeObject { + property real v_scalar: quaternion.scalar + property real v_x: quaternion.x + property real v_y: quaternion.y + property real v_z: quaternion.z + property variant copy: quaternion + property string tostring: quaternion.toString() + + // compare to string + property bool equalsString: (quaternion == tostring) + + // compare quaternions to various value types + property bool equalsColor: (quaternion == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (quaternion == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (quaternion == Qt.size(1912, 1913)) // false + property bool equalsPoint: (quaternion == Qt.point(10, 4)) // false + property bool equalsRect: (quaternion == Qt.rect(2, 3, 109, 102)) // false + + property bool equalsSelf: (quaternion == quaternion) // true +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/quaternion_read.qml b/tests/auto/qml/qqmlvaluetypes/data/quaternion_read.qml new file mode 100644 index 0000000000..d1a21dc926 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/quaternion_read.qml @@ -0,0 +1,10 @@ +import Test 1.0 + +MyTypeObject { + property real v_scalar: quaternion.scalar + property real v_x: quaternion.x + property real v_y: quaternion.y + property real v_z: quaternion.z + property variant copy: quaternion +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/quaternion_write.qml b/tests/auto/qml/qqmlvaluetypes/data/quaternion_write.qml new file mode 100644 index 0000000000..0c3e5afd98 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/quaternion_write.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + quaternion.scalar: if (true) 88.5 + quaternion.x: if (true) -0.3 + quaternion.y: if (true) -12.9 + quaternion.z: if (true) 907.4 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/rect_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/rect_compare.qml new file mode 100644 index 0000000000..c511c2dfc4 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/rect_compare.qml @@ -0,0 +1,25 @@ +import Test 1.0 + +MyTypeObject { + property int r_x: rect.x + property int r_y: rect.y + property int r_width: rect.width + property int r_height: rect.height + property variant copy: rect + property string tostring: rect.toString() + + // compare to string + property bool equalsString: (rect == tostring) + + // compare rects to various value types + property bool equalsColor: (rect == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (rect == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (rect == Qt.size(1912, 1913)) // false + property bool equalsPoint: (rect == Qt.point(10, 4)) // false + property bool equalsRect: (rect == Qt.rect(2, 3, 109, 102)) // true + + property bool equalsSelf: (rect == rect) // true + property bool equalsOther: (rect == Qt.rect(6, 9, 99, 92)) // false + property bool rectEqualsRectf: (rect == rectfrect) // true +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/rect_read.qml b/tests/auto/qml/qqmlvaluetypes/data/rect_read.qml new file mode 100644 index 0000000000..c3b37a7099 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/rect_read.qml @@ -0,0 +1,10 @@ +import Test 1.0 + +MyTypeObject { + property int r_x: rect.x + property int r_y: rect.y + property int r_width: rect.width + property int r_height: rect.height + property variant copy: rect +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/rect_write.qml b/tests/auto/qml/qqmlvaluetypes/data/rect_write.qml new file mode 100644 index 0000000000..8add45305c --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/rect_write.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + rect.x: if (true) 1234 + rect.y: if (true) 7 + rect.width: if (true) 56 + rect.height: if (true) 63 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/rectf_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/rectf_compare.qml new file mode 100644 index 0000000000..6ac4049558 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/rectf_compare.qml @@ -0,0 +1,25 @@ +import Test 1.0 + +MyTypeObject { + property real r_x: rectf.x + property real r_y: rectf.y + property real r_width: rectf.width + property real r_height: rectf.height + property variant copy: rectf + property string tostring: rectf.toString() + + // compare to string + property bool equalsString: (rectf == tostring) + + // compare rectfs to various value types + property bool equalsColor: (rectf == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (rectf == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (rectf == Qt.size(1912, 1913)) // false + property bool equalsPoint: (rectf == Qt.point(10, 4)) // false + property bool equalsRect: (rectf == Qt.rect(103.8, 99.2, 88.1, 77.6)) // true + + property bool equalsSelf: (rectf == rectf) // true + property bool equalsOther: (rectf == Qt.rect(13.8, 9.2, 78.7, 96.2)) // false + property bool rectfEqualsRect: (rectfrect == rect) // true +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/rectf_read.qml b/tests/auto/qml/qqmlvaluetypes/data/rectf_read.qml new file mode 100644 index 0000000000..6ff3ce30bf --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/rectf_read.qml @@ -0,0 +1,10 @@ +import Test 1.0 + +MyTypeObject { + property real r_x: rectf.x + property real r_y: rectf.y + property real r_width: rectf.width + property real r_height: rectf.height + property variant copy: rectf +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/rectf_write.qml b/tests/auto/qml/qqmlvaluetypes/data/rectf_write.qml new file mode 100644 index 0000000000..1e6ff4ff90 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/rectf_write.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + rectf.x: if (true) 70.1 + rectf.y: if (true) -113.2 + rectf.width: if (true) 80924.8 + rectf.height: if (true) 99.2 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/returnValues.qml b/tests/auto/qml/qqmlvaluetypes/data/returnValues.qml new file mode 100644 index 0000000000..1f9816f666 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/returnValues.qml @@ -0,0 +1,17 @@ +import Test 1.0 +import QtQuick 2.0 + +MyTypeObject { + property bool test1: false; + property bool test2: false; + + Component.onCompleted: { + var a = method(); + + test1 = (a.width == 13) + test2 = (a.height == 14) + + size = a; + } +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/scriptAccess.qml b/tests/auto/qml/qqmlvaluetypes/data/scriptAccess.qml new file mode 100644 index 0000000000..cbecb4379a --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/scriptAccess.qml @@ -0,0 +1,9 @@ +import QtQuick 2.0 +import Test 1.0 + +MyTypeObject { + property int valuePre; + property int valuePost; + + Component.onCompleted: { valuePre = rect.x; rect.x = 19; valuePost = rect.x; } +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/scriptVariantCopy.qml b/tests/auto/qml/qqmlvaluetypes/data/scriptVariantCopy.qml new file mode 100644 index 0000000000..42fccfac5a --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/scriptVariantCopy.qml @@ -0,0 +1,14 @@ +import Test 1.0 + +MyTypeObject { + property variant object + object: MyTypeObject { + rect.x: 19 + rect.y: 33 + rect.width: 5 + rect.height: 99 + } + + onRunScript: rect = object.rect +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/size_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/size_compare.qml new file mode 100644 index 0000000000..1fd4711c15 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/size_compare.qml @@ -0,0 +1,23 @@ +import Test 1.0 + +MyTypeObject { + property int s_width: size.width + property int s_height: size.height + property variant copy: size + property string tostring: size.toString() + + // compare to string + property bool equalsString: (size == tostring) + + // compare sizes to various value types + property bool equalsColor: (size == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (size == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (size == Qt.size(1912, 1913)) // true + property bool equalsPoint: (size == Qt.point(10, 4)) // false + property bool equalsRect: (size == Qt.rect(2, 3, 109, 102)) // false + + property bool equalsSelf: (size == size) // true + property bool equalsOther: (size == Qt.size(1212, 1313)) // false + property bool sizeEqualsSizef: (size == sizefsize) // true +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/size_read.qml b/tests/auto/qml/qqmlvaluetypes/data/size_read.qml new file mode 100644 index 0000000000..a49fd9f760 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/size_read.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + property int s_width: size.width + property int s_height: size.height + property variant copy: size +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/size_write.qml b/tests/auto/qml/qqmlvaluetypes/data/size_write.qml new file mode 100644 index 0000000000..2f9d10e45f --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/size_write.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + size.width: if (true) 13 + size.height: if (true) 88 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizef_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/sizef_compare.qml new file mode 100644 index 0000000000..c74a049454 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/sizef_compare.qml @@ -0,0 +1,24 @@ +import Test 1.0 + +MyTypeObject { + property real s_width: sizef.width + property real s_height: sizef.height + property variant copy: sizef + property string tostring: sizef.toString() + + // compare to string + property bool equalsString: (sizef == tostring) + + // compare sizefs to various value types + property bool equalsColor: (sizef == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (sizef == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (sizef == Qt.size(0.1, 100923.2)) // true + property bool equalsPoint: (sizef == Qt.point(10, 4)) // false + property bool equalsRect: (sizef == Qt.rect(2, 3, 109, 102)) // false + + property bool equalsSelf: (sizef == sizef) // true + property bool equalsOther: (size == Qt.size(3.1, 923.2)) // false + property bool sizefEqualsSize: (sizefsize == size) // true +} + + diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizef_read.qml b/tests/auto/qml/qqmlvaluetypes/data/sizef_read.qml new file mode 100644 index 0000000000..96cd425f17 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/sizef_read.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + property real s_width: sizef.width + property real s_height: sizef.height + property variant copy: sizef +} + + diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizef_write.qml b/tests/auto/qml/qqmlvaluetypes/data/sizef_write.qml new file mode 100644 index 0000000000..f16f0bdf93 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/sizef_write.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + sizef.width: if (true) 44.3 + sizef.height: if (true) 92.8 +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_read.qml b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_read.qml new file mode 100644 index 0000000000..7f708a0899 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_read.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + property int s_width: sizereadonly.width + property int s_height: sizereadonly.height + property variant copy: sizereadonly +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror.qml b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror.qml new file mode 100644 index 0000000000..3254557014 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + sizereadonly: "13x88" +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror2.qml b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror2.qml new file mode 100644 index 0000000000..656d718b05 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror2.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + sizereadonly.width: if (true) 13 + sizereadonly.height: if (true) 88 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror3.qml b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror3.qml new file mode 100644 index 0000000000..b8e3f0d41b --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror3.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + sizereadonly.width: 13 + sizereadonly.height: 88 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror4.qml b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror4.qml new file mode 100644 index 0000000000..68b54b571e --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/sizereadonly_writeerror4.qml @@ -0,0 +1,10 @@ +import Test 1.0 +import QtQuick 2.0 + +MyTypeObject { + Component.onCompleted: { + sizereadonly.width = 13; + } +} + + diff --git a/tests/auto/qml/qqmlvaluetypes/data/staticAssignment.qml b/tests/auto/qml/qqmlvaluetypes/data/staticAssignment.qml new file mode 100644 index 0000000000..b687f89eef --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/staticAssignment.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + rect.x: 9 +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/valueInterceptors.qml b/tests/auto/qml/qqmlvaluetypes/data/valueInterceptors.qml new file mode 100644 index 0000000000..0897847d2d --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/valueInterceptors.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + property int value: 13; + + MyOffsetValueInterceptor on rect.x {} + rect.x: value +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/valueSources.qml b/tests/auto/qml/qqmlvaluetypes/data/valueSources.qml new file mode 100644 index 0000000000..717f3502c0 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/valueSources.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyTypeObject { + MyConstantValueSource on rect.x {} +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/varAssignment.qml b/tests/auto/qml/qqmlvaluetypes/data/varAssignment.qml new file mode 100644 index 0000000000..9b56abbbed --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/varAssignment.qml @@ -0,0 +1,14 @@ +import QtQuick 2.0 + +QtObject { + property int x; + property int y; + property int z; + + Component.onCompleted: { + var vec3 = Qt.vector3d(1, 2, 3); + x = vec3.x; + y = vec3.y; + z = vec3.z; + } +} diff --git a/tests/auto/qml/qqmlvaluetypes/data/variant_read.qml b/tests/auto/qml/qqmlvaluetypes/data/variant_read.qml new file mode 100644 index 0000000000..a08f3db94f --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/variant_read.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + property real s_width: variant.width + property real s_height: variant.height + property variant copy: variant +} + + diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector2d_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/vector2d_compare.qml new file mode 100644 index 0000000000..eb8fb5bb76 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/vector2d_compare.qml @@ -0,0 +1,21 @@ +import Test 1.0 + +MyTypeObject { + property real v_x: vector2.x + property real v_y: vector2.y + property variant copy: vector2 + property string tostring: vector2.toString() + + // compare to string + property bool equalsString: (vector2 == tostring) + + // compare vector2ds to various value types + property bool equalsColor: (vector2 == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (vector2 == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (vector2 == Qt.size(1912, 1913)) // false + property bool equalsPoint: (vector2 == Qt.point(10, 4)) // false + property bool equalsRect: (vector2 == Qt.rect(2, 3, 109, 102)) // false + + property bool equalsSelf: (vector2 == vector2) +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector2d_read.qml b/tests/auto/qml/qqmlvaluetypes/data/vector2d_read.qml new file mode 100644 index 0000000000..fc315f7abf --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/vector2d_read.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + property real v_x: vector2.x + property real v_y: vector2.y + property variant copy: vector2 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector2d_write.qml b/tests/auto/qml/qqmlvaluetypes/data/vector2d_write.qml new file mode 100644 index 0000000000..f0e35ff200 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/vector2d_write.qml @@ -0,0 +1,7 @@ +import Test 1.0 + +MyTypeObject { + vector2.x: if (true) -0.3 + vector2.y: if (true) -12.9 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector3d_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/vector3d_compare.qml new file mode 100644 index 0000000000..7bda1d17f4 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/vector3d_compare.qml @@ -0,0 +1,23 @@ +import Test 1.0 + +MyTypeObject { + property real v_x: vector.x + property real v_y: vector.y + property real v_z: vector.z + property variant copy: vector + property string tostring: vector.toString() + + // compare to string + property bool equalsString: (vector == tostring) + + // compare vector3ds to various value types + property bool equalsColor: (vector == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (vector == Qt.vector3d(23.88, 3.1, 4.3)) // true + property bool equalsSize: (vector == Qt.size(1912, 1913)) // false + property bool equalsPoint: (vector == Qt.point(10, 4)) // false + property bool equalsRect: (vector == Qt.rect(2, 3, 109, 102)) // false + + property bool equalsSelf: (vector == vector) // true + property bool equalsOther: (vector == Qt.vector3d(3.1, 2.2, 923.2)) // false +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector3d_read.qml b/tests/auto/qml/qqmlvaluetypes/data/vector3d_read.qml new file mode 100644 index 0000000000..f1e876dbb9 --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/vector3d_read.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + property real v_x: vector.x + property real v_y: vector.y + property real v_z: vector.z + property variant copy: vector +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector3d_write.qml b/tests/auto/qml/qqmlvaluetypes/data/vector3d_write.qml new file mode 100644 index 0000000000..9c1bf7620a --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/vector3d_write.qml @@ -0,0 +1,8 @@ +import Test 1.0 + +MyTypeObject { + vector.x: if (true) -0.3 + vector.y: if (true) -12.9 + vector.z: if (true) 907.4 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector4d_compare.qml b/tests/auto/qml/qqmlvaluetypes/data/vector4d_compare.qml new file mode 100644 index 0000000000..3ea42a59ce --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/vector4d_compare.qml @@ -0,0 +1,23 @@ +import Test 1.0 + +MyTypeObject { + property real v_x: vector4.x + property real v_y: vector4.y + property real v_z: vector4.z + property real v_w: vector4.w + property variant copy: vector4 + property string tostring: vector4.toString() + + // compare to string + property bool equalsString: (vector4 == tostring) + + // compare vector4ds to various value types + property bool equalsColor: (vector4 == Qt.rgba(0.2, 0.88, 0.6, 0.34)) // false + property bool equalsVector3d: (vector4 == Qt.vector3d(1, 2, 3)) // false + property bool equalsSize: (vector4 == Qt.size(1912, 1913)) // false + property bool equalsPoint: (vector4 == Qt.point(10, 4)) // false + property bool equalsRect: (vector4 == Qt.rect(2, 3, 109, 102)) // false + + property bool equalsSelf: (vector4 == vector4) // true +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector4d_read.qml b/tests/auto/qml/qqmlvaluetypes/data/vector4d_read.qml new file mode 100644 index 0000000000..f9d5d6053e --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/vector4d_read.qml @@ -0,0 +1,10 @@ +import Test 1.0 + +MyTypeObject { + property real v_x: vector4.x + property real v_y: vector4.y + property real v_z: vector4.z + property real v_w: vector4.w + property variant copy: vector4 +} + diff --git a/tests/auto/qml/qqmlvaluetypes/data/vector4d_write.qml b/tests/auto/qml/qqmlvaluetypes/data/vector4d_write.qml new file mode 100644 index 0000000000..548698126d --- /dev/null +++ b/tests/auto/qml/qqmlvaluetypes/data/vector4d_write.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + vector4.x: if (true) -0.3 + vector4.y: if (true) -12.9 + vector4.z: if (true) 907.4 + vector4.w: if (true) 88.5 +} + |