test: reproduce dataChanged bug

#60
This commit is contained in:
grecko 2019-05-06 02:18:07 +02:00
parent 4d96016151
commit 26501aa078
1 changed files with 33 additions and 0 deletions

View File

@ -55,6 +55,32 @@ Item {
}
}
ListModel {
id: singleRowModel
ListElement {
changingRole: "Change me"
otherRole: "I don't change"
}
}
SortFilterProxyModel {
id: noProxyRolesProxyModel
sourceModel: singleRowModel
}
Instantiator {
id: outerInstantiator
model: noProxyRolesProxyModel
QtObject {
property var counter: ({ count : 0 })
property string changingRole: model.changingRole
property string otherRole: {
++counter.count;
return model.otherRole;
}
}
}
TestCase {
name: "ProxyRoles"
@ -89,5 +115,12 @@ Item {
compare(testModel.get(0, "role1"), "data for role1");
compare(testModel.get(0, "role2"), "data for role2");
}
function test_ProxyRolesDataChanged() {
outerInstantiator.object.counter.count = 0;
singleRowModel.setProperty(0, "changingRole", "Changed")
compare(outerInstantiator.object.changingRole, "Changed");
compare(outerInstantiator.object.counter.count, 0);
}
}
}