33 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
34 Components.utils.import(
"resource://app/jsmodules/sbLibraryUtils.jsm");
39 var playlist1 = library.createMediaList(
"simple");
40 var
playlist2 = library.createMediaList(
"simple");
43 [
"The Beatles",
"Abbey Road",
"Come Together",
"ROCK"],
44 [
"The Beatles",
"Abbey Road",
"Sun King",
"ROCK"],
45 [
"The Beatles",
"Let It Be",
"Get Back",
"POP"],
46 [
"The Beatles",
"Let It Be",
"Two Of Us",
"POP"],
47 [
"The Doors",
"L.A. Woman",
"L.A. Woman",
"ROCK"],
48 [
"The Doors",
"L.A. Woman",
"Love Her Madly",
"ROCK"]
51 function makeItem(
i) {
52 var item = library.createMediaItem(
53 newURI(
"http://foo/" +
i +
".mp3"),
54 SBProperties.createArray([
55 [SBProperties.artistName,items[
i][0]],
56 [SBProperties.albumName, items[i][1]],
57 [SBProperties.trackName, items[i][2]],
58 [SBProperties.genre, items[i][3]]
63 var item1 = makeItem(0);
64 var item2 = makeItem(1);
65 var item3 = makeItem(2);
66 var item4 = makeItem(3);
67 var item5 = makeItem(4);
68 var item6 = makeItem(5);
70 var view = library.createView();
71 var cfs = view.cascadeFilterSet;
90 [SBProperties.isList, [
"0"]]
93 [SBProperties.hidden, [
"0"]]
98 view.filterConstraint =
filter;
101 cfs.appendSearch([
"*"], 1);
102 cfs.appendFilter(SBProperties.genre);
103 cfs.appendFilter(SBProperties.artistName);
104 cfs.appendFilter(SBProperties.albumName);
116 assertTrue(view.filterConstraint.equals(filter));
119 cfs.set(1, [
"ROCK"], 1);
131 [SBProperties.isList, [
"0"]]
134 [SBProperties.hidden, [
"0"]]
137 [SBProperties.genre, [
"ROCK"]]
141 cfs.set(2, [
"The Beatles"], 1);
151 [SBProperties.isList, [
"0"]]
154 [SBProperties.hidden, [
"0"]]
157 [SBProperties.genre, [
"ROCK"]]
160 [SBProperties.artistName, [
"The Beatles"]]
178 assertTrue(view.filterConstraint.equals(filter));
180 cfs.set(0, [
"Beat"], 1);
194 assertTrue(view.filterConstraint.equals(filter));
198 view.filterConstraint =
null;
214 view.searchConstraint =
null;
232 if (view.length != list.length) {
233 fail(
"View length not equal to list length, " + view.length +
234 " != " + list.length);
237 for(var
i = 0;
i < view.length;
i++) {
238 if (!view.getItemByIndex(
i).equals(list[
i])) {
239 fail(
"View is different than list at index " + i +
", " +
240 view.getItemByIndex(i).guid +
" != " + list[
i].guid);
function assertTrue(aTest, aMessage)
function assertEqual(aExpected, aActual, aMessage)
function runTest()
Test file.
function createLibrary(databaseGuid, databaseLocation)
function newURI(aURLString)
function assertView(view, list)
Javascript wrappers for common library tasks.
_getSelectedPageStyle s i
Array filter(tab.attributes, function(aAttr){return(_this.xulAttributes.indexOf(aAttr.name) >-1);}).forEach(tab.removeAttribute