aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qsgvisualdatamodel
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-08-02 15:19:06 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-05 04:56:52 +0200
commitbbe72dadd3ab73a2a3a7dabfb9db3e99b36a272a (patch)
tree4df5c242fd4fbb23056c30e14717a01beed91eee /tests/auto/declarative/qsgvisualdatamodel
parentaa54e27adeff3c7e6f59e2d68e9f006e60e542dc (diff)
Don't cache model data in VisualDataModel.
VisualDataModel doesn't have any way to monitor the lifetime of objects cached other than relying on the source model to emit a changed signal. If the model doesn't do this or a pointer property is referenced after an item has been removed from the model then cache can return a stale pointer. This can be avoided by querying the model directly whenever a property is accessed. Task-number: QTBUG-18036 Change-Id: I7688174c2337cb5c0f77eb7d31a01f4aa958071b Reviewed-on: http://codereview.qt.nokia.com/2647 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qsgvisualdatamodel')
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/data/modelproperties.qml2
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/data/modelproperties2.qml2
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/data/objectlist.qml2
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/data/singlerole1.qml2
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/data/singlerole2.qml2
-rw-r--r--tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp1
6 files changed, 7 insertions, 4 deletions
diff --git a/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties.qml b/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties.qml
index 6d86cdea2e..73b766f1af 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties.qml
+++ b/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties.qml
@@ -6,6 +6,8 @@ ListView {
model: myModel
delegate: Item {
objectName: "delegate"
+ width: 100
+ height: 2
property variant test1: name
property variant test2: model.name
property variant test3: modelData
diff --git a/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties2.qml b/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties2.qml
index 6a92431cdf..ea5c240b29 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties2.qml
+++ b/tests/auto/declarative/qsgvisualdatamodel/data/modelproperties2.qml
@@ -15,5 +15,7 @@ ListView {
property variant test7: index
property variant test8: model.index
property variant test9: model.modelData.display
+ width: 100
+ height: 2
}
}
diff --git a/tests/auto/declarative/qsgvisualdatamodel/data/objectlist.qml b/tests/auto/declarative/qsgvisualdatamodel/data/objectlist.qml
index 9086e5ab57..b3952a8a4d 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/data/objectlist.qml
+++ b/tests/auto/declarative/qsgvisualdatamodel/data/objectlist.qml
@@ -10,7 +10,7 @@ ListView {
height: 25
width: 100
color: model.modelData.color
- Text { objectName: "name"; text: name }
+ Text { objectName: "name"; text: name; function getText() { return name } }
Text { objectName: "section"; text: parent.ListView.section }
}
}
diff --git a/tests/auto/declarative/qsgvisualdatamodel/data/singlerole1.qml b/tests/auto/declarative/qsgvisualdatamodel/data/singlerole1.qml
index d5b0fcf09b..c471893e1d 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/data/singlerole1.qml
+++ b/tests/auto/declarative/qsgvisualdatamodel/data/singlerole1.qml
@@ -5,6 +5,6 @@ ListView {
height: 100
model: myModel
delegate: Component {
- Text { objectName: "name"; text: name }
+ Text { objectName: "name"; text: name; function getText() { return name; } }
}
}
diff --git a/tests/auto/declarative/qsgvisualdatamodel/data/singlerole2.qml b/tests/auto/declarative/qsgvisualdatamodel/data/singlerole2.qml
index c6d3413dfd..ab1798999d 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/data/singlerole2.qml
+++ b/tests/auto/declarative/qsgvisualdatamodel/data/singlerole2.qml
@@ -5,6 +5,6 @@ ListView {
height: 100
model: myModel
delegate: Component {
- Text { objectName: "name"; text: modelData }
+ Text { objectName: "name"; text: modelData; function getText() { return modelData } }
}
}
diff --git a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
index e56fcb062e..7470153933 100644
--- a/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
+++ b/tests/auto/declarative/qsgvisualdatamodel/tst_qsgvisualdatamodel.cpp
@@ -460,7 +460,6 @@ void tst_qsgvisualdatamodel::modelProperties()
QSGItem *delegate = findItem<QSGItem>(contentItem, "delegate", 1);
QVERIFY(delegate);
QCOMPARE(delegate->property("test1").toString(),QString("Item 2"));
- QEXPECT_FAIL("", "QTBUG-13576", Continue);
QCOMPARE(delegate->property("test2").toString(),QString("Item 2"));
QVERIFY(qobject_cast<DataObject*>(delegate->property("test3").value<QObject*>()) != 0);
QVERIFY(qobject_cast<DataObject*>(delegate->property("test4").value<QObject*>()) != 0);