diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativevaluetypes')
86 files changed, 0 insertions, 2777 deletions
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/BindingsSpliceCorrectlyType.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/BindingsSpliceCorrectlyType.qml deleted file mode 100644 index f625d081e5..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/BindingsSpliceCorrectlyType.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 - -MyTypeObject { - property bool boldProperty: false - - font.bold: boldProperty -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/BindingsSpliceCorrectlyType4.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/BindingsSpliceCorrectlyType4.qml deleted file mode 100644 index 0bdccce5be..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/BindingsSpliceCorrectlyType4.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 - -MyTypeObject { - property int dataProperty: 7 - - point: Qt.point(dataProperty, dataProperty) -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/BindingsSpliceCorrectlyType5.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/BindingsSpliceCorrectlyType5.qml deleted file mode 100644 index 151c49971e..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/BindingsSpliceCorrectlyType5.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 - -MyTypeObject { - property int dataProperty: 7 - - point.x: dataProperty -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.2.qml deleted file mode 100644 index ce2e82d0f8..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.2.qml +++ /dev/null @@ -1,9 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml deleted file mode 100644 index d431b4ae08..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml +++ /dev/null @@ -1,10 +0,0 @@ -import Test 1.0 - -MyTypeObject { - property variant value - - rect: value - - onRunScript: { rect.x = 44 } -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.qml deleted file mode 100644 index a8a72f515b..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.qml +++ /dev/null @@ -1,9 +0,0 @@ -import Test 1.0 - -MyTypeObject { - property int value: 10 - rect.x: value - - onRunScript: { rect.x = 42; } -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingAssignment.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingAssignment.qml deleted file mode 100644 index a65218669b..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingAssignment.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 - -MyTypeObject { - property int value: 10 - - rect.x: value -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingConflict.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingConflict.qml deleted file mode 100644 index fd25c9f0a7..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingConflict.qml +++ /dev/null @@ -1,8 +0,0 @@ -import Test 1.0 - -MyTypeObject { - property int value: 13 - - rect.x: value - rect: "10,10,10x10" -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingRead.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingRead.qml deleted file mode 100644 index 538d776fba..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingRead.qml +++ /dev/null @@ -1,5 +0,0 @@ -import Test 1.0 - -MyTypeObject { - property int value: rect.x -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml deleted file mode 100644 index 3a48c8bdb1..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml +++ /dev/null @@ -1,13 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.1.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.1.qml deleted file mode 100644 index 2a1b936da6..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.1.qml +++ /dev/null @@ -1,29 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.2.qml deleted file mode 100644 index 84b465c565..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.2.qml +++ /dev/null @@ -1,31 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.3.qml deleted file mode 100644 index f1212f8039..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.3.qml +++ /dev/null @@ -1,36 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.4.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.4.qml deleted file mode 100644 index 9c5e950660..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.4.qml +++ /dev/null @@ -1,27 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.5.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.5.qml deleted file mode 100644 index 7d87ba1782..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/bindingsSpliceCorrectly.5.qml +++ /dev/null @@ -1,27 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/color_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/color_compare.qml deleted file mode 100644 index 8701dae612..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/color_compare.qml +++ /dev/null @@ -1,37 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/color_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/color_read.qml deleted file mode 100644 index bc92b1e5f9..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/color_read.qml +++ /dev/null @@ -1,9 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/color_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/color_write.qml deleted file mode 100644 index 3f1bad4aa6..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/color_write.qml +++ /dev/null @@ -1,8 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/conflicting.1.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.1.qml deleted file mode 100644 index 923922c55a..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.1.qml +++ /dev/null @@ -1,42 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/conflicting.2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.2.qml deleted file mode 100644 index 9804af4df6..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.2.qml +++ /dev/null @@ -1,42 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/conflicting.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.3.qml deleted file mode 100644 index b5bb7f8ccc..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/conflicting.3.qml +++ /dev/null @@ -1,42 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/deletedObject.js b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.js deleted file mode 100644 index af298ffbd0..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.js +++ /dev/null @@ -1,13 +0,0 @@ -var savedReference; - -function startup() -{ - savedReference = object.rect; - console.log("Test: " + savedReference.x); -} - -function afterDelete() -{ - console.log("Test: " + savedReference.x); -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml deleted file mode 100644 index 4f7ad39db0..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml +++ /dev/null @@ -1,11 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/enums.1.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.1.qml deleted file mode 100644 index cb01a80669..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.1.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Test 1.0 - -MyTypeObject { - font.capitalization: "AllUppercase" -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.2.qml deleted file mode 100644 index 93f1ed59bc..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.2.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Test 1.0 - -MyTypeObject { - font.capitalization: if (1) "AllUppercase" -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.3.qml deleted file mode 100644 index cc7861a122..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.3.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Test 1.0 -import QtQuick 2.0 - -MyTypeObject { - font.capitalization: Font.AllUppercase -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.4.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.4.qml deleted file mode 100644 index cf41c90b90..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.4.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 -import QtQuick 2.0 as MyQt - -MyTypeObject { - font.capitalization: MyQt.Font.AllUppercase -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml deleted file mode 100644 index de279dba6c..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml +++ /dev/null @@ -1,10 +0,0 @@ -import Test 1.0 -import QtQuick 2.0 as MyQt - -MyTypeObject { - MyQt.Component.onCompleted: { - font.capitalization = MyQt.Font.AllUppercase - } -} - - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/font_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_compare.qml deleted file mode 100644 index efbb0e3d0b..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/font_compare.qml +++ /dev/null @@ -1,31 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/font_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml deleted file mode 100644 index d73bb132d3..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml +++ /dev/null @@ -1,18 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/font_write.2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.2.qml deleted file mode 100644 index b559389efb..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.2.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Test 1.0 - -MyTypeObject { - font.pixelSize: 10 -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.3.qml deleted file mode 100644 index 913ac50738..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.3.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 - -MyTypeObject { - font.pixelSize: 10 - font.pointSize: 19 -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.4.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.4.qml deleted file mode 100644 index 2ec69d7281..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.4.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 - -MyTypeObject { - font.pointSize: 19 - font.pixelSize: 10 -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.5.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.5.qml deleted file mode 100644 index 5297a8260d..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.5.qml +++ /dev/null @@ -1,14 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/font_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.qml deleted file mode 100644 index ff4d0a1004..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.qml +++ /dev/null @@ -1,16 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/matrix4x4_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_compare.qml deleted file mode 100644 index 94292302cc..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_compare.qml +++ /dev/null @@ -1,35 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/matrix4x4_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_read.qml deleted file mode 100644 index 6c4a68258c..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_read.qml +++ /dev/null @@ -1,22 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/matrix4x4_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_write.qml deleted file mode 100644 index 2a9f154d6f..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/matrix4x4_write.qml +++ /dev/null @@ -1,21 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/nonValueTypeComparison.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/nonValueTypeComparison.qml deleted file mode 100644 index 0ffa5eb666..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/nonValueTypeComparison.qml +++ /dev/null @@ -1,10 +0,0 @@ -import QtQuick 2.0 - -Item { - property variant somepoint: Qt.point(1,2) - property variant randomjsobj: {"some": 1, "thing": 2} - property bool test1: somepoint != randomjsobj - - property variant similar: {"x":1, "y":2} - property bool test2: somepoint != similar -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/point_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/point_compare.qml deleted file mode 100644 index c0041b4bb1..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/point_compare.qml +++ /dev/null @@ -1,22 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/point_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml deleted file mode 100644 index 4bb6c5384c..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml +++ /dev/null @@ -1,7 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/point_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/point_write.qml deleted file mode 100644 index 063525a6f0..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/point_write.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Test 1.0 - -MyTypeObject { - point.x: if (true) 11 - point.y: if (true) 12 -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_compare.qml deleted file mode 100644 index 0d70137934..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_compare.qml +++ /dev/null @@ -1,22 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/pointf_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml deleted file mode 100644 index 0eab6daabe..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml +++ /dev/null @@ -1,8 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/pointf_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_write.qml deleted file mode 100644 index 9ee3fc1bda..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_write.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Test 1.0 - -MyTypeObject { - pointf.x: if (true) 6.8 - pointf.y: if (true) 9.3 -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_compare.qml deleted file mode 100644 index 0e82f596af..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_compare.qml +++ /dev/null @@ -1,23 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/quaternion_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_read.qml deleted file mode 100644 index d1a21dc926..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_read.qml +++ /dev/null @@ -1,10 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/quaternion_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_write.qml deleted file mode 100644 index 0c3e5afd98..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/quaternion_write.qml +++ /dev/null @@ -1,9 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/rect_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_compare.qml deleted file mode 100644 index c511c2dfc4..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/rect_compare.qml +++ /dev/null @@ -1,25 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/rect_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml deleted file mode 100644 index c3b37a7099..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml +++ /dev/null @@ -1,10 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/rect_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_write.qml deleted file mode 100644 index 8add45305c..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/rect_write.qml +++ /dev/null @@ -1,9 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/rectf_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_compare.qml deleted file mode 100644 index 6ac4049558..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_compare.qml +++ /dev/null @@ -1,25 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/rectf_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml deleted file mode 100644 index 6ff3ce30bf..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml +++ /dev/null @@ -1,10 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/rectf_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_write.qml deleted file mode 100644 index 1e6ff4ff90..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_write.qml +++ /dev/null @@ -1,9 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/returnValues.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/returnValues.qml deleted file mode 100644 index 1f9816f666..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/returnValues.qml +++ /dev/null @@ -1,17 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/scriptAccess.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptAccess.qml deleted file mode 100644 index cbecb4379a..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/scriptAccess.qml +++ /dev/null @@ -1,9 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml deleted file mode 100644 index 42fccfac5a..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml +++ /dev/null @@ -1,14 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/size_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/size_compare.qml deleted file mode 100644 index 1fd4711c15..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/size_compare.qml +++ /dev/null @@ -1,23 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/size_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml deleted file mode 100644 index a49fd9f760..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml +++ /dev/null @@ -1,8 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/size_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/size_write.qml deleted file mode 100644 index 2f9d10e45f..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/size_write.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 - -MyTypeObject { - size.width: if (true) 13 - size.height: if (true) 88 -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_compare.qml deleted file mode 100644 index c74a049454..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_compare.qml +++ /dev/null @@ -1,24 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/sizef_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml deleted file mode 100644 index 96cd425f17..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml +++ /dev/null @@ -1,9 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/sizef_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_write.qml deleted file mode 100644 index f16f0bdf93..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_write.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Test 1.0 - -MyTypeObject { - sizef.width: if (true) 44.3 - sizef.height: if (true) 92.8 -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml deleted file mode 100644 index 7f708a0899..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_read.qml +++ /dev/null @@ -1,8 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror.qml deleted file mode 100644 index 3254557014..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror.qml +++ /dev/null @@ -1,6 +0,0 @@ -import Test 1.0 - -MyTypeObject { - sizereadonly: "13x88" -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror2.qml deleted file mode 100644 index 656d718b05..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror2.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 - -MyTypeObject { - sizereadonly.width: if (true) 13 - sizereadonly.height: if (true) 88 -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror3.qml deleted file mode 100644 index b8e3f0d41b..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror3.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 - -MyTypeObject { - sizereadonly.width: 13 - sizereadonly.height: 88 -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror4.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror4.qml deleted file mode 100644 index 68b54b571e..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/sizereadonly_writeerror4.qml +++ /dev/null @@ -1,10 +0,0 @@ -import Test 1.0 -import QtQuick 2.0 - -MyTypeObject { - Component.onCompleted: { - sizereadonly.width = 13; - } -} - - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/staticAssignment.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/staticAssignment.qml deleted file mode 100644 index b687f89eef..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/staticAssignment.qml +++ /dev/null @@ -1,5 +0,0 @@ -import Test 1.0 - -MyTypeObject { - rect.x: 9 -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml deleted file mode 100644 index 0897847d2d..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml +++ /dev/null @@ -1,8 +0,0 @@ -import Test 1.0 - -MyTypeObject { - property int value: 13; - - MyOffsetValueInterceptor on rect.x {} - rect.x: value -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml deleted file mode 100644 index 717f3502c0..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml +++ /dev/null @@ -1,5 +0,0 @@ -import Test 1.0 - -MyTypeObject { - MyConstantValueSource on rect.x {} -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml deleted file mode 100644 index 9b56abbbed..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/varAssignment.qml +++ /dev/null @@ -1,14 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/variant_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/variant_read.qml deleted file mode 100644 index a08f3db94f..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/variant_read.qml +++ /dev/null @@ -1,9 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/vector2d_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_compare.qml deleted file mode 100644 index eb8fb5bb76..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_compare.qml +++ /dev/null @@ -1,21 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/vector2d_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_read.qml deleted file mode 100644 index fc315f7abf..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_read.qml +++ /dev/null @@ -1,8 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/vector2d_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_write.qml deleted file mode 100644 index f0e35ff200..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/vector2d_write.qml +++ /dev/null @@ -1,7 +0,0 @@ -import Test 1.0 - -MyTypeObject { - vector2.x: if (true) -0.3 - vector2.y: if (true) -12.9 -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml deleted file mode 100644 index 7bda1d17f4..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_compare.qml +++ /dev/null @@ -1,23 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/vector3d_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml deleted file mode 100644 index f1e876dbb9..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml +++ /dev/null @@ -1,9 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/vector3d_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_write.qml deleted file mode 100644 index 9c1bf7620a..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_write.qml +++ /dev/null @@ -1,8 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/vector4d_compare.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_compare.qml deleted file mode 100644 index 3ea42a59ce..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_compare.qml +++ /dev/null @@ -1,23 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/vector4d_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_read.qml deleted file mode 100644 index f9d5d6053e..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_read.qml +++ /dev/null @@ -1,10 +0,0 @@ -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/declarative/qdeclarativevaluetypes/data/vector4d_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_write.qml deleted file mode 100644 index 548698126d..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/data/vector4d_write.qml +++ /dev/null @@ -1,9 +0,0 @@ -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 -} - diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro deleted file mode 100644 index 2968c8812b..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro +++ /dev/null @@ -1,18 +0,0 @@ -CONFIG += testcase -TARGET = tst_qdeclarativevaluetypes -macx:CONFIG -= app_bundle - -HEADERS += testtypes.h - -SOURCES += tst_qdeclarativevaluetypes.cpp \ - testtypes.cpp - -include (../../shared/util.pri) - -testDataFiles.files = data -testDataFiles.path = . -DEPLOYMENT += testDataFiles - -CONFIG += parallel_test - -QT += core-private gui-private v8-private declarative-private testlib diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp deleted file mode 100644 index ef9f268b2f..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#include "testtypes.h" - -void registerTypes() -{ - qmlRegisterType<MyTypeObject>("Test", 1, 0, "MyTypeObject"); - qmlRegisterType<MyConstantValueSource>("Test", 1, 0, "MyConstantValueSource"); - qmlRegisterType<MyOffsetValueInterceptor>("Test", 1, 0, "MyOffsetValueInterceptor"); -} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h deleted file mode 100644 index ff0e84ceaf..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h +++ /dev/null @@ -1,219 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ -#ifndef TESTTYPES_H -#define TESTTYPES_H - -#include <QObject> -#include <QPoint> -#include <QPointF> -#include <QSize> -#include <QSizeF> -#include <QRect> -#include <QRectF> -#include <QVector2D> -#include <QVector3D> -#include <QVector4D> -#include <QQuaternion> -#include <QMatrix4x4> -#include <QFont> -#include <QColor> -#include <qdeclarative.h> -#include <QDeclarativePropertyValueSource> -#include <QDeclarativeProperty> -#include <private/qdeclarativeproperty_p.h> -#include <private/qdeclarativepropertyvalueinterceptor_p.h> - -class MyTypeObject : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QPoint point READ point WRITE setPoint NOTIFY changed) - Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed) - Q_PROPERTY(QPointF pointfpoint READ pointfpoint WRITE setPointfpoint NOTIFY changed) - Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed) - Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed) - Q_PROPERTY(QSizeF sizefsize READ sizefsize WRITE setSizefsize NOTIFY changed) - Q_PROPERTY(QSize sizereadonly READ size NOTIFY changed) - Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed) - Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed) - Q_PROPERTY(QRectF rectfrect READ rectfrect WRITE setRectfrect NOTIFY changed) - Q_PROPERTY(QVector2D vector2 READ vector2 WRITE setVector2 NOTIFY changed) - Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed) - Q_PROPERTY(QVector4D vector4 READ vector4 WRITE setVector4 NOTIFY changed) - Q_PROPERTY(QQuaternion quaternion READ quaternion WRITE setQuaternion NOTIFY changed) - Q_PROPERTY(QMatrix4x4 matrix READ matrix WRITE setMatrix NOTIFY changed) - Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed) - Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY changed) - Q_PROPERTY(QVariant variant READ variant NOTIFY changed) - -public: - MyTypeObject() : - m_point(10, 4), - m_pointf(11.3, -10.9), - m_pointfpoint(10.0, 4.0), - m_size(1912, 1913), - m_sizef(0.1, 100923.2), - m_sizefsize(1912.0, 1913.0), - m_rect(2, 3, 109, 102), - m_rectf(103.8, 99.2, 88.1, 77.6), - m_rectfrect(2.0, 3.0, 109.0, 102.0), - m_vector2(32.88, 1.3), - m_vector(23.88, 3.1, 4.3), - m_vector4(54.2, 23.88, 3.1, 4.3), - m_quaternion(4.3, 54.2, 23.88, 3.1), - m_matrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) - { - m_font.setFamily("Arial"); - m_font.setBold(true); - m_font.setWeight(QFont::DemiBold); - m_font.setItalic(true); - m_font.setUnderline(true); - m_font.setOverline(true); - m_font.setStrikeOut(true); - m_font.setPointSize(29); - m_font.setCapitalization(QFont::AllLowercase); - m_font.setLetterSpacing(QFont::AbsoluteSpacing, 10.2); - m_font.setWordSpacing(19.7); - m_color.setRedF(0.2); - m_color.setGreenF(0.88); - m_color.setBlueF(0.6); - m_color.setAlphaF(0.34); - } - - QPoint m_point; - QPoint point() const { return m_point; } - void setPoint(const QPoint &v) { m_point = v; emit changed(); } - - QPointF m_pointf; - QPointF pointf() const { return m_pointf; } - void setPointf(const QPointF &v) { m_pointf = v; emit changed(); } - - QPointF m_pointfpoint; - QPointF pointfpoint() const { return m_pointfpoint; } - void setPointfpoint(const QPointF &v) { m_pointfpoint = v; emit changed(); } - - QSize m_size; - QSize size() const { return m_size; } - void setSize(const QSize &v) { m_size = v; emit changed(); } - - QSizeF m_sizef; - QSizeF sizef() const { return m_sizef; } - void setSizef(const QSizeF &v) { m_sizef = v; emit changed(); } - - QSizeF m_sizefsize; - QSizeF sizefsize() const { return m_sizefsize; } - void setSizefsize(const QSizeF &v) { m_sizefsize = v; emit changed(); } - - QRect m_rect; - QRect rect() const { return m_rect; } - void setRect(const QRect &v) { m_rect = v; emit changed(); } - - QRectF m_rectf; - QRectF rectf() const { return m_rectf; } - void setRectf(const QRectF &v) { m_rectf = v; emit changed(); } - - QRectF m_rectfrect; - QRectF rectfrect() const { return m_rectfrect; } - void setRectfrect(const QRectF &v) { m_rectfrect = v; emit changed(); } - - QVector2D m_vector2; - QVector2D vector2() const { return m_vector2; } - void setVector2(const QVector2D &v) { m_vector2 = v; emit changed(); } - - QVector3D m_vector; - QVector3D vector() const { return m_vector; } - void setVector(const QVector3D &v) { m_vector = v; emit changed(); } - - QVector4D m_vector4; - QVector4D vector4() const { return m_vector4; } - void setVector4(const QVector4D &v) { m_vector4 = v; emit changed(); } - - QQuaternion m_quaternion; - QQuaternion quaternion() const { return m_quaternion; } - void setQuaternion(const QQuaternion &v) { m_quaternion = v; emit changed(); } - - QMatrix4x4 m_matrix; - QMatrix4x4 matrix() const { return m_matrix; } - void setMatrix(const QMatrix4x4 &v) { m_matrix = v; emit changed(); } - - QFont m_font; - QFont font() const { return m_font; } - void setFont(const QFont &v) { m_font = v; emit changed(); } - - QColor m_color; - QColor color() const { return m_color; } - void setColor(const QColor &v) { m_color = v; emit changed(); } - - QVariant variant() const { return sizef(); } - - void emitRunScript() { emit runScript(); } - -signals: - void changed(); - void runScript(); - -public slots: - QSize method() { return QSize(13, 14); } -}; - -class MyConstantValueSource : public QObject, public QDeclarativePropertyValueSource -{ - Q_OBJECT - Q_INTERFACES(QDeclarativePropertyValueSource) -public: - virtual void setTarget(const QDeclarativeProperty &p) { p.write(3345); } -}; - -class MyOffsetValueInterceptor : public QObject, public QDeclarativePropertyValueInterceptor -{ - Q_OBJECT - Q_INTERFACES(QDeclarativePropertyValueInterceptor) -public: - virtual void setTarget(const QDeclarativeProperty &p) { prop = p; } - virtual void write(const QVariant &value) { QDeclarativePropertyPrivate::write(prop, value.toInt() + 13, QDeclarativePropertyPrivate::BypassInterceptor); } - -private: - QDeclarativeProperty prop; -}; - -void registerTypes(); - -#endif // TESTTYPES_H diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp deleted file mode 100644 index 15001f70c8..0000000000 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ /dev/null @@ -1,1319 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <qtest.h> -#include <QDeclarativeEngine> -#include <QDeclarativeComponent> -#include <QDebug> -#include <private/qdeclarativevaluetype_p.h> -#include "../../shared/util.h" -#include "testtypes.h" - -QT_BEGIN_NAMESPACE -extern int qt_defaultDpi(); -QT_END_NAMESPACE - -class tst_qdeclarativevaluetypes : public QDeclarativeDataTest -{ - Q_OBJECT -public: - tst_qdeclarativevaluetypes() {} - -private slots: - void initTestCase(); - - void point(); - void pointf(); - void size(); - void sizef(); - void sizereadonly(); - void rect(); - void rectf(); - void vector2d(); - void vector3d(); - void vector4d(); - void quaternion(); - void matrix4x4(); - void font(); - void color(); - void variant(); - - void bindingAssignment(); - void bindingRead(); - void staticAssignment(); - void scriptAccess(); - void autoBindingRemoval(); - void valueSources(); - void valueInterceptors(); - void bindingConflict(); - void deletedObject(); - void bindingVariantCopy(); - void scriptVariantCopy(); - void cppClasses(); - void enums(); - void conflictingBindings(); - void returnValues(); - void varAssignment(); - void bindingsSpliceCorrectly(); - void nonValueTypeComparison(); - -private: - QDeclarativeEngine engine; -}; - -void tst_qdeclarativevaluetypes::initTestCase() -{ - QDeclarativeDataTest::initTestCase(); - registerTypes(); -} - -void tst_qdeclarativevaluetypes::point() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("point_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("p_x").toInt(), 10); - QCOMPARE(object->property("p_y").toInt(), 4); - QCOMPARE(object->property("copy"), QVariant(QPoint(10, 4))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("point_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->point(), QPoint(11, 12)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("point_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QPoint(10, 4)"); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), false); - QCOMPARE(object->property("equalsPoint").toBool(), true); - QCOMPARE(object->property("equalsRect").toBool(), false); - QCOMPARE(object->property("equalsSelf").toBool(), true); - QCOMPARE(object->property("equalsOther").toBool(), false); - QCOMPARE(object->property("pointEqualsPointf").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::pointf() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("pointf_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(float(object->property("p_x").toDouble()), float(11.3)); - QCOMPARE(float(object->property("p_y").toDouble()), float(-10.9)); - QCOMPARE(object->property("copy"), QVariant(QPointF(11.3, -10.9))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("pointf_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->pointf(), QPointF(6.8, 9.3)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("pointf_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QPointF(11.3, -10.9)"); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), false); - QCOMPARE(object->property("equalsPoint").toBool(), true); - QCOMPARE(object->property("equalsRect").toBool(), false); - QCOMPARE(object->property("equalsSelf").toBool(), true); - QCOMPARE(object->property("equalsOther").toBool(), false); - QCOMPARE(object->property("pointfEqualsPoint").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::size() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("size_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("s_width").toInt(), 1912); - QCOMPARE(object->property("s_height").toInt(), 1913); - QCOMPARE(object->property("copy"), QVariant(QSize(1912, 1913))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("size_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->size(), QSize(13, 88)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("size_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QSize(1912, 1913)"); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), true); - QCOMPARE(object->property("equalsPoint").toBool(), false); - QCOMPARE(object->property("equalsRect").toBool(), false); - QCOMPARE(object->property("equalsSelf").toBool(), true); - QCOMPARE(object->property("equalsOther").toBool(), false); - QCOMPARE(object->property("sizeEqualsSizef").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::sizef() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("sizef_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(float(object->property("s_width").toDouble()), float(0.1)); - QCOMPARE(float(object->property("s_height").toDouble()), float(100923.2)); - QCOMPARE(object->property("copy"), QVariant(QSizeF(0.1, 100923.2))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("sizef_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->sizef(), QSizeF(44.3, 92.8)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("sizef_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QSizeF(0.1, 100923)"); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), true); - QCOMPARE(object->property("equalsPoint").toBool(), false); - QCOMPARE(object->property("equalsRect").toBool(), false); - QCOMPARE(object->property("equalsSelf").toBool(), true); - QCOMPARE(object->property("equalsOther").toBool(), false); - QCOMPARE(object->property("sizefEqualsSize").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::variant() -{ - QDeclarativeComponent component(&engine, testFileUrl("variant_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(float(object->property("s_width").toDouble()), float(0.1)); - QCOMPARE(float(object->property("s_height").toDouble()), float(100923.2)); - QCOMPARE(object->property("copy"), QVariant(QSizeF(0.1, 100923.2))); - - delete object; -} - -void tst_qdeclarativevaluetypes::sizereadonly() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("s_width").toInt(), 1912); - QCOMPARE(object->property("s_height").toInt(), 1913); - QCOMPARE(object->property("copy"), QVariant(QSize(1912, 1913))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror.qml")); - QVERIFY(component.isError()); - QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property")); - } - - { - QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror2.qml")); - QVERIFY(component.isError()); - QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property")); - } - - { - QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror3.qml")); - QVERIFY(component.isError()); - QCOMPARE(component.errors().at(0).description(), QLatin1String("Invalid property assignment: \"sizereadonly\" is a read-only property")); - } - - { - QDeclarativeComponent component(&engine, testFileUrl("sizereadonly_writeerror4.qml")); - - QObject *object = component.create(); - QVERIFY(object); - - QCOMPARE(object->property("sizereadonly").toSize(), QSize(1912, 1913)); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::rect() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("rect_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("r_x").toInt(), 2); - QCOMPARE(object->property("r_y").toInt(), 3); - QCOMPARE(object->property("r_width").toInt(), 109); - QCOMPARE(object->property("r_height").toInt(), 102); - QCOMPARE(object->property("copy"), QVariant(QRect(2, 3, 109, 102))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("rect_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect(), QRect(1234, 7, 56, 63)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("rect_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QRect(2, 3, 109, 102)"); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), false); - QCOMPARE(object->property("equalsPoint").toBool(), false); - QCOMPARE(object->property("equalsRect").toBool(), true); - QCOMPARE(object->property("equalsSelf").toBool(), true); - QCOMPARE(object->property("equalsOther").toBool(), false); - QCOMPARE(object->property("rectEqualsRectf").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::rectf() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("rectf_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(float(object->property("r_x").toDouble()), float(103.8)); - QCOMPARE(float(object->property("r_y").toDouble()), float(99.2)); - QCOMPARE(float(object->property("r_width").toDouble()), float(88.1)); - QCOMPARE(float(object->property("r_height").toDouble()), float(77.6)); - QCOMPARE(object->property("copy"), QVariant(QRectF(103.8, 99.2, 88.1, 77.6))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("rectf_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rectf(), QRectF(70.1, -113.2, 80924.8, 99.2)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("rectf_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QRectF(103.8, 99.2, 88.1, 77.6)"); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), false); - QCOMPARE(object->property("equalsPoint").toBool(), false); - QCOMPARE(object->property("equalsRect").toBool(), true); - QCOMPARE(object->property("equalsSelf").toBool(), true); - QCOMPARE(object->property("equalsOther").toBool(), false); - QCOMPARE(object->property("rectfEqualsRect").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::vector2d() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("vector2d_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE((float)object->property("v_x").toDouble(), (float)32.88); - QCOMPARE((float)object->property("v_y").toDouble(), (float)1.3); - QCOMPARE(object->property("copy"), QVariant(QVector2D(32.88, 1.3))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("vector2d_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->vector2(), QVector2D(-0.3, -12.9)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("vector2d_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QVector2D(32.88, 1.3)"); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), false); - QCOMPARE(object->property("equalsPoint").toBool(), false); - QCOMPARE(object->property("equalsRect").toBool(), false); - QCOMPARE(object->property("equalsSelf").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::vector3d() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("vector3d_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE((float)object->property("v_x").toDouble(), (float)23.88); - QCOMPARE((float)object->property("v_y").toDouble(), (float)3.1); - QCOMPARE((float)object->property("v_z").toDouble(), (float)4.3); - QCOMPARE(object->property("copy"), QVariant(QVector3D(23.88, 3.1, 4.3))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("vector3d_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->vector(), QVector3D(-0.3, -12.9, 907.4)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("vector3d_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QVector3D(23.88, 3.1, 4.3)"); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), true); - QCOMPARE(object->property("equalsSize").toBool(), false); - QCOMPARE(object->property("equalsPoint").toBool(), false); - QCOMPARE(object->property("equalsRect").toBool(), false); - QCOMPARE(object->property("equalsSelf").toBool(), true); - QCOMPARE(object->property("equalsOther").toBool(), false); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::vector4d() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("vector4d_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE((float)object->property("v_x").toDouble(), (float)54.2); - QCOMPARE((float)object->property("v_y").toDouble(), (float)23.88); - QCOMPARE((float)object->property("v_z").toDouble(), (float)3.1); - QCOMPARE((float)object->property("v_w").toDouble(), (float)4.3); - QCOMPARE(object->property("copy"), QVariant(QVector4D(54.2, 23.88, 3.1, 4.3))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("vector4d_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->vector4(), QVector4D(-0.3, -12.9, 907.4, 88.5)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("vector4d_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QVector4D(54.2, 23.88, 3.1, 4.3)"); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), false); - QCOMPARE(object->property("equalsPoint").toBool(), false); - QCOMPARE(object->property("equalsRect").toBool(), false); - QCOMPARE(object->property("equalsSelf").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::quaternion() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("quaternion_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE((float)object->property("v_scalar").toDouble(), (float)4.3); - QCOMPARE((float)object->property("v_x").toDouble(), (float)54.2); - QCOMPARE((float)object->property("v_y").toDouble(), (float)23.88); - QCOMPARE((float)object->property("v_z").toDouble(), (float)3.1); - QCOMPARE(object->property("copy"), QVariant(QQuaternion(4.3, 54.2, 23.88, 3.1))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("quaternion_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->quaternion(), QQuaternion(88.5, -0.3, -12.9, 907.4)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("quaternion_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QQuaternion(4.3, 54.2, 23.88, 3.1)"); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), false); - QCOMPARE(object->property("equalsPoint").toBool(), false); - QCOMPARE(object->property("equalsRect").toBool(), false); - QCOMPARE(object->property("equalsSelf").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::matrix4x4() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("matrix4x4_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE((float)object->property("v_m11").toDouble(), (float)1); - QCOMPARE((float)object->property("v_m12").toDouble(), (float)2); - QCOMPARE((float)object->property("v_m13").toDouble(), (float)3); - QCOMPARE((float)object->property("v_m14").toDouble(), (float)4); - QCOMPARE((float)object->property("v_m21").toDouble(), (float)5); - QCOMPARE((float)object->property("v_m22").toDouble(), (float)6); - QCOMPARE((float)object->property("v_m23").toDouble(), (float)7); - QCOMPARE((float)object->property("v_m24").toDouble(), (float)8); - QCOMPARE((float)object->property("v_m31").toDouble(), (float)9); - QCOMPARE((float)object->property("v_m32").toDouble(), (float)10); - QCOMPARE((float)object->property("v_m33").toDouble(), (float)11); - QCOMPARE((float)object->property("v_m34").toDouble(), (float)12); - QCOMPARE((float)object->property("v_m41").toDouble(), (float)13); - QCOMPARE((float)object->property("v_m42").toDouble(), (float)14); - QCOMPARE((float)object->property("v_m43").toDouble(), (float)15); - QCOMPARE((float)object->property("v_m44").toDouble(), (float)16); - QCOMPARE(object->property("copy"), - QVariant(QMatrix4x4(1, 2, 3, 4, - 5, 6, 7, 8, - 9, 10, 11, 12, - 13, 14, 15, 16))); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("matrix4x4_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->matrix(), QMatrix4x4(11, 12, 13, 14, - 21, 22, 23, 24, - 31, 32, 33, 34, - 41, 42, 43, 44)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("matrix4x4_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)"); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), false); - QCOMPARE(object->property("equalsPoint").toBool(), false); - QCOMPARE(object->property("equalsRect").toBool(), false); - QCOMPARE(object->property("equalsSelf").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::font() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("font_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("f_family").toString(), object->font().family()); - QCOMPARE(object->property("f_bold").toBool(), object->font().bold()); - QCOMPARE(object->property("f_weight").toInt(), object->font().weight()); - QCOMPARE(object->property("f_italic").toBool(), object->font().italic()); - QCOMPARE(object->property("f_underline").toBool(), object->font().underline()); - QCOMPARE(object->property("f_overline").toBool(), object->font().overline()); - QCOMPARE(object->property("f_strikeout").toBool(), object->font().strikeOut()); - QCOMPARE(object->property("f_pointSize").toDouble(), object->font().pointSizeF()); - QCOMPARE(object->property("f_pixelSize").toInt(), int((object->font().pointSizeF() * qt_defaultDpi()) / qreal(72.))); - QCOMPARE(object->property("f_capitalization").toInt(), (int)object->font().capitalization()); - QCOMPARE(object->property("f_letterSpacing").toDouble(), object->font().letterSpacing()); - QCOMPARE(object->property("f_wordSpacing").toDouble(), object->font().wordSpacing()); - - QCOMPARE(object->property("copy"), QVariant(object->font())); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("font_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QFont font; - font.setFamily("Helvetica"); - font.setBold(false); - font.setWeight(QFont::Normal); - font.setItalic(false); - font.setUnderline(false); - font.setStrikeOut(false); - font.setPointSize(15); - font.setCapitalization(QFont::AllLowercase); - font.setLetterSpacing(QFont::AbsoluteSpacing, 9.7); - font.setWordSpacing(11.2); - - QFont f = object->font(); - QCOMPARE(f.family(), font.family()); - QCOMPARE(f.bold(), font.bold()); - QCOMPARE(f.weight(), font.weight()); - QCOMPARE(f.italic(), font.italic()); - QCOMPARE(f.underline(), font.underline()); - QCOMPARE(f.strikeOut(), font.strikeOut()); - QCOMPARE(f.pointSize(), font.pointSize()); - QCOMPARE(f.capitalization(), font.capitalization()); - QCOMPARE(f.letterSpacing(), font.letterSpacing()); - QCOMPARE(f.wordSpacing(), font.wordSpacing()); - - delete object; - } - - // Test pixelSize - { - QDeclarativeComponent component(&engine, testFileUrl("font_write.2.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->font().pixelSize(), 10); - - delete object; - } - - // Test pixelSize and pointSize - { - QDeclarativeComponent component(&engine, testFileUrl("font_write.3.qml")); - QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. "); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->font().pixelSize(), 10); - - delete object; - } - { - QDeclarativeComponent component(&engine, testFileUrl("font_write.4.qml")); - QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. "); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->font().pixelSize(), 10); - - delete object; - } - { - QDeclarativeComponent component(&engine, testFileUrl("font_write.5.qml")); - QObject *object = qobject_cast<QObject *>(component.create()); - QVERIFY(object != 0); - MyTypeObject *object1 = object->findChild<MyTypeObject *>("object1"); - QVERIFY(object1 != 0); - MyTypeObject *object2 = object->findChild<MyTypeObject *>("object2"); - QVERIFY(object2 != 0); - - QCOMPARE(object1->font().pixelSize(), 19); - QCOMPARE(object2->font().pointSize(), 14); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("font_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QString tostring = QLatin1String("QFont(") + object->font().toString() + QLatin1Char(')'); - QCOMPARE(object->property("tostring").toString(), tostring); - QCOMPARE(object->property("equalsString").toBool(), true); - QCOMPARE(object->property("equalsColor").toBool(), false); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), false); - QCOMPARE(object->property("equalsPoint").toBool(), false); - QCOMPARE(object->property("equalsRect").toBool(), false); - QCOMPARE(object->property("equalsSelf").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::color() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("color_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE((float)object->property("v_r").toDouble(), (float)0.2); - QCOMPARE((float)object->property("v_g").toDouble(), (float)0.88); - QCOMPARE((float)object->property("v_b").toDouble(), (float)0.6); - QCOMPARE((float)object->property("v_a").toDouble(), (float)0.34); - QColor comparison; - comparison.setRedF(0.2); - comparison.setGreenF(0.88); - comparison.setBlueF(0.6); - comparison.setAlphaF(0.34); - QCOMPARE(object->property("copy"), QVariant(comparison)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("color_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QColor newColor; - newColor.setRedF(0.5); - newColor.setGreenF(0.38); - newColor.setBlueF(0.3); - newColor.setAlphaF(0.7); - QCOMPARE(object->color(), newColor); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("color_compare.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QString colorString("#33e199"); - QCOMPARE(object->property("colorToString").toString(), colorString); - QCOMPARE(object->property("colorEqualsIdenticalRgba").toBool(), true); - QCOMPARE(object->property("colorEqualsDifferentAlpha").toBool(), false); - QCOMPARE(object->property("colorEqualsDifferentRgba").toBool(), false); - QCOMPARE(object->property("colorToStringEqualsColorString").toBool(), true); - QCOMPARE(object->property("colorToStringEqualsDifferentAlphaString").toBool(), true); - QCOMPARE(object->property("colorToStringEqualsDifferentRgbaString").toBool(), false); - QCOMPARE(object->property("colorEqualsColorString").toBool(), true); // maintaining behaviour with QtQuick 1.0 - QCOMPARE(object->property("colorEqualsDifferentAlphaString").toBool(), true); // maintaining behaviour with QtQuick 1.0 - QCOMPARE(object->property("colorEqualsDifferentRgbaString").toBool(), false); - - QCOMPARE(object->property("equalsColor").toBool(), true); - QCOMPARE(object->property("equalsVector3d").toBool(), false); - QCOMPARE(object->property("equalsSize").toBool(), false); - QCOMPARE(object->property("equalsPoint").toBool(), false); - QCOMPARE(object->property("equalsRect").toBool(), false); - - // Color == Property and Property == Color should return the same result. - QCOMPARE(object->property("equalsColorRHS").toBool(), object->property("equalsColor").toBool()); - QCOMPARE(object->property("colorEqualsCopy").toBool(), true); - QCOMPARE(object->property("copyEqualsColor").toBool(), object->property("colorEqualsCopy").toBool()); - - delete object; - } -} - -// Test bindings can write to value types -void tst_qdeclarativevaluetypes::bindingAssignment() -{ - QDeclarativeComponent component(&engine, testFileUrl("bindingAssignment.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect().x(), 10); - - object->setProperty("value", QVariant(92)); - - QCOMPARE(object->rect().x(), 92); - - delete object; -} - -// Test bindings can read from value types -void tst_qdeclarativevaluetypes::bindingRead() -{ - QDeclarativeComponent component(&engine, testFileUrl("bindingRead.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("value").toInt(), 2); - - object->setRect(QRect(19, 3, 88, 2)); - - QCOMPARE(object->property("value").toInt(), 19); - - delete object; -} - -// Test static values can assign to value types -void tst_qdeclarativevaluetypes::staticAssignment() -{ - QDeclarativeComponent component(&engine, testFileUrl("staticAssignment.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect().x(), 9); - - delete object; -} - -// Test scripts can read/write value types -void tst_qdeclarativevaluetypes::scriptAccess() -{ - QDeclarativeComponent component(&engine, testFileUrl("scriptAccess.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("valuePre").toInt(), 2); - QCOMPARE(object->rect().x(), 19); - QCOMPARE(object->property("valuePost").toInt(), 19); - - delete object; -} - -// Test that assigning a constant from script removes any binding -void tst_qdeclarativevaluetypes::autoBindingRemoval() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("autoBindingRemoval.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect().x(), 10); - - object->setProperty("value", QVariant(13)); - - QCOMPARE(object->rect().x(), 13); - - object->emitRunScript(); - - QCOMPARE(object->rect().x(), 42); - - object->setProperty("value", QVariant(92)); - - QCOMPARE(object->rect().x(), 42); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("autoBindingRemoval.2.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect().x(), 10); - - object->setProperty("value", QVariant(13)); - - QCOMPARE(object->rect().x(), 13); - - object->emitRunScript(); - - QCOMPARE(object->rect(), QRect(10, 10, 10, 10)); - - object->setProperty("value", QVariant(92)); - - QCOMPARE(object->rect(), QRect(10, 10, 10, 10)); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("autoBindingRemoval.3.qml")); - QString warning = component.url().toString() + ":6: Unable to assign [undefined] to QRect"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - object->setProperty("value", QVariant(QRect(9, 22, 33, 44))); - - QCOMPARE(object->rect(), QRect(9, 22, 33, 44)); - - object->emitRunScript(); - - QCOMPARE(object->rect(), QRect(44, 22, 33, 44)); - - object->setProperty("value", QVariant(QRect(19, 3, 4, 8))); - - QCOMPARE(object->rect(), QRect(44, 22, 33, 44)); - - delete object; - } -} - -// Test that property value sources assign to value types -void tst_qdeclarativevaluetypes::valueSources() -{ - QDeclarativeComponent component(&engine, testFileUrl("valueSources.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect().x(), 3345); - - delete object; -} - -static void checkNoErrors(QDeclarativeComponent& component) -{ - QList<QDeclarativeError> errors = component.errors(); - if (errors.isEmpty()) - return; - for (int ii = 0; ii < errors.count(); ++ii) { - const QDeclarativeError &error = errors.at(ii); - qWarning("%d:%d:%s",error.line(),error.column(),error.description().toUtf8().constData()); - } -} - -// Test that property value interceptors can be applied to value types -void tst_qdeclarativevaluetypes::valueInterceptors() -{ - QDeclarativeComponent component(&engine, testFileUrl("valueInterceptors.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - checkNoErrors(component); - QVERIFY(object != 0); - - QCOMPARE(object->rect().x(), 13); - - object->setProperty("value", 99); - - QCOMPARE(object->rect().x(), 112); - - delete object; -} - -// Test that you can't assign a binding to the "root" value type, and a sub-property -void tst_qdeclarativevaluetypes::bindingConflict() -{ - QDeclarativeComponent component(&engine, testFileUrl("bindingConflict.qml")); - QCOMPARE(component.isError(), true); -} - -#define CPP_TEST(type, v) \ -{ \ - type *t = new type; \ - QVariant value(v); \ - t->setValue(value); \ - QCOMPARE(t->value(), value); \ - delete t; \ -} - -// Test that accessing a reference to a valuetype after the owning object is deleted -// doesn't crash -void tst_qdeclarativevaluetypes::deletedObject() -{ - QDeclarativeComponent component(&engine, testFileUrl("deletedObject.qml")); - QTest::ignoreMessage(QtDebugMsg, "Test: 2"); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QObject *dObject = qvariant_cast<QObject *>(object->property("object")); - QVERIFY(dObject != 0); - delete dObject; - - QTest::ignoreMessage(QtDebugMsg, "Test: undefined"); - object->emitRunScript(); - - delete object; -} - -// Test that value types can be assigned to another value type property in a binding -void tst_qdeclarativevaluetypes::bindingVariantCopy() -{ - QDeclarativeComponent component(&engine, testFileUrl("bindingVariantCopy.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect(), QRect(19, 33, 5, 99)); - - delete object; -} - -// Test that value types can be assigned to another value type property in script -void tst_qdeclarativevaluetypes::scriptVariantCopy() -{ - QDeclarativeComponent component(&engine, testFileUrl("scriptVariantCopy.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect(), QRect(2, 3, 109, 102)); - - object->emitRunScript(); - - QCOMPARE(object->rect(), QRect(19, 33, 5, 99)); - - delete object; -} - - -// Test that the value type classes can be used manually -void tst_qdeclarativevaluetypes::cppClasses() -{ - CPP_TEST(QDeclarativePointValueType, QPoint(19, 33)); - CPP_TEST(QDeclarativePointFValueType, QPointF(33.6, -23)); - CPP_TEST(QDeclarativeSizeValueType, QSize(-100, 18)); - CPP_TEST(QDeclarativeSizeFValueType, QSizeF(-100.7, 18.2)); - CPP_TEST(QDeclarativeRectValueType, QRect(13, 39, 10928, 88)); - CPP_TEST(QDeclarativeRectFValueType, QRectF(88.2, -90.1, 103.2, 118)); - CPP_TEST(QDeclarativeVector2DValueType, QVector2D(19.7, 1002)); - CPP_TEST(QDeclarativeVector3DValueType, QVector3D(18.2, 19.7, 1002)); - CPP_TEST(QDeclarativeVector4DValueType, QVector4D(18.2, 19.7, 1002, 54)); - CPP_TEST(QDeclarativeQuaternionValueType, QQuaternion(18.2, 19.7, 1002, 54)); - CPP_TEST(QDeclarativeMatrix4x4ValueType, - QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)); - CPP_TEST(QDeclarativeFontValueType, QFont("Helvetica")); - -} - -void tst_qdeclarativevaluetypes::enums() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("enums.1.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->font().capitalization() == QFont::AllUppercase); - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("enums.2.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->font().capitalization() == QFont::AllUppercase); - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("enums.3.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->font().capitalization() == QFont::AllUppercase); - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("enums.4.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->font().capitalization() == QFont::AllUppercase); - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("enums.5.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->font().capitalization() == QFont::AllUppercase); - delete object; - } -} - -// Tests switching between "conflicting" bindings (eg. a binding on the core -// property, to a binding on the value-type sub-property) -void tst_qdeclarativevaluetypes::conflictingBindings() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("conflicting.1.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); - - QMetaObject::invokeMethod(object, "toggle"); - - QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 6); - - QMetaObject::invokeMethod(object, "toggle"); - - QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("conflicting.2.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 6); - - QMetaObject::invokeMethod(object, "toggle"); - - QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); - - QMetaObject::invokeMethod(object, "toggle"); - - QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 6); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("conflicting.3.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); - - QMetaObject::invokeMethod(object, "toggle"); - - QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 24); - - QMetaObject::invokeMethod(object, "toggle"); - - QCOMPARE(qvariant_cast<QFont>(object->property("font")).pixelSize(), 12); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::returnValues() -{ - QDeclarativeComponent component(&engine, testFileUrl("returnValues.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toBool(), true); - QCOMPARE(object->property("test2").toBool(), true); - QCOMPARE(object->property("size").toSize(), QSize(13, 14)); - - delete object; -} - -void tst_qdeclarativevaluetypes::varAssignment() -{ - QDeclarativeComponent component(&engine, testFileUrl("varAssignment.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("x").toInt(), 1); - QCOMPARE(object->property("y").toInt(), 2); - QCOMPARE(object->property("z").toInt(), 3); - - delete object; -} - -// Test bindings splice together correctly -void tst_qdeclarativevaluetypes::bindingsSpliceCorrectly() -{ - { - QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.1.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.2.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - - delete object; - } - - - { - QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.3.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.4.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - - delete object; - } - - { - QDeclarativeComponent component(&engine, testFileUrl("bindingsSpliceCorrectly.5.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - - delete object; - } -} - -void tst_qdeclarativevaluetypes::nonValueTypeComparison() -{ - QDeclarativeComponent component(&engine, testFileUrl("nonValueTypeComparison.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toBool(), true); - QCOMPARE(object->property("test2").toBool(), true); - - delete object; -} - -QTEST_MAIN(tst_qdeclarativevaluetypes) - -#include "tst_qdeclarativevaluetypes.moc" |