|
7 | 7 | property list<IndexFilter> filters: [ |
8 | 8 | IndexFilter { |
9 | 9 | property string tag: "basicUsage" |
10 | | - property int expectedModelCount: 3 |
11 | | - property var expectedValues: [3, 1, 2]; |
| 10 | + property var expectedValues: [3, 1, 2] |
12 | 11 | minimumIndex: 1; maximumIndex: 3 |
13 | 12 | }, |
14 | 13 | IndexFilter { |
15 | 14 | property string tag: "outOfBounds" |
16 | | - property int expectedModelCount: 0 |
| 15 | + property var expectedValues: [] |
17 | 16 | minimumIndex: 3; maximumIndex: 1 |
18 | 17 | }, |
19 | 18 | IndexFilter { |
20 | 19 | property string tag: "0to0Inverted" |
21 | | - property int expectedModelCount: 4 |
22 | 20 | property var expectedValues: [3,1,2,4] |
23 | 21 | minimumIndex: 0; maximumIndex: 0; inverted: true |
24 | 22 | }, |
25 | 23 | IndexFilter { |
26 | 24 | property string tag: "0to0" // bug / issue #15 |
27 | | - property int expectedModelCount: 1 |
28 | 25 | property var expectedValues: [5] |
29 | 26 | minimumIndex: 0; maximumIndex: 0 |
30 | 27 | }, |
31 | 28 | IndexFilter { |
32 | 29 | property string tag: "basicUsageInverted" |
33 | | - property int expectedModelCount: 2 |
34 | 30 | property var expectedValues: [5,4] |
35 | 31 | minimumIndex: 1; maximumIndex: 3; inverted: true |
36 | 32 | }, |
37 | 33 | IndexFilter { |
38 | 34 | property string tag: "last" |
39 | | - property int expectedModelCount: 1 |
40 | 35 | property var expectedValues: [4] |
41 | 36 | minimumIndex: -1 |
42 | 37 | }, |
43 | 38 | IndexFilter { |
44 | 39 | property string tag: "fromEnd" |
45 | | - property int expectedModelCount: 2 |
46 | 40 | property var expectedValues: [2, 4] |
47 | 41 | minimumIndex: -2 |
48 | 42 | }, |
49 | 43 | IndexFilter { |
50 | 44 | property string tag: "fromEndRange" |
51 | | - property int expectedModelCount: 2 |
52 | 45 | property var expectedValues: [1, 2] |
53 | 46 | minimumIndex: -3 |
54 | 47 | maximumIndex: -2 |
55 | 48 | }, |
56 | 49 | IndexFilter { |
57 | 50 | property string tag: "mixedSignRange" |
58 | | - property int expectedModelCount: 3 |
59 | 51 | property var expectedValues: [3, 1, 2] |
60 | 52 | minimumIndex: 1 |
61 | 53 | maximumIndex: -2 |
62 | 54 | }, |
63 | 55 | IndexFilter { |
64 | 56 | property string tag: "toBigFilter" |
65 | | - property int expectedModelCount: 0 |
66 | 57 | property var expectedValues: [] |
67 | 58 | minimumIndex: 5 |
68 | 59 | }, |
69 | 60 | IndexFilter { |
70 | 61 | property string tag: "noFilter" |
71 | | - property int expectedModelCount: 5 |
72 | 62 | property var expectedValues: [5, 3, 1, 2, 4] |
73 | 63 | }, |
74 | 64 | IndexFilter { |
75 | 65 | property string tag: "undefinedFilter" |
76 | | - property int expectedModelCount: 5 |
77 | 66 | property var expectedValues: [5, 3, 1, 2, 4] |
78 | 67 | minimumIndex: undefined |
79 | 68 | maximumIndex: null |
@@ -105,14 +94,11 @@ Item { |
105 | 94 | function test_minMax(filter) { |
106 | 95 | testModel.filters = filter; |
107 | 96 |
|
108 | | - verify(testModel.count === filter.expectedModelCount, |
109 | | - "Expected count " + filter.expectedModelCount + ", actual count: " + testModel.count); |
| 97 | + var actualValues = []; |
110 | 98 | 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); |
116 | 102 | } |
117 | 103 | } |
118 | 104 | } |
0 commit comments