commit 6e3b431c0d01a510523cea4119f014592d8ccc6d
Author: Joona Petrell <joona.t.petrell@nokia.com>
Date:   Tue Feb 2 14:26:32 2010 +1000

    Added unit tests for checking that you can override default properties defined in extension object.

diff --git a/tests/auto/declarative/qmlecmascript/data/extensionObjectsPropertyOverride.qml b/tests/auto/declarative/qmlecmascript/data/extensionObjectsPropertyOverride.qml
new file mode 100644
index 0000000..3c443cb
--- /dev/null
+++ b/tests/auto/declarative/qmlecmascript/data/extensionObjectsPropertyOverride.qml
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+
+OverrideDefaultPropertyObject
+{
+    MyBaseExtendedObject {
+    }
+}
diff --git a/tests/auto/declarative/qmlecmascript/testtypes.cpp b/tests/auto/declarative/qmlecmascript/testtypes.cpp
index df0cb18..88e9d86 100644
--- a/tests/auto/declarative/qmlecmascript/testtypes.cpp
+++ b/tests/auto/declarative/qmlecmascript/testtypes.cpp
@@ -49,7 +49,6 @@ public:
 
     int extendedProperty() const { return m_value; }
     void setExtendedProperty(int v) { m_value = v; emit extendedPropertyChanged(); }
-
 signals:
     void extendedPropertyChanged();
 private:
@@ -72,6 +71,14 @@ private:
     int m_value;
 };
 
+class DefaultPropertyExtensionObject : public QObject
+{
+    Q_OBJECT
+    Q_CLASSINFO("DefaultProperty", "firstProperty")
+public:
+    DefaultPropertyExtensionObject(QObject *parent) : QObject(parent) {}
+};
+
 QML_DEFINE_TYPE(Qt.test, 1,0, MyQmlObject,MyQmlObject);
 QML_DEFINE_TYPE(Qt.test, 1,0, MyDeferredObject,MyDeferredObject);
 QML_DEFINE_TYPE(Qt.test, 1,0, MyQmlContainer,MyQmlContainer);
@@ -79,4 +86,7 @@ QML_DEFINE_EXTENDED_TYPE(Qt.test, 1,0, MyBaseExtendedObject,MyBaseExtendedObject
 QML_DEFINE_EXTENDED_TYPE(Qt.test, 1,0, MyExtendedObject,MyExtendedObject,ExtensionObject);
 QML_DEFINE_TYPE(Qt.test, 1,0, MyTypeObject, MyTypeObject);
 
+QML_DEFINE_EXTENDED_TYPE(Qt.test, 1,0, DefaultPropertyExtendedObject,DefaultPropertyExtendedObject,DefaultPropertyExtensionObject);
+QML_DEFINE_TYPE(Qt.test, 1,0, OverrideDefaultPropertyObject, OverrideDefaultPropertyObject);
+
 #include "testtypes.moc"
diff --git a/tests/auto/declarative/qmlecmascript/testtypes.h b/tests/auto/declarative/qmlecmascript/testtypes.h
index 09c850d..3df397b 100644
--- a/tests/auto/declarative/qmlecmascript/testtypes.h
+++ b/tests/auto/declarative/qmlecmascript/testtypes.h
@@ -281,6 +281,33 @@ private:
 };
 QML_DECLARE_TYPE(MyExtendedObject);
 
+class DefaultPropertyExtendedObject : public QObject
+{
+    Q_OBJECT
+    Q_PROPERTY(QObject *firstProperty READ firstProperty WRITE setFirstProperty)
+    Q_PROPERTY(QObject *secondProperty READ secondProperty WRITE setSecondProperty)
+public:
+    DefaultPropertyExtendedObject(QObject *parent = 0) : QObject(parent), m_firstProperty(0), m_secondProperty(0) {}
+
+    QObject *firstProperty() const { return m_firstProperty; }
+    QObject *secondProperty() const { return m_secondProperty; }
+    void setFirstProperty(QObject *property) { m_firstProperty = property; }
+    void setSecondProperty(QObject *property) { m_secondProperty = property; }
+private:
+    QObject* m_firstProperty;
+    QObject* m_secondProperty;
+};
+QML_DECLARE_TYPE(DefaultPropertyExtendedObject);
+
+class OverrideDefaultPropertyObject : public DefaultPropertyExtendedObject
+{
+    Q_OBJECT
+    Q_CLASSINFO("DefaultProperty", "secondProperty")
+public:
+    OverrideDefaultPropertyObject() {}
+};
+QML_DECLARE_TYPE(OverrideDefaultPropertyObject);
+
 class MyTypeObject : public QObject
 {
     Q_OBJECT
diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
index c41e248..e09cd7f 100644
--- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
+++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp
@@ -89,6 +89,7 @@ private slots:
     void objectPropertiesTriggerReeval();
     void deferredProperties();
     void extensionObjects();
+    void overrideExtensionProperties();
     void attachedProperties();
     void enums();
     void valueTypeFunctions();
@@ -538,6 +539,16 @@ void tst_qmlecmascript::extensionObjects()
     QCOMPARE(object->baseProperty(), 92);
 }
 
+void tst_qmlecmascript::overrideExtensionProperties()
+{
+    QmlComponent component(&engine, TEST_FILE("extensionObjectsPropertyOverride.qml"));
+    OverrideDefaultPropertyObject *object =
+        qobject_cast<OverrideDefaultPropertyObject *>(component.create());
+    QVERIFY(object != 0);
+    QVERIFY(object->secondProperty() != 0);
+    QVERIFY(object->firstProperty() == 0);
+}
+
 void tst_qmlecmascript::attachedProperties()
 {
     QmlComponent component(&engine, TEST_FILE("attachedProperty.qml"));
