33 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
42 var sqlArtistAscAlbumAsc = <>
45 rp0.obj_sortable ||
' ' || rp1.obj_sortable
47 resource_properties rp0
48 join resource_properties rp1 on rp0.media_item_id = rp1.media_item_id
50 rp0.property_id = 3 and
55 rp0.media_item_id asc;
58 var sqlAlbumAscTrackAsc = <>
61 rp0.obj_sortable ||
' ' || rp1.obj_sortable
63 resource_properties rp0
64 join resource_properties rp1 on rp0.media_item_id = rp1.media_item_id
66 rp0.property_id = 2 and
71 rp0.media_item_id asc;
74 var sqlAlbumAscTrackAscNull = <>
81 media_item_id not in (
93 var sqlAlbumAscTrackDesc = <>
96 rp0.obj_sortable ||
' ' || rp1.obj_sortable
98 resource_properties rp0
99 join resource_properties rp1 on rp0.media_item_id = rp1.media_item_id
101 rp0.property_id = 2 and
104 rp0.obj_sortable asc,
105 rp1.obj_sortable desc,
106 rp0.media_item_id asc;
109 var sqlArtistAscAlbumAscTrackAsc = <>
112 rp0.obj_sortable ||
' ' || rp1.obj_sortable ||
' ' || rp2.obj_sortable
114 resource_properties rp0
115 join resource_properties rp1 on rp0.media_item_id = rp1.media_item_id
116 join resource_properties rp2 on rp0.media_item_id = rp2.media_item_id
118 rp0.property_id = 3 and
119 rp1.property_id = 2 and
122 rp0.obj_sortable asc,
123 rp1.obj_sortable asc,
124 rp2.obj_sortable asc,
125 rp0.media_item_id asc;
128 var sqlArtistAscAlbumAscTrackAscNull = <>
135 media_item_id not in (
147 var sqlTrackNameAscLastPlayTimeDesc = <>
150 rp0.obj_sortable ||
' ' || rp1.obj_sortable
152 resource_properties rp0
153 left join resource_properties rp1 on rp0.media_item_id = rp1.media_item_id and rp1.property_id = 11
157 rp0.obj_sortable asc,
158 rp1.obj_sortable desc,
159 rp0.media_item_id asc;
162 var sqlTrackNameAscLastPlayTimeDescNull = <>
169 media_item_id not in (
181 var databaseGUID =
"test_guidarray_sortmulti";
185 var
d = execQuery(databaseGUID, sqlArtistAscAlbumAsc);
186 var d_null = execQuery(databaseGUID, sqlAlbumAscTrackAscNull);
187 var dataSortArtistAscAlbumAsc = d.concat(d_null);
189 d = execQuery(databaseGUID, sqlAlbumAscTrackAsc);
191 d_null = execQuery(databaseGUID, sqlAlbumAscTrackAscNull);
192 dataSortAlbumAscTrackAsc = d.concat(d_null);
194 d = execQuery(databaseGUID, sqlAlbumAscTrackDesc);
196 d_null = execQuery(databaseGUID, sqlAlbumAscTrackAscNull);
197 var dataSortAlbumAscTrackDesc = d.concat(d_null);
199 d = execQuery(databaseGUID, sqlArtistAscAlbumAscTrackAsc);
200 d_null = execQuery(databaseGUID, sqlArtistAscAlbumAscTrackAscNull);
201 var dataSortArtistAscAlbumAscTrackAsc = d.concat(d_null);
203 d = execQuery(databaseGUID, sqlTrackNameAscLastPlayTimeDesc);
204 d_null = execQuery(databaseGUID, sqlTrackNameAscLastPlayTimeDescNull);
205 var dataSortTrackNameAscLastPlayTimeDesc = d.concat(d_null);
208 var fetchSizes = [0, 1, 2, 5, 7, 10, 50, 100, 200];
210 for(var
i = 0;
i < fetchSizes.length;
i++) {
212 array.baseTable =
"media_items";
213 array.addSort(SBProperties.artistName,
true);
214 array.addSort(SBProperties.albumName,
true);
215 array.fetchSize = fetchSizes[
i];
220 array.baseTable =
"media_items";
221 array.addSort(SBProperties.albumName,
true);
222 array.addSort(SBProperties.trackNumber,
true);
223 array.fetchSize = fetchSizes[
i];
228 array.baseTable =
"media_items";
229 array.addSort(SBProperties.albumName,
true);
230 array.addSort(SBProperties.trackNumber,
false);
231 array.fetchSize = fetchSizes[
i];
236 array.baseTable =
"media_items";
237 array.addSort(SBProperties.artistName,
true);
238 array.addSort(SBProperties.albumName,
true);
239 array.addSort(SBProperties.trackNumber,
true);
240 array.fetchSize = fetchSizes[
i];
245 array.baseTable =
"media_items";
246 array.addSort(SBProperties.trackName,
true);
247 array.addSort(SBProperties.lastPlayTime,
false);
248 array.fetchSize = fetchSizes[
i];
259 for (var
i = 0;
i <
array.length;
i++) {
function assertSortArray(array, data)
function assertEqual(aExpected, aActual, aMessage)
function runTest()
Test file.
function createLibrary(databaseGuid, databaseLocation)
_getSelectedPageStyle s i