33 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
34 Components.utils.import(
"resource://app/jsmodules/sbLibraryUtils.jsm");
40 [
"The Beatles",
"Abbey Road",
"Come Together",
"ROCK"],
41 [
"The Beatles",
"Abbey Road",
"Sun King",
"ROCK"],
42 [
"The Beatles",
"Let It Be",
"Get Back",
"POP"],
43 [
"The Beatles",
"Let It Be",
"Two Of Us",
"POP"],
44 [
"The Doors",
"L.A. Woman",
"L.A. Woman",
"ROCK"],
45 [
"The Doors",
"L.A. Woman",
"Love Her Madly",
"ROCK"]
48 function makeItem(
i) {
49 var item = library.createMediaItem(
50 newURI(
"http://foo/" +
i +
".mp3"),
51 SBProperties.createArray([
52 [SBProperties.artistName,items[
i][0]],
53 [SBProperties.albumName, items[i][1]],
54 [SBProperties.trackName, items[i][2]],
55 [SBProperties.genre, items[i][3]]
60 var item1 = makeItem(0);
61 var item2 = makeItem(1);
62 var item3 = makeItem(2);
63 var item4 = makeItem(3);
64 var item5 = makeItem(4);
65 var item6 = makeItem(5);
67 var view = library.createView();
71 [SBProperties.artistName, [
"The Beatles"]]
76 item1.setProperty(SBProperties.artistName,
"xxx");
79 view.filterConstraint =
null;
84 [SBProperties.artistName, [
"Doors"]]
88 item5.setProperty(SBProperties.artistName,
"xxx");
91 view.searchConstraint =
null;
94 view.setSort(SBProperties.createArray([
95 [SBProperties.trackName,
"a"]
97 assertTrue(view.getItemByIndex(0).equals(item1));
98 item1.setProperty(SBProperties.trackName,
"xxx");
99 assertTrue(view.getItemByIndex(0).equals(item3));
function runTest()
Test file.
function assertTrue(aTest, aMessage)
function assertEqual(aExpected, aActual, aMessage)
function createLibrary(databaseGuid, databaseLocation)
function newURI(aURLString)
Javascript wrappers for common library tasks.
_getSelectedPageStyle s i