33 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
34 Components.utils.import(
"resource://app/jsmodules/sbLibraryUtils.jsm");
37 var view = library.createView();
38 var selection = view.selection;
42 selection.currentIndex = 0;
45 var item = selection.currentMediaItem;
46 assertTrue(item.equals(view.getItemByIndex(0)));
48 selection.currentIndex = -1;
49 item = selection.currentMediaItem;
65 selection.selectRange(3, 5);
68 selection.clearRange(1, 4);
71 selection.selectNone();
74 selection.selectAll();
83 selection.selectOnly(2);
89 countSelectionChanged: 0,
90 countCurrentIndexChanged: 0,
91 onSelectionChanged:
function() {
92 this.countSelectionChanged++;
94 onCurrentIndexChanged:
function() {
95 this.countCurrentIndexChanged++;
98 this.countCurrentIndexChanged = 0;
99 this.countSelectionChanged = 0;
103 selection.addListener(listener);
106 selection.selectionNotificationsSuppressed =
true;
109 selection.selectionNotificationsSuppressed =
false;
111 selection.currentIndex = 2;
114 selection.removeListener(listener);
119 items.push(library.getItemByIndex(2));
120 items.push(library.getItemByIndex(10));
121 items.push(library.getItemByIndex(20));
122 items.push(library.getItemByIndex(21));
124 selection.selectNone();
126 selection.toggle(10);
127 selection.toggle(20);
128 selection.toggle(21);
134 for (var
i = 0;
i < library.length;
i++) {
135 allItems.push(library.getItemByIndex(
i));
137 selection.selectAll();
141 allItems.splice(10, 1);
142 selection.toggle(10);
146 allItems.splice(10, 2);
147 selection.selectAll();
148 selection.clearRange(10, 12);
155 for (var
i = 0;
i < items.length;
i++) {
156 allGuids[items[
i].guid] = 1;
159 var allItems = selection.selectedIndexedMediaItems;
161 while(allItems.hasMoreElements()) {
162 var item = allItems.getNext().mediaItem;
164 delete allGuids[item.guid];
function assertTrue(aTest, aMessage)
function assertEqual(aExpected, aActual, aMessage)
function createLibrary(databaseGuid, databaseLocation)
function assertFalse(aTest, aMessage)
_getSelectedPageStyle s i