Skip to content

Commit

Permalink
test: reproduce dataChanged bug
Browse files Browse the repository at this point in the history
  • Loading branch information
oKcerG committed May 6, 2019
1 parent 4d96016 commit 26501aa
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/tst_proxyroles.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit 26501aa

Please sign in to comment.