~ubuntu-branches/ubuntu/trusty/unity8/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/qmltests/Components/tst_FilterGrid.qml

  • Committer: Package Import Robot
  • Author(s): Didier Roche
  • Date: 2014-02-03 16:56:47 UTC
  • mfrom: (1.1.64)
  • Revision ID: package-import@ubuntu.com-20140203165647-ik9w833cac4zu9da
Tags: 7.84+14.04.20140130.is.7.84+14.04.20131220-0ubuntu1
Reverting to last known good version, as after installing a click
application, it redirects you to the first click application everytime.
(LP: #1275832)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import Ubuntu.Components.ListItems 0.1 as ListItem
21
21
import Ubuntu.Components 0.1
22
22
import Unity.Test 0.1 as UT
23
 
import Utils 0.1
24
23
 
25
24
/*
26
25
  You should see 6 green squares (from "A" to "F") and a button "View all (12)".
70
69
        ListElement { name: "L" }
71
70
    }
72
71
 
73
 
    ListModel {
74
 
        id: fakeModelTwoItems
75
 
        ListElement { name: "A" }
76
 
        ListElement { name: "B" }
77
 
    }
78
 
 
79
 
    ListModel {
80
 
        id: fakeModelFourItems
81
 
        ListElement { name: "A" }
82
 
        ListElement { name: "B" }
83
 
        ListElement { name: "C" }
84
 
        ListElement { name: "D" }
85
 
    }
86
 
 
87
72
    Rectangle {
88
73
        id: gridRect
89
74
        width: units.gu(30)
124
109
        name: "FilterGrid"
125
110
        when: windowShown
126
111
 
127
 
        function init() {
128
 
            filterGrid.model = fakeModel
129
 
        }
130
 
 
131
 
        function cleanup() {
132
 
            filterCheckBox.checked = true
133
 
            collapsedRowCountSelector.selectedIndex = 1
134
 
        }
135
 
 
136
112
        function test_turningFilterOffShowsAllElements() {
137
113
            tryCompareFunction(countVisibleDelegates, 6)
138
114
 
139
115
            filterCheckBox.checked = false
140
116
 
141
117
            tryCompareFunction(countVisibleDelegates, 12)
 
118
 
 
119
            // back to initial state
 
120
            filterCheckBox.checked = true
142
121
        }
143
122
 
144
123
        function test_collapsedRowCount() {
148
127
                // row count == index + 1
149
128
                tryCompareFunction(countVisibleDelegates, 3*(i+1))
150
129
            }
151
 
        }
152
 
 
153
 
        function test_modelSizeAffectsCollapsedRowCount_data() {
154
 
            return [
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 },
163
 
            ]
164
 
        }
165
 
 
166
 
        function test_modelSizeAffectsCollapsedRowCount(data) {
167
 
            filterGrid.model = data.model
168
 
            collapsedRowCountSelector.selectedIndex = data.collapsedRowCountIndex
169
 
 
170
 
            tryCompare(filterGrid, "rowsWhenCollapsed", data.rowsWhenCollapsed)
171
 
            tryCompareFunction(countVisibleDelegates, data.visibleDelegates)
 
130
 
 
131
            // back to initial state
 
132
            collapsedRowCountSelector.selectedIndex = 1
172
133
        }
173
134
 
174
135
        function countVisibleDelegates() {