summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-11-06 02:44:19 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-11-06 02:44:19 (GMT)
commit8e94e7d95f7fbc142a1a5faf3347aa165ff2426e (patch)
treefec7142714ee52afcb19e41fc1d66d787e6d4c09 /tests
parentbce122040d2df5ae650e6de17d41568f1ba7c184 (diff)
downloadQt-8e94e7d95f7fbc142a1a5faf3347aa165ff2426e.zip
Qt-8e94e7d95f7fbc142a1a5faf3347aa165ff2426e.tar.gz
Qt-8e94e7d95f7fbc142a1a5faf3347aa165ff2426e.tar.bz2
Update valuetype tests
Add a new test, and make the old variantCopy pass
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/valuetypes/data/bindingVariantCopy.qml (renamed from tests/auto/declarative/valuetypes/data/variantCopy.qml)0
-rw-r--r--tests/auto/declarative/valuetypes/data/scriptVariantCopy.qml14
-rw-r--r--tests/auto/declarative/valuetypes/tst_valuetypes.cpp26
3 files changed, 36 insertions, 4 deletions
diff --git a/tests/auto/declarative/valuetypes/data/variantCopy.qml b/tests/auto/declarative/valuetypes/data/bindingVariantCopy.qml
index 691a56c..691a56c 100644
--- a/tests/auto/declarative/valuetypes/data/variantCopy.qml
+++ b/tests/auto/declarative/valuetypes/data/bindingVariantCopy.qml
diff --git a/tests/auto/declarative/valuetypes/data/scriptVariantCopy.qml b/tests/auto/declarative/valuetypes/data/scriptVariantCopy.qml
new file mode 100644
index 0000000..29157e8
--- /dev/null
+++ b/tests/auto/declarative/valuetypes/data/scriptVariantCopy.qml
@@ -0,0 +1,14 @@
+import Test 1.0
+
+MyTypeObject {
+ property var 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/valuetypes/tst_valuetypes.cpp b/tests/auto/declarative/valuetypes/tst_valuetypes.cpp
index 9821a01..d42bfc5 100644
--- a/tests/auto/declarative/valuetypes/tst_valuetypes.cpp
+++ b/tests/auto/declarative/valuetypes/tst_valuetypes.cpp
@@ -71,7 +71,8 @@ private slots:
void valueInterceptors();
void bindingConflict();
void deletedObject();
- void variantCopy();
+ void bindingVariantCopy();
+ void scriptVariantCopy();
void cppClasses();
private:
@@ -524,10 +525,10 @@ void tst_valuetypes::deletedObject()
delete object;
}
-// Test that value types can be assigned to another value type property
-void tst_valuetypes::variantCopy()
+// Test that value types can be assigned to another value type property in a binding
+void tst_valuetypes::bindingVariantCopy()
{
- QmlComponent component(&engine, TEST_FILE("variantCopy.qml"));
+ QmlComponent component(&engine, TEST_FILE("bindingVariantCopy.qml"));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);
@@ -536,6 +537,23 @@ void tst_valuetypes::variantCopy()
delete object;
}
+// Test that value types can be assigned to another value type property in script
+void tst_valuetypes::scriptVariantCopy()
+{
+ QmlComponent component(&engine, TEST_FILE("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_valuetypes::cppClasses()
{