blob: 3abd9425e980fb8dcd5c37fb79a748ed83776e4e [file] [log] [blame]
<html>
<head>
<link rel="stylesheet" href="resources/stylesheet.css">
<script>
function print(message, color) {
var paragraph = document.createElement("div");
paragraph.appendChild(document.createTextNode(message));
paragraph.style.fontFamily = "monospace";
if (color)
paragraph.style.color = color;
document.getElementById("console").appendChild(paragraph);
}
function shouldBe(a, b)
{
var message, color;
var evalA;
try {
evalA = eval(a);
} catch (e) {
evalA = e;
}
if (evalA == b) {
color = "green";
message = "PASS: " + a + " should be " + b + " and is.";
} else {
color = "red";
message = "FAIL: " + a + " should be " + b + " but instead is " + evalA + ".";
}
print(message, color);
}
var cssRule, nodeFilter, event;
function test() {
if (window.testRunner)
testRunner.dumpAsText();
cssRule = document.styleSheets[0].cssRules[0];
shouldBe("cssRule.STYLE_RULE", 1);
shouldBe("cssRule.CHARSET_RULE", 2);
shouldBe("cssRule.IMPORT_RULE", 3);
shouldBe("cssRule.MEDIA_RULE", 4);
shouldBe("cssRule.FONT_FACE_RULE", 5);
shouldBe("cssRule.PAGE_RULE", 6);
shouldBe("window.CSSRule.STYLE_RULE", 1);
shouldBe("window.CSSRule.CHARSET_RULE", 2);
shouldBe("window.CSSRule.IMPORT_RULE", 3);
shouldBe("window.CSSRule.MEDIA_RULE", 4);
shouldBe("window.CSSRule.FONT_FACE_RULE", 5);
shouldBe("window.CSSRule.PAGE_RULE", 6);
shouldBe("window.NodeFilter.FILTER_ACCEPT", 1);
shouldBe("window.NodeFilter.FILTER_REJECT", 2);
shouldBe("window.NodeFilter.FILTER_SKIP", 3);
shouldBe("window.NodeFilter.SHOW_ALL", 4294967295);
shouldBe("window.NodeFilter.SHOW_ELEMENT", 0x00000001);
shouldBe("window.NodeFilter.SHOW_ATTRIBUTE", 0x00000002);
shouldBe("window.NodeFilter.SHOW_TEXT", 0x00000004);
shouldBe("window.NodeFilter.SHOW_CDATA_SECTION", 0x00000008);
shouldBe("window.NodeFilter.SHOW_ENTITY_REFERENCE", 0x00000010);
shouldBe("window.NodeFilter.SHOW_ENTITY", 0x00000020);
shouldBe("window.NodeFilter.SHOW_PROCESSING_INSTRUCTION", 0x00000040);
shouldBe("window.NodeFilter.SHOW_COMMENT", 0x00000080);
shouldBe("window.NodeFilter.SHOW_DOCUMENT", 0x00000100);
shouldBe("window.NodeFilter.SHOW_DOCUMENT_TYPE", 0x00000200);
shouldBe("window.NodeFilter.SHOW_DOCUMENT_FRAGMENT", 0x00000400);
shouldBe("window.NodeFilter.SHOW_NOTATION", 0x00000800);
event = document.createEvent("Event");
shouldBe("event.NONE", 0);
shouldBe("event.CAPTURING_PHASE", 1);
shouldBe("event.AT_TARGET", 2);
shouldBe("event.BUBBLING_PHASE", 3);
shouldBe("window.Event.NONE", 0);
shouldBe("window.Event.CAPTURING_PHASE", 1);
shouldBe("window.Event.AT_TARGET", 2);
shouldBe("window.Event.BUBBLING_PHASE", 3);
}
</script>
</head>
<body onload="test();">
<p>This page tests CSSRule, NodeFilter, and Event. It tests:</p>
<ol>
<li>Whether their global constructors have the correct constant values</li>
<li>Whether their objects have the correct constant values, except NodeFilter</li>
</ol>
<hr>
<div id='console'></div>
</body>
</html>