2007-04-23 06:19:30 -07:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
2007-07-21 13:00:04 -07:00
|
|
|
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
2007-04-23 06:19:30 -07:00
|
|
|
<!--
|
|
|
|
XUL Widget Test for progressmeter
|
|
|
|
-->
|
|
|
|
<window title="Progressmeter" width="500" height="600"
|
|
|
|
onload="doTests()"
|
|
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
2007-07-21 13:00:04 -07:00
|
|
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
|
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
2007-04-23 06:19:30 -07:00
|
|
|
|
|
|
|
<progressmeter id="n1"/>
|
|
|
|
<progressmeter id="n2" mode="undetermined"/>
|
|
|
|
|
2008-03-28 23:45:45 -07:00
|
|
|
<!-- test results are displayed in the html:body -->
|
2007-04-23 06:19:30 -07:00
|
|
|
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
|
|
|
|
|
|
|
|
<!-- test code goes here -->
|
|
|
|
<script type="application/javascript"><![CDATA[
|
|
|
|
// ise - is exact - compares using ===
|
|
|
|
function ise(left, right, name) { SimpleTest.ok(left === right, name); }
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
function doTests() {
|
|
|
|
var n1 = document.getElementById("n1");
|
|
|
|
var n2 = document.getElementById("n2");
|
|
|
|
|
|
|
|
ise(n1.mode, "", "mode determined");
|
|
|
|
ise(n2.mode, "undetermined", "mode undetermined");
|
|
|
|
|
|
|
|
ise(n1.value, "0", "determined value");
|
|
|
|
ise(n2.value, "0", "undetermined value");
|
|
|
|
|
|
|
|
// values can only be incremented in multiples of 4
|
|
|
|
n1.value = 2;
|
|
|
|
ise(n1.value, "0", "determined value set 2");
|
|
|
|
n1.value = -1;
|
|
|
|
ise(n1.value, "0", "determined value set -1");
|
|
|
|
n1.value = 125;
|
|
|
|
ise(n1.value, "100", "determined value set 125");
|
|
|
|
n1.value = 7;
|
|
|
|
ise(n1.value, "7", "determined value set 7");
|
|
|
|
n1.value = "17";
|
|
|
|
ise(n1.value, "17", "determined value set 17 string");
|
|
|
|
n1.value = 18;
|
|
|
|
ise(n1.value, "17", "determined value set 18");
|
|
|
|
n1.value = "Cat";
|
|
|
|
ise(n1.value, "17", "determined value set invalid");
|
|
|
|
|
2009-01-20 09:46:52 -08:00
|
|
|
n1.max = 200;
|
|
|
|
is(n1.max, 200, "max changed");
|
|
|
|
n1.value = 150;
|
|
|
|
n1.max = 120;
|
|
|
|
is(n1.value, 120, "max lowered below value");
|
|
|
|
|
2007-04-23 06:19:30 -07:00
|
|
|
n2.value = 2;
|
|
|
|
ise(n2.value, "0", "undetermined value set 2");
|
|
|
|
n2.value = -1;
|
|
|
|
ise(n2.value, "0", "undetermined value set -1");
|
|
|
|
n2.value = 125;
|
|
|
|
ise(n2.value, "100", "undetermined value set 125");
|
|
|
|
n2.value = 7;
|
|
|
|
ise(n2.value, "7", "undetermined value set 7");
|
|
|
|
n2.value = "17";
|
|
|
|
ise(n2.value, "17", "undetermined value set 17 string");
|
|
|
|
n2.value = 18;
|
|
|
|
ise(n2.value, "17", "undetermined value set 18");
|
|
|
|
n2.value = "Cat";
|
|
|
|
ise(n2.value, "17", "determined value set invalid");
|
|
|
|
|
|
|
|
SimpleTest.finish();
|
|
|
|
}
|
|
|
|
|
|
|
|
]]></script>
|
|
|
|
|
|
|
|
</window>
|