70
69
ListElement { name: "L" }
75
ListElement { name: "A" }
76
ListElement { name: "B" }
80
id: fakeModelFourItems
81
ListElement { name: "A" }
82
ListElement { name: "B" }
83
ListElement { name: "C" }
84
ListElement { name: "D" }
89
74
width: units.gu(30)
124
109
name: "FilterGrid"
125
110
when: windowShown
128
filterGrid.model = fakeModel
132
filterCheckBox.checked = true
133
collapsedRowCountSelector.selectedIndex = 1
136
112
function test_turningFilterOffShowsAllElements() {
137
113
tryCompareFunction(countVisibleDelegates, 6)
139
115
filterCheckBox.checked = false
141
117
tryCompareFunction(countVisibleDelegates, 12)
119
// back to initial state
120
filterCheckBox.checked = true
144
123
function test_collapsedRowCount() {
148
127
// row count == index + 1
149
128
tryCompareFunction(countVisibleDelegates, 3*(i+1))
153
function test_modelSizeAffectsCollapsedRowCount_data() {
155
{ tag: "2 items, collapsedRows 1", model: fakeModelTwoItems, collapsedRowCountIndex: 0,
156
rowsWhenCollapsed: 1, visibleDelegates: 2 },
157
{ tag: "2 items, collapsedRows 2", model: fakeModelTwoItems, collapsedRowCountIndex: 1,
158
rowsWhenCollapsed: 1, visibleDelegates: 2 },
159
{ tag: "4 items, collapsedRows 1", model: fakeModelFourItems, collapsedRowCountIndex: 0,
160
rowsWhenCollapsed: 1, visibleDelegates: 3 },
161
{ tag: "4 items, collapsedRows 2", model: fakeModelFourItems, collapsedRowCountIndex: 1,
162
rowsWhenCollapsed: 2, visibleDelegates: 4 },
166
function test_modelSizeAffectsCollapsedRowCount(data) {
167
filterGrid.model = data.model
168
collapsedRowCountSelector.selectedIndex = data.collapsedRowCountIndex
170
tryCompare(filterGrid, "rowsWhenCollapsed", data.rowsWhenCollapsed)
171
tryCompareFunction(countVisibleDelegates, data.visibleDelegates)
131
// back to initial state
132
collapsedRowCountSelector.selectedIndex = 1
174
135
function countVisibleDelegates() {