33 Components.utils.import(
"resource://app/jsmodules/sbProperties.jsm");
38 var item = library.createMediaItem(
newURI(
"http://foo.com/"));
42 var list = library.createMediaList(
"simple");
49 var r = library.getItemByGuid(guid);
50 var nullprop =
"http://songbirdnest.com/data/1.0#foo";
52 var originalLength = r.getProperties().length;
53 var mediaItemId = r.QueryInterface(
Ci.sbILocalDatabaseMediaItem).mediaItemId;
58 r.setProperty(nullprop,
null);
59 assertEqual(r.getProperties().length, originalLength);
65 var r2 = library2.getItemByGuid(guid);
66 assertEqual(r2.getProperties().length, originalLength);
69 r.setProperty(nullprop,
"");
70 assertEqual(r.getProperties().length, originalLength + 1);
76 var r3 = library3.getItemByGuid(guid);
77 assertEqual(r3.getProperties().length, originalLength + 1);
80 r.setProperty(nullprop,
null);
81 assertEqual(r.getProperties().length, originalLength);
87 var r4 = library4.getItemByGuid(guid);
88 assertEqual(r4.getProperties().length, originalLength);
92 r.setProperty(SBProperties.hash,
null);
93 assertEqual(r.getProperties().length, originalLength);
98 var r5 = library5.getItemByGuid(guid);
99 assertEqual(r5.getProperties().length, originalLength);
102 r.setProperty(SBProperties.hash,
"");
103 assertEqual(r.getProperties().length, originalLength + 1);
107 var r6 = library6.getItemByGuid(guid);
108 assertEqual(r6.getProperties().length, originalLength + 1);
109 assertEqual(r6.getProperty(SBProperties.hash),
"");
111 r.setProperty(SBProperties.hash,
null);
112 assertEqual(r.getProperties().length, originalLength);
117 var r7 = library7.getItemByGuid(guid);
118 assertEqual(r7.getProperties().length, originalLength);
124 var dbq =
Cc[
"@songbirdnest.com/Songbird/DatabaseQuery;1"]
125 .createInstance(
Ci.sbIDatabaseQuery);
127 dbq.setDatabaseGUID(
"test_null_properties");
128 dbq.setAsyncQuery(
false);
129 dbq.addQuery(
"select count(1) from resource_properties where media_item_id = " + mediaItemId);
132 var dbr = dbq.getResultObject();
133 return parseInt(dbr.getRowCell(0, 0));
function countProperties(mediaItemId)
function assertEqual(aExpected, aActual, aMessage)
function runTest()
Test file.
function createLibrary(databaseGuid, databaseLocation)
function newURI(aURLString)
function testResource(library, guid)