summaryrefslogtreecommitdiffstats
path: root/toolkit/content/tests/chrome/test_progressmeter.xul
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/content/tests/chrome/test_progressmeter.xul')
-rw-r--r--toolkit/content/tests/chrome/test_progressmeter.xul74
1 files changed, 74 insertions, 0 deletions
diff --git a/toolkit/content/tests/chrome/test_progressmeter.xul b/toolkit/content/tests/chrome/test_progressmeter.xul
new file mode 100644
index 000000000..7810f6991
--- /dev/null
+++ b/toolkit/content/tests/chrome/test_progressmeter.xul
@@ -0,0 +1,74 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<!--
+ 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">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+ <progressmeter id="n1"/>
+ <progressmeter id="n2" mode="undetermined"/>
+
+ <!-- test results are displayed in the html:body -->
+ <body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>
+
+ <!-- test code goes here -->
+ <script type="application/javascript"><![CDATA[
+SimpleTest.waitForExplicitFinish();
+
+function doTests() {
+ var n1 = document.getElementById("n1");
+ var n2 = document.getElementById("n2");
+
+ SimpleTest.is(n1.mode, "", "mode determined");
+ SimpleTest.is(n2.mode, "undetermined", "mode undetermined");
+
+ SimpleTest.is(n1.value, "0", "determined value");
+ SimpleTest.is(n2.value, "0", "undetermined value");
+
+ // values can only be incremented in multiples of 4
+ n1.value = 2;
+ SimpleTest.is(n1.value, "0", "determined value set 2");
+ n1.value = -1;
+ SimpleTest.is(n1.value, "0", "determined value set -1");
+ n1.value = 125;
+ SimpleTest.is(n1.value, "100", "determined value set 125");
+ n1.value = 7;
+ SimpleTest.is(n1.value, "7", "determined value set 7");
+ n1.value = "17";
+ SimpleTest.is(n1.value, "17", "determined value set 17 string");
+ n1.value = 18;
+ SimpleTest.is(n1.value, "17", "determined value set 18");
+ n1.value = "Cat";
+ SimpleTest.is(n1.value, "17", "determined value set invalid");
+
+ n1.max = 200;
+ is(n1.max, "200", "max changed");
+ n1.value = 150;
+ n1.max = 120;
+ is(n1.value, "120", "max lowered below value");
+
+ n2.value = 2;
+ SimpleTest.is(n2.value, "0", "undetermined value set 2");
+ n2.value = -1;
+ SimpleTest.is(n2.value, "0", "undetermined value set -1");
+ n2.value = 125;
+ SimpleTest.is(n2.value, "100", "undetermined value set 125");
+ n2.value = 7;
+ SimpleTest.is(n2.value, "7", "undetermined value set 7");
+ n2.value = "17";
+ SimpleTest.is(n2.value, "17", "undetermined value set 17 string");
+ n2.value = 18;
+ SimpleTest.is(n2.value, "17", "undetermined value set 18");
+ n2.value = "Cat";
+ SimpleTest.is(n2.value, "17", "determined value set invalid");
+
+ SimpleTest.finish();
+}
+
+]]></script>
+
+</window>