on xenial help sign in
Introduce init and cleanup.
b1f4c0fMichał Karnicki
tests/qmltests/Components/tst_FilterGrid.qml+9−14
@@ -52,11 +52,6 @@ Rectangle {
52 checked: true
52 checked: true
53 }
53 }
54 }
54 }
55− Row {
56− spacing: units.gu(3)
57− Label { text: "rowsWhenCollapsed"}
58− Label { text: filterGrid.rowsWhenCollapsed }
59− }
60 }
55 }
61
56
62 ListModel {
57 ListModel {
@@ -129,30 +124,30 @@ Rectangle {
129 name: "FilterGrid"
124 name: "FilterGrid"
130 when: windowShown
125 when: windowShown
131
126
132− function test_turningFilterOffShowsAllElements() {
127+ function init() {
133 filterGrid.model = fakeModel
128 filterGrid.model = fakeModel
129+ }
130+
131+ function cleanup() {
132+ filterCheckBox.checked = true
133+ collapsedRowCountSelector.selectedIndex = 1
134+ }
135+
136+ function test_turningFilterOffShowsAllElements() {
134 tryCompareFunction(countVisibleDelegates, 6)
137 tryCompareFunction(countVisibleDelegates, 6)
135
138
136 filterCheckBox.checked = false
139 filterCheckBox.checked = false
137
140
138 tryCompareFunction(countVisibleDelegates, 12)
141 tryCompareFunction(countVisibleDelegates, 12)
139−
140− // back to initial state
141− filterCheckBox.checked = true
142 }
142 }
143
143
144 function test_collapsedRowCount() {
144 function test_collapsedRowCount() {
145− filterGrid.model = fakeModel
146−
147 for (var i = 0; i < 4; ++i) {
145 for (var i = 0; i < 4; ++i) {
148 collapsedRowCountSelector.selectedIndex = i
146 collapsedRowCountSelector.selectedIndex = i
149 // We have 3 elements per row.
147 // We have 3 elements per row.
150 // row count == index + 1
148 // row count == index + 1
151 tryCompareFunction(countVisibleDelegates, 3*(i+1))
149 tryCompareFunction(countVisibleDelegates, 3*(i+1))
152 }
150 }
153−
154− // back to initial state
155− collapsedRowCountSelector.selectedIndex = 1
156 }
151 }
157
152
158 function test_modelSizeAffectsCollapsedRowCount_data() {
153 function test_modelSizeAffectsCollapsedRowCount_data() {