summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/testtypes.h7
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp5
3 files changed, 12 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml
index b46ec34..aecb3c3 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml
@@ -3,6 +3,8 @@ import Test 1.0 as Namespace
import Qt 4.6
QtObject {
+ property int value2: 8
MyQmlObject.value: 10
Namespace.MyQmlObject.value2: 13
+ MyQmlObject.onValueChanged: value2 = MyQmlObject.value
}
diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
index ec2c5f7..08d6d96 100644
--- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h
+++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
@@ -75,17 +75,20 @@ Q_DECLARE_METATYPE(MyCustomVariantType);
class MyAttachedObject : public QObject
{
Q_OBJECT
- Q_PROPERTY(int value READ value WRITE setValue)
+ Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged)
Q_PROPERTY(int value2 READ value2 WRITE setValue2)
public:
MyAttachedObject(QObject *parent) : QObject(parent), m_value(0), m_value2(0) {}
int value() const { return m_value; }
- void setValue(int v) { m_value = v; }
+ void setValue(int v) { if (m_value != v) { m_value = v; emit valueChanged(); } }
int value2() const { return m_value2; }
void setValue2(int v) { m_value2 = v; }
+signals:
+ void valueChanged();
+
private:
int m_value;
int m_value2;
diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
index 39f5223..870f3fe 100644
--- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp
@@ -713,6 +713,11 @@ void tst_qdeclarativelanguage::attachedProperties()
QVERIFY(attached != 0);
QCOMPARE(attached->property("value"), QVariant(10));
QCOMPARE(attached->property("value2"), QVariant(13));
+
+ QEXPECT_FAIL("", "QTBUG-8677", Abort);
+ attached->setProperty("value", QVariant(12));
+ int val = object->property("value2").toInt();
+ QCOMPARE(val, 12);
}
// Tests non-static object properties