diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2011-01-17 07:22:32 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2011-01-17 07:22:32 (GMT) |
commit | af810e444ee73b112623128a3637b28b81f3f2fb (patch) | |
tree | 6bcf379115845f3bc6bd0fde6a2c74ffa320f92b /tests | |
parent | 4631d297781b8ad4eba0735b7023265d4872c1cb (diff) | |
parent | a3b7438be516c44a5d1ebba91445164f0b64dd37 (diff) | |
download | Qt-af810e444ee73b112623128a3637b28b81f3f2fb.zip Qt-af810e444ee73b112623128a3637b28b81f3f2fb.tar.gz Qt-af810e444ee73b112623128a3637b28b81f3f2fb.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
Autotest for QVariant value types
Fix memory leak
Clarify Component.createObject(null) behavior.
Diffstat (limited to 'tests')
3 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/variant_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/variant_read.qml new file mode 100644 index 0000000..a08f3db --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/variant_read.qml @@ -0,0 +1,9 @@ +import Test 1.0 + +MyTypeObject { + property real s_width: variant.width + property real s_height: variant.height + property variant copy: variant +} + + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h index 86cbaa5..104d22f 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h @@ -76,6 +76,7 @@ class MyTypeObject : public QObject 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(QVariant variant READ variant NOTIFY changed) public: MyTypeObject() : @@ -152,6 +153,8 @@ public: QFont font() const { return m_font; } void setFont(const QFont &v) { m_font = v; emit changed(); } + QVariant variant() const { return sizef(); } + void emitRunScript() { emit runScript(); } signals: diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index a5cf051..ce857a0 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -77,6 +77,7 @@ private slots: void quaternion(); void matrix4x4(); void font(); + void variant(); void bindingAssignment(); void bindingRead(); @@ -210,6 +211,19 @@ void tst_qdeclarativevaluetypes::sizef() } } +void tst_qdeclarativevaluetypes::variant() +{ + QDeclarativeComponent component(&engine, TEST_FILE("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() { { |