Skip to content

Commit 6211989

Browse files
committed
test: Simplify IndexFilter tests
1 parent 1821845 commit 6211989

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

tests/tst_indexfilter.qml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,73 +7,62 @@ Item {
77
property list<IndexFilter> filters: [
88
IndexFilter {
99
property string tag: "basicUsage"
10-
property int expectedModelCount: 3
11-
property var expectedValues: [3, 1, 2];
10+
property var expectedValues: [3, 1, 2]
1211
minimumIndex: 1; maximumIndex: 3
1312
},
1413
IndexFilter {
1514
property string tag: "outOfBounds"
16-
property int expectedModelCount: 0
15+
property var expectedValues: []
1716
minimumIndex: 3; maximumIndex: 1
1817
},
1918
IndexFilter {
2019
property string tag: "0to0Inverted"
21-
property int expectedModelCount: 4
2220
property var expectedValues: [3,1,2,4]
2321
minimumIndex: 0; maximumIndex: 0; inverted: true
2422
},
2523
IndexFilter {
2624
property string tag: "0to0" // bug / issue #15
27-
property int expectedModelCount: 1
2825
property var expectedValues: [5]
2926
minimumIndex: 0; maximumIndex: 0
3027
},
3128
IndexFilter {
3229
property string tag: "basicUsageInverted"
33-
property int expectedModelCount: 2
3430
property var expectedValues: [5,4]
3531
minimumIndex: 1; maximumIndex: 3; inverted: true
3632
},
3733
IndexFilter {
3834
property string tag: "last"
39-
property int expectedModelCount: 1
4035
property var expectedValues: [4]
4136
minimumIndex: -1
4237
},
4338
IndexFilter {
4439
property string tag: "fromEnd"
45-
property int expectedModelCount: 2
4640
property var expectedValues: [2, 4]
4741
minimumIndex: -2
4842
},
4943
IndexFilter {
5044
property string tag: "fromEndRange"
51-
property int expectedModelCount: 2
5245
property var expectedValues: [1, 2]
5346
minimumIndex: -3
5447
maximumIndex: -2
5548
},
5649
IndexFilter {
5750
property string tag: "mixedSignRange"
58-
property int expectedModelCount: 3
5951
property var expectedValues: [3, 1, 2]
6052
minimumIndex: 1
6153
maximumIndex: -2
6254
},
6355
IndexFilter {
6456
property string tag: "toBigFilter"
65-
property int expectedModelCount: 0
6657
property var expectedValues: []
6758
minimumIndex: 5
6859
},
6960
IndexFilter {
7061
property string tag: "noFilter"
71-
property int expectedModelCount: 5
7262
property var expectedValues: [5, 3, 1, 2, 4]
7363
},
7464
IndexFilter {
7565
property string tag: "undefinedFilter"
76-
property int expectedModelCount: 5
7766
property var expectedValues: [5, 3, 1, 2, 4]
7867
minimumIndex: undefined
7968
maximumIndex: null
@@ -105,14 +94,11 @@ Item {
10594
function test_minMax(filter) {
10695
testModel.filters = filter;
10796

108-
verify(testModel.count === filter.expectedModelCount,
109-
"Expected count " + filter.expectedModelCount + ", actual count: " + testModel.count);
97+
var actualValues = [];
11098
for (var i = 0; i < testModel.count; i++)
111-
{
112-
var modelValue = testModel.data(testModel.index(i, 0));
113-
verify(modelValue === filter.expectedValues[i],
114-
"Expected testModel value " + filter.expectedValues[i] + ", actual: " + modelValue);
115-
}
99+
actualValues.push(testModel.data(testModel.index(i, 0)));
100+
101+
compare(actualValues, filter.expectedValues);
116102
}
117103
}
118104
}

0 commit comments

Comments
 (0)