зеркало из https://github.com/mozilla/gecko-dev.git
92 строки
3.8 KiB
HTML
92 строки
3.8 KiB
HTML
<!DOCTYPE html>
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=759124
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 759124</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=759124">Mozilla Bug 759124</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none"></div>
|
|
|
|
<iframe id="svg" src="fragments-helper.svg"></iframe>
|
|
|
|
<pre id="test">
|
|
<script class="testbody" type="application/javascript">
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
function Test(svgFragmentIdentifier, valid, viewBoxString,
|
|
preserveAspectRatioString, zoomAndPanString)
|
|
{
|
|
this.svgFragmentIdentifier = svgFragmentIdentifier;
|
|
this.valid = valid;
|
|
this.viewBoxString = viewBoxString;
|
|
this.preserveAspectRatioString = preserveAspectRatioString;
|
|
this.zoomAndPanString = zoomAndPanString;
|
|
}
|
|
|
|
function runTests()
|
|
{
|
|
var svg = $("svg");
|
|
var doc = svg.contentWindow.document;
|
|
|
|
var tests = [
|
|
new Test("unknown", false, null, null, null),
|
|
new Test("svgView(viewBox(0,0,200,200))", true, "0 0 200 200", null, null),
|
|
new Test("svgView(preserveAspectRatio(xMaxYMin slice))", true, null, "xMaxYMin slice", null),
|
|
new Test("svgView(viewBox(1,2,3,4);preserveAspectRatio(xMinYMax))", true, "1 2 3 4", "xMinYMax meet", null),
|
|
new Test("svgView(viewBox(none))", true, "none", null, null),
|
|
new Test("svgView(zoomAndPan(disable))", true, null, null, "disable"),
|
|
new Test("svgView(transform(translate(-10,-20) scale(2) rotate(45) translate(5,10)))", true, null, null, null),
|
|
// No duplicates allowed
|
|
new Test("svgView(zoomAndPan(disable);zoomAndPan(disable))", false, null, null, null),
|
|
new Test("svgView(viewBox(0,0,200,200);viewBox(0,0,200,200))", false, null, null, null),
|
|
new Test("svgView(preserveAspectRatio(xMaxYMin);preserveAspectRatio(xMaxYMin))", false, null, null, null),
|
|
new Test("svgView(transform(translate(0,200));transform(translate(0,200)))", false, null, null, null),
|
|
// No invalid values allowed
|
|
new Test("svgView(viewBox(bad)", false, null, null, null),
|
|
new Test("svgView(preserveAspectRatio(bad))", false, null, null, null),
|
|
new Test("svgView(zoomAndPan(bad))", false, null, null, null),
|
|
new Test("svgView(transform(bad))", false, null, null, null),
|
|
new Test("svgView", false, null, null, null),
|
|
new Test("svgView(", false, null, null, null),
|
|
new Test("svgView()", false, null, null, null),
|
|
// Be sure we verify that there's a closing paren for svgView()
|
|
// (and not too many closing parens)
|
|
new Test("svgView(zoomAndPan(disable)", false, null, null, null),
|
|
new Test("svgView(zoomAndPan(disable) ", false, null, null, null),
|
|
new Test("svgView(zoomAndPan(disable)]", false, null, null, null),
|
|
new Test("svgView(zoomAndPan(disable)))", false, null, null, null)
|
|
];
|
|
|
|
var src = svg.getAttribute("src");
|
|
for (var i = 0; i < tests.length; i++) {
|
|
var test = tests[i];
|
|
svg.setAttribute("src", src + "#" + test.svgFragmentIdentifier);
|
|
is(doc.rootElement.useCurrentView, test.valid,
|
|
"Expected " + test.svgFragmentIdentifier + " to be " +
|
|
(test.valid ? "valid" : "invalid"));
|
|
|
|
is(doc.rootElement.getAttribute("viewBox"),
|
|
test.viewBoxString, "unexpected viewBox");
|
|
|
|
is(doc.rootElement.getAttribute("preserveAspectRatio"),
|
|
test.preserveAspectRatioString, "unexpected preserveAspectRatio");
|
|
|
|
is(doc.rootElement.getAttribute("zoomAndPan"),
|
|
test.zoomAndPanString, "unexpected zoomAndPan");
|
|
}
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
window.addEventListener("load", runTests, false);
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|