26 Components.utils.import(
"resource://gre/modules/XPCOMUtils.jsm");
27 Components.utils.import(
"resource://app/jsmodules/ArrayConverter.jsm");
29 if (typeof(
Cc) ==
"undefined")
30 this.
Cc = Components.classes;
31 if (typeof(
Ci) ==
"undefined")
32 this.
Ci = Components.interfaces;
34 this.
Cr = Components.results;
37 var localizablePreset =
Cc[
"@getnightingale.com/equalizer-presets/localizable;1"]
38 .createInstance(
Ci.ngILocalizableEqualizerPreset);
40 assertEqual(localizablePreset.values,
null,
"Values are already defined");
42 var stringBundle =
Cc[
"@mozilla.org/intl/stringbundle;1"]
43 .getService(
Ci.nsIStringBundleService)
44 .createBundle(
"chrome://songbird/locale/songbird.properties");
46 localizablePreset.property =
"equalizer.preset.rock"
47 localizablePreset.stringBundle = stringBundle;
49 stringBundle.GetStringFromName(
"equalizer.preset.rock"),
50 "Name not set correctly");
52 localizablePreset.setValues(ArrayConverter.nsIArray([0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]));
53 assertTrue(localizablePreset.values,
"Values not defined even though previously set");
54 assertEqual(localizablePreset.values.length, 10,
"Not all values were written into the array");
function runTest()
Advanced DataRemote unit tests.
function assertTrue(aTest, aMessage)
function assertEqual(aExpected, aActual, aMessage)