Merge lp:~kalikiana/u1db-qt/ordering into lp:u1db-qt

Proposed by Cris Dywan
Status: Merged
Merge reported by: Cris Dywan
Merged at revision: not available
Proposed branch: lp:~kalikiana/u1db-qt/ordering
Merge into: lp:u1db-qt
Diff against target: 83 lines (+68/-0)
1 file modified
tests/tst_query.qml (+68/-0)
To merge this branch: bzr merge lp:~kalikiana/u1db-qt/ordering
Reviewer Review Type Date Requested Status
U1DB Qt developers Pending
Review via email: mp+183886@code.launchpad.net

Commit message

Unit test query bugs related to the ordering of fields

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tests/tst_query.qml'
--- tests/tst_query.qml 2013-08-27 10:49:26 +0000
+++ tests/tst_query.qml 2013-09-04 14:17:25 +0000
@@ -120,6 +120,55 @@
120 query: [{ 'name': 'Ivanka', 'phone': '*' }]120 query: [{ 'name': 'Ivanka', 'phone': '*' }]
121 }121 }
122122
123 U1db.Database {
124 id: tokusatsu
125 }
126
127 U1db.Document {
128 database: tokusatsu
129 docId: 'ooo'
130 contents: { 'series': 'ooo', 'type': 'rider' }
131 }
132
133 U1db.Document {
134 database: tokusatsu
135 docId: 'gokaiger'
136 contents: { 'series': 'gokaiger', 'type': 'sentai' }
137 }
138
139 U1db.Document {
140 id: tokusatsuDocumentWizard
141 docId: 'wizard'
142 contents: { 'series': 'wizard', 'type': 'rider',
143 'transformations': ['Flame Style','Water Style'] }
144 }
145
146 U1db.Document {
147 id: tokusatsuDocumentDino
148 docId: 'dino'
149 contents: { 'series': 'zyuranger', 'scarf': false, 'type': 'sentai',
150 'beasts': ['T-Rex', 'Mastodon'] }
151 }
152
153 U1db.Index {
154 id: bySeries
155 database: tokusatsu
156 name: 'by-series'
157 expression: ['series', 'type']
158 }
159
160 U1db.Query {
161 id: allHeroesWithType
162 index: bySeries
163 query: [{ 'series': '*' }, { 'type': '*' }]
164 }
165
166 U1db.Query {
167 id: allHeroesSeriesOnly
168 index: bySeries
169 query: [{ 'series': '*' }]
170 }
171
123 SignalSpy {172 SignalSpy {
124 id: spyDocumentsChanged173 id: spyDocumentsChanged
125 target: defaultPhone174 target: defaultPhone
@@ -186,5 +235,24 @@
186 compare(defaultPhone.documents, ['1', 'a'], 'dos')235 compare(defaultPhone.documents, ['1', 'a'], 'dos')
187 }236 }
188237
238 function test_5_definition () {
239 workaroundQueryAndWait(allHeroesWithType)
240 compare(allHeroesWithType.documents, ['gokaiger', 'ooo'], 'ichi')
241 workaroundQueryAndWait(allHeroesSeriesOnly)
242 compare(allHeroesWithType.documents, allHeroesSeriesOnly.documents, 'ni')
243 // Add a document with extra fields
244 tokusatsu.putDoc(tokusatsuDocumentWizard.contents, tokusatsuDocumentWizard.docId)
245 workaroundQueryAndWait(allHeroesWithType)
246 compare(allHeroesWithType.documents, ['gokaiger', 'ooo', 'wizard'], 'san')
247 workaroundQueryAndWait(allHeroesSeriesOnly)
248 compare(allHeroesWithType.documents, allHeroesSeriesOnly.documents, 'chi')
249 // Add a document with mixed custom fields
250 tokusatsu.putDoc(tokusatsuDocumentDino.contents, tokusatsuDocumentDino.docId)
251 workaroundQueryAndWait(allHeroesWithType)
252 compare(allHeroesWithType.documents, ['gokaiger', 'ooo', 'wizard', 'dino'], 'go')
253 workaroundQueryAndWait(allHeroesSeriesOnly)
254 compare(allHeroesWithType.documents, allHeroesSeriesOnly.documents, 'roku')
255 }
256
189} }257} }
190258

Subscribers

People subscribed via source and target branches

to all changes: