test_mutableequalizerpreset.js
Go to the documentation of this file.
1 /*
2 //
3 // BEGIN NIGHTINGALE GPL
4 //
5 // This file is part of the Nightingale web player.
6 //
7 // http://getnightingale.com
8 //
9 // This file may be licensed under the terms of of the
10 // GNU General Public License Version 2 (the "GPL").
11 //
12 // Software distributed under the License is distributed
13 // on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either
14 // express or implied. See the GPL for the specific language
15 // governing rights and limitations.
16 //
17 // You should have received a copy of the GPL along with this
18 // program. If not, go to http://www.gnu.org/licenses/gpl.html
19 // or write to the Free Software Foundation, Inc.,
20 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 //
22 // END NIGHTINGALE GPL
23 //
24 */
25 
26 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
27 Components.utils.import("resource://app/jsmodules/ArrayConverter.jsm");
28 
29 if (typeof(Cc) == "undefined")
30  this.Cc = Components.classes;
31 if (typeof(Ci) == "undefined")
32  this.Ci = Components.interfaces;
33 
34 function runTest() {
35  var mutablePreset = Cc["@getnightingale.com/equalizer-presets/mutable;1"]
36  .createInstance(Ci.ngIMutableEqualizerPreset);
37  assertEqual(mutablePreset.name, null, "Name is already defined");
38  assertEqual(mutablePreset.values, null, "Values are already defined");
39 
40  mutablePreset.setName("test");
41  assertEqual(mutablePreset.name, "test", "Name not set correctly");
42 
43  mutablePreset.setValues(ArrayConverter.nsIArray([0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]));
44  assertTrue(mutablePreset.values, "Values not defined even though previously set");
45  assertEqual(mutablePreset.values.length, 10, "Not all values were written into the array");
46 
47  return;
48 }
const Cc
function assertTrue(aTest, aMessage)
function assertEqual(aExpected, aActual, aMessage)
function runTest()
Advanced DataRemote unit tests.
return null
Definition: FeedWriter.js:1143
const Ci