Update web-platform-tests to revision 0d318188757a9c996e20b82db201fd04de5aa255

This commit is contained in:
James Graham 2015-03-27 09:15:38 +00:00
parent b2a5225831
commit 1a81b18b9f
12321 changed files with 544385 additions and 6 deletions

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.canvas.readonly</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.canvas.readonly</h1>
<p class="desc">CanvasRenderingContext2D.canvas is readonly</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("CanvasRenderingContext2D.canvas is readonly");
_addTest(function(canvas, ctx) {
var c = document.createElement('canvas');
var d = ctx.canvas;
_assertDifferent(c, d, "c", "d");
ctx.canvas = c;
_assertSame(ctx.canvas, d, "ctx.canvas", "d");
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.canvas.reference</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.canvas.reference</h1>
<p class="desc">CanvasRenderingContext2D.canvas refers back to its canvas</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("CanvasRenderingContext2D.canvas refers back to its canvas");
_addTest(function(canvas, ctx) {
_assertSame(ctx.canvas, canvas, "ctx.canvas", "canvas");
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.getcontext.exists</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.getcontext.exists</h1>
<p class="desc">The 2D context is implemented</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("The 2D context is implemented");
_addTest(function(canvas, ctx) {
_assertDifferent(canvas.getContext('2d'), null, "canvas.getContext('2d')", "null");
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.getcontext.extraargs</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.getcontext.extraargs</h1>
<p class="desc">The 2D context ignores extra getContext arguments</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("The 2D context ignores extra getContext arguments");
_addTest(function(canvas, ctx) {
_assertDifferent(canvas.getContext('2d', false, {}, [], 1, "2"), null, "canvas.getContext('2d', false, {}, [], 1, \"2\")", "null");
});
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.getcontext.shared</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.getcontext.shared</h1>
<p class="desc">getContext('2d') returns objects which share canvas state</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("getContext('2d') returns objects which share canvas state");
_addTest(function(canvas, ctx) {
var ctx2 = canvas.getContext('2d');
ctx.fillStyle = '#f00';
ctx2.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.getcontext.unique</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.getcontext.unique</h1>
<p class="desc">getContext('2d') returns the same object</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("getContext('2d') returns the same object");
_addTest(function(canvas, ctx) {
_assertSame(canvas.getContext('2d'), canvas.getContext('2d'), "canvas.getContext('2d')", "canvas.getContext('2d')");
});
</script>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.scaled</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.scaled</h1>
<p class="desc">CSS-scaled canvases get drawn correctly</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="50" height="25" style="width: 100px; height: 50px"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="2d.scaled.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("CSS-scaled canvases get drawn correctly");
_addTest(function(canvas, ctx) {
ctx.fillStyle = '#00f';
ctx.fillRect(0, 0, 50, 25);
ctx.fillStyle = '#0ff';
ctx.fillRect(0, 0, 25, 10);
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 B

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.type.exists</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.type.exists</h1>
<p class="desc">The 2D context interface is a property of 'window'</p>
<p class="notes">Defined in "Web IDL" (draft)
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("The 2D context interface is a property of 'window'");
_addTest(function(canvas, ctx) {
_assert(window.CanvasRenderingContext2D, "window.CanvasRenderingContext2D");
});
</script>

View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.type.extend</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.type.extend</h1>
<p class="desc">Interface methods can be added</p>
<p class="notes">Defined in "Web IDL" (draft)
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Interface methods can be added");
_addTest(function(canvas, ctx) {
window.CanvasRenderingContext2D.prototype.fillRectGreen = function (x, y, w, h)
{
this.fillStyle = '#0f0';
this.fillRect(x, y, w, h);
};
ctx.fillStyle = '#f00';
ctx.fillRectGreen(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
});
</script>

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.type.prototype</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.type.prototype</h1>
<p class="desc">window.CanvasRenderingContext2D.prototype are not [[Writable]] and not [[Configurable]], and its methods are [[Configurable]].</p>
<p class="notes">Defined in "Web IDL" (draft)
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("window.CanvasRenderingContext2D.prototype are not [[Writable]] and not [[Configurable]], and its methods are [[Configurable]].");
_addTest(function(canvas, ctx) {
_assert(window.CanvasRenderingContext2D.prototype, "window.CanvasRenderingContext2D.prototype");
_assert(window.CanvasRenderingContext2D.prototype.fill, "window.CanvasRenderingContext2D.prototype.fill");
window.CanvasRenderingContext2D.prototype = null;
_assert(window.CanvasRenderingContext2D.prototype, "window.CanvasRenderingContext2D.prototype");
delete window.CanvasRenderingContext2D.prototype;
_assert(window.CanvasRenderingContext2D.prototype, "window.CanvasRenderingContext2D.prototype");
window.CanvasRenderingContext2D.prototype.fill = 1;
_assertSame(window.CanvasRenderingContext2D.prototype.fill, 1, "window.CanvasRenderingContext2D.prototype.fill", "1");
delete window.CanvasRenderingContext2D.prototype.fill;
_assertSame(window.CanvasRenderingContext2D.prototype.fill, undefined, "window.CanvasRenderingContext2D.prototype.fill", "undefined");
});
</script>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: 2d.type.replace</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>2d.type.replace</h1>
<p class="desc">Interface methods can be overridden</p>
<p class="notes">Defined in "Web IDL" (draft)
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Interface methods can be overridden");
_addTest(function(canvas, ctx) {
var fillRect = window.CanvasRenderingContext2D.prototype.fillRect;
window.CanvasRenderingContext2D.prototype.fillRect = function (x, y, w, h)
{
this.fillStyle = '#0f0';
fillRect.call(this, x, y, w, h);
};
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
});
</script>

View file

@ -0,0 +1,10 @@
[
{
"id": "color-spaces-and-color-correction",
"original_id": "color-spaces-and-color-correction"
},
{
"id": "security-with-canvas-elements",
"original_id": "security-with-canvas-elements"
}
]

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: context.arguments.missing</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>context.arguments.missing</h1>
<p class="desc"></p>
<p class="notes">Defined in "Web IDL" (draft)
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("");
_addTest(function(canvas, ctx) {
assert_throws(new TypeError(), function() { canvas.getContext(); });
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: context.casesensitive</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>context.casesensitive</h1>
<p class="desc">Context name "2D" is unrecognised; matching is case sensitive</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Context name \"2D\" is unrecognised; matching is case sensitive");
_addTest(function(canvas, ctx) {
_assertSame(canvas.getContext('2D'), null, "canvas.getContext('2D')", "null");
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: context.emptystring</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>context.emptystring</h1>
<p class="desc">getContext with empty string returns null</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("getContext with empty string returns null");
_addTest(function(canvas, ctx) {
_assertSame(canvas.getContext(""), null, "canvas.getContext(\"\")", "null");
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: context.unrecognised.badname</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>context.unrecognised.badname</h1>
<p class="desc">getContext with unrecognised context name returns null</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("getContext with unrecognised context name returns null");
_addTest(function(canvas, ctx) {
_assertSame(canvas.getContext('This is not an implemented context in any real browser'), null, "canvas.getContext('This is not an implemented context in any real browser')", "null");
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: context.unrecognised.badsuffix</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>context.unrecognised.badsuffix</h1>
<p class="desc">Context name "2d" plus a suffix is unrecognised</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Context name \"2d\" plus a suffix is unrecognised");
_addTest(function(canvas, ctx) {
_assertSame(canvas.getContext("2d#"), null, "canvas.getContext(\"2d#\")", "null");
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: context.unrecognised.nullsuffix</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>context.unrecognised.nullsuffix</h1>
<p class="desc">Context name "2d" plus a "\0" suffix is unrecognised</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Context name \"2d\" plus a \"\\0\" suffix is unrecognised");
_addTest(function(canvas, ctx) {
_assertSame(canvas.getContext("2d\0"), null, "canvas.getContext(\"2d\\0\")", "null");
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: context.unrecognised.unicode</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>context.unrecognised.unicode</h1>
<p class="desc">Context name which kind of looks like "2d" is unrecognised</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Context name which kind of looks like \"2d\" is unrecognised");
_addTest(function(canvas, ctx) {
_assertSame(canvas.getContext("2\uFF44"), null, "canvas.getContext(\"2\\uFF44\")", "null"); // Fullwidth Latin Small Letter D
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: fallback.basic</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>fallback.basic</h1>
<p class="desc">Fallback content is inserted into the DOM</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Fallback content is inserted into the DOM");
_addTest(function(canvas, ctx) {
_assertSame(canvas.childNodes.length, 1, "canvas.childNodes.length", "1");
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: fallback.multiple</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>fallback.multiple</h1>
<p class="desc">Fallback content with multiple elements</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL</p><p class="fallback">FAIL</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Fallback content with multiple elements");
_addTest(function(canvas, ctx) {
_assertSame(canvas.childNodes.length, 2, "canvas.childNodes.length", "2");
});
</script>

View file

@ -0,0 +1,27 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: fallback.nested</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>fallback.nested</h1>
<p class="desc">Fallback content containing another canvas (mostly testing parsers)</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><canvas><p class="fallback">FAIL (fallback content)</p></canvas><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Fallback content containing another canvas (mostly testing parsers)");
_addTest(function(canvas, ctx) {
_assertSame(canvas.childNodes.length, 2, "canvas.childNodes.length", "2");
});
</script>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: initial.colour</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>initial.colour</h1>
<p class="desc">Initial state is transparent black</p>
<p class="notes">Output should be transparent black (not transparent anything-else), but manual
verification can only confirm that it's transparent - it's not possible to make
the actual blackness visible.
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="initial.colour.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Initial state is transparent black");
_addTest(function(canvas, ctx) {
_assertPixel(canvas, 20,20, 0,0,0,0, "20,20", "0,0,0,0");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

View file

@ -0,0 +1,103 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: initial.reset.2dstate</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>initial.reset.2dstate</h1>
<p class="desc">Resetting the canvas state resets 2D state variables</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Resetting the canvas state resets 2D state variables");
_addTest(function(canvas, ctx) {
canvas.width = 100;
var default_val;
default_val = ctx.strokeStyle;
ctx.strokeStyle = "#ff0000";
canvas.width = 100;
_assertSame(ctx.strokeStyle, default_val, "ctx.strokeStyle", "default_val");
default_val = ctx.fillStyle;
ctx.fillStyle = "#ff0000";
canvas.width = 100;
_assertSame(ctx.fillStyle, default_val, "ctx.fillStyle", "default_val");
default_val = ctx.globalAlpha;
ctx.globalAlpha = 0.5;
canvas.width = 100;
_assertSame(ctx.globalAlpha, default_val, "ctx.globalAlpha", "default_val");
default_val = ctx.lineWidth;
ctx.lineWidth = 0.5;
canvas.width = 100;
_assertSame(ctx.lineWidth, default_val, "ctx.lineWidth", "default_val");
default_val = ctx.lineCap;
ctx.lineCap = "round";
canvas.width = 100;
_assertSame(ctx.lineCap, default_val, "ctx.lineCap", "default_val");
default_val = ctx.lineJoin;
ctx.lineJoin = "round";
canvas.width = 100;
_assertSame(ctx.lineJoin, default_val, "ctx.lineJoin", "default_val");
default_val = ctx.miterLimit;
ctx.miterLimit = 0.5;
canvas.width = 100;
_assertSame(ctx.miterLimit, default_val, "ctx.miterLimit", "default_val");
default_val = ctx.shadowOffsetX;
ctx.shadowOffsetX = 5;
canvas.width = 100;
_assertSame(ctx.shadowOffsetX, default_val, "ctx.shadowOffsetX", "default_val");
default_val = ctx.shadowOffsetY;
ctx.shadowOffsetY = 5;
canvas.width = 100;
_assertSame(ctx.shadowOffsetY, default_val, "ctx.shadowOffsetY", "default_val");
default_val = ctx.shadowBlur;
ctx.shadowBlur = 5;
canvas.width = 100;
_assertSame(ctx.shadowBlur, default_val, "ctx.shadowBlur", "default_val");
default_val = ctx.shadowColor;
ctx.shadowColor = "#ff0000";
canvas.width = 100;
_assertSame(ctx.shadowColor, default_val, "ctx.shadowColor", "default_val");
default_val = ctx.globalCompositeOperation;
ctx.globalCompositeOperation = "copy";
canvas.width = 100;
_assertSame(ctx.globalCompositeOperation, default_val, "ctx.globalCompositeOperation", "default_val");
default_val = ctx.font;
ctx.font = "25px serif";
canvas.width = 100;
_assertSame(ctx.font, default_val, "ctx.font", "default_val");
default_val = ctx.textAlign;
ctx.textAlign = "center";
canvas.width = 100;
_assertSame(ctx.textAlign, default_val, "ctx.textAlign", "default_val");
default_val = ctx.textBaseline;
ctx.textBaseline = "bottom";
canvas.width = 100;
_assertSame(ctx.textBaseline, default_val, "ctx.textBaseline", "default_val");
});
</script>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: initial.reset.clip</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>initial.reset.clip</h1>
<p class="desc">Resetting the canvas state resets the current clip region</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Resetting the canvas state resets the current clip region");
_addTest(function(canvas, ctx) {
canvas.width = 100;
ctx.rect(0, 0, 1, 1);
ctx.clip();
canvas.width = 100;
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 20,20, 0,255,0,255, "20,20", "0,255,0,255");
});
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: initial.reset.different</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>initial.reset.different</h1>
<p class="desc">Changing size resets canvas to transparent black</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="initial.reset.different.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Changing size resets canvas to transparent black");
_addTest(function(canvas, ctx) {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 20,20, 255,0,0,255, "20,20", "255,0,0,255");
canvas.width = 50;
_assertPixel(canvas, 20,20, 0,0,0,0, "20,20", "0,0,0,0");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: initial.reset.gradient</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>initial.reset.gradient</h1>
<p class="desc">Resetting the canvas state does not invalidate any existing gradients</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Resetting the canvas state does not invalidate any existing gradients");
_addTest(function(canvas, ctx) {
canvas.width = 50;
var g = ctx.createLinearGradient(0, 0, 100, 0);
g.addColorStop(0, '#0f0');
g.addColorStop(1, '#0f0');
canvas.width = 100;
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = g;
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
});
</script>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: initial.reset.path</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>initial.reset.path</h1>
<p class="desc">Resetting the canvas state resets the current path</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="initial.reset.path.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Resetting the canvas state resets the current path");
_addTest(function(canvas, ctx) {
canvas.width = 100;
ctx.rect(0, 0, 100, 50);
canvas.width = 100;
ctx.fillStyle = '#f00';
ctx.fill();
_assertPixel(canvas, 20,20, 0,0,0,0, "20,20", "0,0,0,0");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

View file

@ -0,0 +1,36 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: initial.reset.pattern</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>initial.reset.pattern</h1>
<p class="desc">Resetting the canvas state does not invalidate any existing patterns</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Resetting the canvas state does not invalidate any existing patterns");
_addTest(function(canvas, ctx) {
canvas.width = 30;
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 30, 50);
var p = ctx.createPattern(canvas, 'repeat-x');
canvas.width = 100;
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = p;
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
});
</script>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: initial.reset.same</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>initial.reset.same</h1>
<p class="desc">Setting size (not changing the value) resets canvas to transparent black</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="initial.reset.same.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Setting size (not changing the value) resets canvas to transparent black");
_addTest(function(canvas, ctx) {
canvas.width = 100;
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 50, 50);
_assertPixel(canvas, 20,20, 255,0,0,255, "20,20", "255,0,0,255");
canvas.width = 100;
_assertPixel(canvas, 20,20, 0,0,0,0, "20,20", "0,0,0,0");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: initial.reset.transform</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>initial.reset.transform</h1>
<p class="desc">Resetting the canvas state resets the current transformation matrix</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Resetting the canvas state resets the current transformation matrix");
_addTest(function(canvas, ctx) {
canvas.width = 100;
ctx.scale(0.1, 0.1);
canvas.width = 100;
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);
_assertPixel(canvas, 20,20, 0,255,0,255, "20,20", "0,255,0,255");
});
</script>

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: security.dataURI</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>security.dataURI</h1>
<p class="desc">data: URIs do not count as different-origin, and do not taint the canvas</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="/images/green-100x50.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("data: URIs do not count as different-origin, and do not taint the canvas");
_addTest(function(canvas, ctx) {
ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);
var data = canvas.toDataURL();
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
var img = new Image();
deferTest();
img.onload = t.step_func_done(function ()
{
ctx.drawImage(img, 0, 0);
canvas.toDataURL(); // should be permitted
_assertPixel(canvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255");
});
img.src = data;
});
</script>

View file

@ -0,0 +1,35 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: security.drawImage.canvas.sub</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>security.drawImage.canvas.sub</h1>
<p class="desc">drawImage of unclean canvas makes the canvas origin-unclean</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("drawImage of unclean canvas makes the canvas origin-unclean");
_addTest(function(canvas, ctx) {
var canvas2 = document.createElement('canvas');
canvas2.width = 100;
canvas2.height = 50;
var ctx2 = canvas2.getContext('2d');
ctx2.drawImage(document.getElementById('yellow.png'), 0, 0);
ctx.drawImage(canvas2, 0, 0);
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
assert_throws("SECURITY_ERR", function() { ctx.getImageData(0, 0, 1, 1); });
});
</script>
<img src="http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png" id="yellow.png" class="resource">

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: security.drawImage.image.sub</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>security.drawImage.image.sub</h1>
<p class="desc">drawImage of different-origin image makes the canvas origin-unclean</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("drawImage of different-origin image makes the canvas origin-unclean");
_addTest(function(canvas, ctx) {
ctx.drawImage(document.getElementById('yellow.png'), 0, 0);
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
assert_throws("SECURITY_ERR", function() { ctx.getImageData(0, 0, 1, 1); });
});
</script>
<img src="http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png" id="yellow.png" class="resource">

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: security.pattern.canvas.fillStyle.sub</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>security.pattern.canvas.fillStyle.sub</h1>
<p class="desc">Setting fillStyle to a pattern of an unclean canvas makes the canvas origin-unclean</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Setting fillStyle to a pattern of an unclean canvas makes the canvas origin-unclean");
_addTest(function(canvas, ctx) {
var canvas2 = document.createElement('canvas');
canvas2.width = 100;
canvas2.height = 50;
var ctx2 = canvas2.getContext('2d');
ctx2.drawImage(document.getElementById('yellow.png'), 0, 0);
var p = ctx.createPattern(canvas2, 'repeat');
ctx.fillStyle = p;
ctx.fillStyle = 'red';
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
assert_throws("SECURITY_ERR", function() { ctx.getImageData(0, 0, 1, 1); });
});
</script>
<img src="http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png" id="yellow.png" class="resource">

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: security.pattern.canvas.strokeStyle.sub</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>security.pattern.canvas.strokeStyle.sub</h1>
<p class="desc">Setting strokeStyle to a pattern of an unclean canvas makes the canvas origin-unclean</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Setting strokeStyle to a pattern of an unclean canvas makes the canvas origin-unclean");
_addTest(function(canvas, ctx) {
var canvas2 = document.createElement('canvas');
canvas2.width = 100;
canvas2.height = 50;
var ctx2 = canvas2.getContext('2d');
ctx2.drawImage(document.getElementById('yellow.png'), 0, 0);
var p = ctx.createPattern(canvas2, 'repeat');
ctx.strokeStyle = p;
ctx.strokeStyle = 'red';
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
assert_throws("SECURITY_ERR", function() { ctx.getImageData(0, 0, 1, 1); });
});
</script>
<img src="http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png" id="yellow.png" class="resource">

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: security.pattern.canvas.timing.sub</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>security.pattern.canvas.timing.sub</h1>
<p class="desc">Pattern safety depends on whether the source was origin-clean, not on whether it still is clean</p>
<p class="notes">Disagrees with spec on "is" vs "was"
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Pattern safety depends on whether the source was origin-clean, not on whether it still is clean");
_addTest(function(canvas, ctx) {
var canvas2 = document.createElement('canvas');
canvas2.width = 100;
canvas2.height = 50;
var ctx2 = canvas2.getContext('2d');
ctx2.fillStyle = '#0f0';
ctx2.fillRect(0, 0, 100, 50);
var p = ctx.createPattern(canvas2, 'repeat');
ctx2.drawImage(document.getElementById('yellow.png'), 0, 0); // make canvas2 origin-unclean
ctx.fillStyle = p;
ctx.fillRect(0, 0, 100, 50);
canvas.toDataURL();
ctx.getImageData(0, 0, 1, 1);
_assert(true, "true"); // okay if there was no exception
});
</script>
<img src="http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png" id="yellow.png" class="resource">

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: security.pattern.create.sub</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>security.pattern.create.sub</h1>
<p class="desc">Creating an unclean pattern does not make the canvas origin-unclean</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Creating an unclean pattern does not make the canvas origin-unclean");
_addTest(function(canvas, ctx) {
var p = ctx.createPattern(document.getElementById('yellow.png'), 'repeat');
canvas.toDataURL();
ctx.getImageData(0, 0, 1, 1);
_assert(true, "true"); // okay if there was no exception
});
</script>
<img src="http://{{domains[www]}}:{{ports[http][0]}}/images/yellow.png" id="yellow.png" class="resource">

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: security.pattern.cross.sub</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>security.pattern.cross.sub</h1>
<p class="desc">Using an unclean pattern makes the target canvas origin-unclean, not the pattern canvas</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Using an unclean pattern makes the target canvas origin-unclean, not the pattern canvas");
_addTest(function(canvas, ctx) {
var canvas2 = document.createElement('canvas');
canvas2.width = 100;
canvas2.height = 50;
var ctx2 = canvas2.getContext('2d');
var p = ctx2.createPattern(document.getElementById('yellow.png'), 'repeat');
ctx.fillStyle = p;
ctx.fillRect(0, 0, 100, 50);
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
assert_throws("SECURITY_ERR", function() { ctx.getImageData(0, 0, 1, 1); });
canvas2.toDataURL();
ctx2.getImageData(0, 0, 1, 1);
});
</script>
<img src="http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png" id="yellow.png" class="resource">

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: security.pattern.image.fillStyle.sub</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>security.pattern.image.fillStyle.sub</h1>
<p class="desc">Setting fillStyle to a pattern of a different-origin image makes the canvas origin-unclean</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Setting fillStyle to a pattern of a different-origin image makes the canvas origin-unclean");
_addTest(function(canvas, ctx) {
var p = ctx.createPattern(document.getElementById('yellow.png'), 'repeat');
ctx.fillStyle = p;
ctx.fillStyle = 'red';
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
assert_throws("SECURITY_ERR", function() { ctx.getImageData(0, 0, 1, 1); });
});
</script>
<img src="http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png" id="yellow.png" class="resource">

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: security.pattern.image.strokeStyle.sub</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>security.pattern.image.strokeStyle.sub</h1>
<p class="desc">Setting strokeStyle to a pattern of a different-origin image makes the canvas origin-unclean</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Setting strokeStyle to a pattern of a different-origin image makes the canvas origin-unclean");
_addTest(function(canvas, ctx) {
var p = ctx.createPattern(document.getElementById('yellow.png'), 'repeat');
ctx.strokeStyle = p;
ctx.strokeStyle = 'red';
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
assert_throws("SECURITY_ERR", function() { ctx.getImageData(0, 0, 1, 1); });
});
</script>
<img src="http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png" id="yellow.png" class="resource">

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: security.reset.sub</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>security.reset.sub</h1>
<p class="desc">Resetting the canvas state does not reset the origin-clean flag</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Resetting the canvas state does not reset the origin-clean flag");
_addTest(function(canvas, ctx) {
canvas.width = 50;
ctx.drawImage(document.getElementById('yellow.png'), 0, 0);
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
canvas.width = 100;
assert_throws("SECURITY_ERR", function() { canvas.toDataURL(); });
});
</script>
<img src="http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png" id="yellow.png" class="resource">

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.default</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.default</h1>
<p class="desc">Default width/height when attributes are missing</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" ><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.default.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Default width/height when attributes are missing");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 300, "canvas.width", "300");
_assertSame(canvas.height, 150, "canvas.height", "150");
_assert(!canvas.hasAttribute('width'), "!canvas.hasAttribute('width')");
_assert(!canvas.hasAttribute('height'), "!canvas.hasAttribute('height')");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

View file

@ -0,0 +1,50 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.idl</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.idl</h1>
<p class="desc">Getting/setting width/height IDL attributes</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Getting/setting width/height IDL attributes");
_addTest(function(canvas, ctx) {
canvas.width = "100";
canvas.height = "100";
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
canvas.width = "+1.5e2";
canvas.height = "0x96";
_assertSame(canvas.width, 150, "canvas.width", "150");
_assertSame(canvas.height, 150, "canvas.height", "150");
canvas.width = 200 - Math.pow(2, 32);
canvas.height = 200 - Math.pow(2, 32);
_assertSame(canvas.width, 200, "canvas.width", "200");
_assertSame(canvas.height, 200, "canvas.height", "200");
canvas.width = 301.999;
canvas.height = 301.001;
_assertSame(canvas.width, 301, "canvas.width", "301");
_assertSame(canvas.height, 301, "canvas.height", "301");
canvas.width = "400x";
canvas.height = "foo";
_assertSame(canvas.width, 0, "canvas.width", "0");
_assertSame(canvas.height, 0, "canvas.height", "0");
});
</script>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.idl.set.zero</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.idl.set.zero</h1>
<p class="desc">Setting width/height IDL attributes to 0</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Setting width/height IDL attributes to 0");
_addTest(function(canvas, ctx) {
canvas.width = 0;
canvas.height = 0;
_assertSame(canvas.width, 0, "canvas.width", "0");
_assertSame(canvas.height, 0, "canvas.height", "0");
});
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.decimal</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.decimal</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100.999" height="100.999"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.decimal.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '100.999', "canvas.getAttribute('width')", "'100.999'");
_assertSame(canvas.getAttribute('height'), '100.999', "canvas.getAttribute('height')", "'100.999'");
});
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.em</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.em</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100em" height="100em"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.em.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '100em', "canvas.getAttribute('width')", "'100em'");
_assertSame(canvas.getAttribute('height'), '100em', "canvas.getAttribute('height')", "'100em'");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.empty</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.empty</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="" height=""><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.empty.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 300, "canvas.width", "300");
_assertSame(canvas.height, 150, "canvas.height", "150");
_assertSame(canvas.getAttribute('width'), '', "canvas.getAttribute('width')", "''");
_assertSame(canvas.getAttribute('height'), '', "canvas.getAttribute('height')", "''");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.exp</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.exp</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100e1" height="100e1"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.exp.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '100e1', "canvas.getAttribute('width')", "'100e1'");
_assertSame(canvas.getAttribute('height'), '100e1', "canvas.getAttribute('height')", "'100e1'");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.hex</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.hex</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="0x100" height="0x100"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 0, "canvas.width", "0");
_assertSame(canvas.height, 0, "canvas.height", "0");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "0px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"0px\"");
_assertSame(canvas.getAttribute('width'), '0x100', "canvas.getAttribute('width')", "'0x100'");
_assertSame(canvas.getAttribute('height'), '0x100', "canvas.getAttribute('height')", "'0x100'");
});
</script>

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.junk</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.junk</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="#!?" height="#!?"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.junk.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 300, "canvas.width", "300");
_assertSame(canvas.height, 150, "canvas.height", "150");
_assertSame(canvas.getAttribute('width'), '#!?', "canvas.getAttribute('width')", "'#!?'");
_assertSame(canvas.getAttribute('height'), '#!?', "canvas.getAttribute('height')", "'#!?'");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.minus</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.minus</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="-100" height="-100"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.minus.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 300, "canvas.width", "300");
_assertSame(canvas.height, 150, "canvas.height", "150");
_assertSame(canvas.getAttribute('width'), '-100', "canvas.getAttribute('width')", "'-100'");
_assertSame(canvas.getAttribute('height'), '-100', "canvas.getAttribute('height')", "'-100'");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.octal</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.octal</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="0100" height="0100"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.octal.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '0100', "canvas.getAttribute('width')", "'0100'");
_assertSame(canvas.getAttribute('height'), '0100', "canvas.getAttribute('height')", "'0100'");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View file

@ -0,0 +1,30 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.onlyspace</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.onlyspace</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width=" " height=" "><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.onlyspace.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 300, "canvas.width", "300");
_assertSame(canvas.height, 150, "canvas.height", "150");
_assertSame(canvas.getAttribute('width'), ' ', "canvas.getAttribute('width')", "' '");
_assertSame(canvas.getAttribute('height'), ' ', "canvas.getAttribute('height')", "' '");
});
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.percent</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.percent</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100%" height="100%"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.percent.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '100%', "canvas.getAttribute('width')", "'100%'");
_assertSame(canvas.getAttribute('height'), '100%', "canvas.getAttribute('height')", "'100%'");
});
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.plus</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.plus</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="+100" height="+100"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.plus.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '+100', "canvas.getAttribute('width')", "'+100'");
_assertSame(canvas.getAttribute('height'), '+100', "canvas.getAttribute('height')", "'+100'");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.space</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.space</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width=" 100" height=" 100"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.space.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), ' 100', "canvas.getAttribute('width')", "' 100'");
_assertSame(canvas.getAttribute('height'), ' 100', "canvas.getAttribute('height')", "' 100'");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.trailingjunk</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.trailingjunk</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100#!?" height="100#!?"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.trailingjunk.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '100#!?', "canvas.getAttribute('width')", "'100#!?'");
_assertSame(canvas.getAttribute('height'), '100#!?', "canvas.getAttribute('height')", "'100#!?'");
});
</script>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.whitespace</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.whitespace</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="
100" height="
100"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.parse.whitespace.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '\n\t\x0c100', "canvas.getAttribute('width')", "'\\n\\t\\x0c100'");
_assertSame(canvas.getAttribute('height'), '\n\t\x0c100', "canvas.getAttribute('height')", "'\\n\\t\\x0c100'");
});
</script>

View file

@ -0,0 +1,31 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.parse.zero</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.parse.zero</h1>
<p class="desc">Parsing of non-negative integers</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="0" height="0"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 0, "canvas.width", "0");
_assertSame(canvas.height, 0, "canvas.height", "0");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "0px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"0px\"");
_assertSame(canvas.getAttribute('width'), '0', "canvas.getAttribute('width')", "'0'");
_assertSame(canvas.getAttribute('height'), '0', "canvas.getAttribute('height')", "'0'");
});
</script>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.reflect.setcontent</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.reflect.setcontent</h1>
<p class="desc">Setting content attributes updates IDL and content attributes</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.reflect.setcontent.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Setting content attributes updates IDL and content attributes");
_addTest(function(canvas, ctx) {
canvas.setAttribute('width', '120');
canvas.setAttribute('height', '60');
_assertSame(canvas.getAttribute('width'), '120', "canvas.getAttribute('width')", "'120'");
_assertSame(canvas.getAttribute('height'), '60', "canvas.getAttribute('height')", "'60'");
_assertSame(canvas.width, 120, "canvas.width", "120");
_assertSame(canvas.height, 60, "canvas.height", "60");
});
</script>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.reflect.setidl</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.reflect.setidl</h1>
<p class="desc">Setting IDL attributes updates IDL and content attributes</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.reflect.setidl.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Setting IDL attributes updates IDL and content attributes");
_addTest(function(canvas, ctx) {
canvas.width = 120;
canvas.height = 60;
_assertSame(canvas.getAttribute('width'), '120', "canvas.getAttribute('width')", "'120'");
_assertSame(canvas.getAttribute('height'), '60', "canvas.getAttribute('height')", "'60'");
_assertSame(canvas.width, 120, "canvas.width", "120");
_assertSame(canvas.height, 60, "canvas.height", "60");
});
</script>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.reflect.setidlzero</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.reflect.setidlzero</h1>
<p class="desc">Setting IDL attributes to 0 updates IDL and content attributes</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Setting IDL attributes to 0 updates IDL and content attributes");
_addTest(function(canvas, ctx) {
canvas.width = 0;
canvas.height = 0;
_assertSame(canvas.getAttribute('width'), '0', "canvas.getAttribute('width')", "'0'");
_assertSame(canvas.getAttribute('height'), '0', "canvas.getAttribute('height')", "'0'");
_assertSame(canvas.width, 0, "canvas.width", "0");
_assertSame(canvas.height, 0, "canvas.height", "0");
});
</script>

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.removed</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.removed</h1>
<p class="desc">Removing content attributes reverts to default size</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="120" height="60"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.removed.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Removing content attributes reverts to default size");
_addTest(function(canvas, ctx) {
_assertSame(canvas.width, 120, "canvas.width", "120");
canvas.removeAttribute('width');
_assertSame(canvas.width, 300, "canvas.width", "300");
});
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 125 B

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.setAttribute.decimal</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.setAttribute.decimal</h1>
<p class="desc">Parsing of non-negative integers in setAttribute</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.setAttribute.decimal.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers in setAttribute");
_addTest(function(canvas, ctx) {
canvas.setAttribute('width', '100.999');
canvas.setAttribute('height', '100.999');
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '100.999', "canvas.getAttribute('width')", "'100.999'");
_assertSame(canvas.getAttribute('height'), '100.999', "canvas.getAttribute('height')", "'100.999'");
});
</script>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.setAttribute.em</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.setAttribute.em</h1>
<p class="desc">Parsing of non-negative integers in setAttribute</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.setAttribute.em.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers in setAttribute");
_addTest(function(canvas, ctx) {
canvas.setAttribute('width', '100em');
canvas.setAttribute('height', '100em');
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '100em', "canvas.getAttribute('width')", "'100em'");
_assertSame(canvas.getAttribute('height'), '100em', "canvas.getAttribute('height')", "'100em'");
});
</script>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.setAttribute.empty</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.setAttribute.empty</h1>
<p class="desc">Parsing of non-negative integers in setAttribute</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.setAttribute.empty.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers in setAttribute");
_addTest(function(canvas, ctx) {
canvas.setAttribute('width', '');
canvas.setAttribute('height', '');
_assertSame(canvas.width, 300, "canvas.width", "300");
_assertSame(canvas.height, 150, "canvas.height", "150");
_assertSame(canvas.getAttribute('width'), '', "canvas.getAttribute('width')", "''");
_assertSame(canvas.getAttribute('height'), '', "canvas.getAttribute('height')", "''");
});
</script>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.setAttribute.exp</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.setAttribute.exp</h1>
<p class="desc">Parsing of non-negative integers in setAttribute</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.setAttribute.exp.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers in setAttribute");
_addTest(function(canvas, ctx) {
canvas.setAttribute('width', '100e1');
canvas.setAttribute('height', '100e1');
_assertSame(canvas.width, 100, "canvas.width", "100");
_assertSame(canvas.height, 100, "canvas.height", "100");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "100px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"100px\"");
_assertSame(canvas.getAttribute('width'), '100e1', "canvas.getAttribute('width')", "'100e1'");
_assertSame(canvas.getAttribute('height'), '100e1', "canvas.getAttribute('height')", "'100e1'");
});
</script>

View file

@ -0,0 +1,33 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.setAttribute.hex</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.setAttribute.hex</h1>
<p class="desc">Parsing of non-negative integers in setAttribute</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers in setAttribute");
_addTest(function(canvas, ctx) {
canvas.setAttribute('width', '0x100');
canvas.setAttribute('height', '0x100');
_assertSame(canvas.width, 0, "canvas.width", "0");
_assertSame(canvas.height, 0, "canvas.height", "0");
_assertSame(window.getComputedStyle(canvas, null).getPropertyValue("width"), "0px", "window.getComputedStyle(canvas, null).getPropertyValue(\"width\")", "\"0px\"");
_assertSame(canvas.getAttribute('width'), '0x100', "canvas.getAttribute('width')", "'0x100'");
_assertSame(canvas.getAttribute('height'), '0x100', "canvas.getAttribute('height')", "'0x100'");
});
</script>

View file

@ -0,0 +1,32 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>Canvas test: size.attributes.setAttribute.junk</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<link rel="stylesheet" href="/common/canvas-tests.css">
<body class="show_output">
<h1>size.attributes.setAttribute.junk</h1>
<p class="desc">Parsing of non-negative integers in setAttribute</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="50" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<p class="output expectedtext">Expected output:<p><img src="size.attributes.setAttribute.junk.png" class="output expected" id="expected" alt="">
<ul id="d"></ul>
<script>
var t = async_test("Parsing of non-negative integers in setAttribute");
_addTest(function(canvas, ctx) {
canvas.setAttribute('width', '#!?');
canvas.setAttribute('height', '#!?');
_assertSame(canvas.width, 300, "canvas.width", "300");
_assertSame(canvas.height, 150, "canvas.height", "150");
_assertSame(canvas.getAttribute('width'), '#!?', "canvas.getAttribute('width')", "'#!?'");
_assertSame(canvas.getAttribute('height'), '#!?', "canvas.getAttribute('height')", "'#!?'");
});
</script>

Some files were not shown because too many files have changed in this diff Show more