mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Add test for fillStyle/strokeStyle getting/setting roundtrips.
This commit is contained in:
parent
e6a3c16e9a
commit
832942bc26
3 changed files with 39 additions and 0 deletions
|
@ -5313,6 +5313,12 @@
|
|||
"url": "/_mozilla/mozilla/canvas.initial.reset.2dstate.html"
|
||||
}
|
||||
],
|
||||
"mozilla/canvas/fill_and_stroke_getters_setters.html": [
|
||||
{
|
||||
"path": "mozilla/canvas/fill_and_stroke_getters_setters.html",
|
||||
"url": "/_mozilla/mozilla/canvas/fill_and_stroke_getters_setters.html"
|
||||
}
|
||||
],
|
||||
"mozilla/caption.html": [
|
||||
{
|
||||
"path": "mozilla/caption.html",
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
[fill_and_stroke_getters_setters.html]
|
||||
type: testharness
|
||||
[strokeStyle roundtrips with \[object CanvasPattern\]]
|
||||
expected: FAIL
|
||||
[fillStyle roundtrips with \[object CanvasPattern\]]
|
||||
expected: FAIL
|
|
@ -0,0 +1,27 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>fillStyle/strokeStyle setters store the value for retrieval by getters</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<canvas id="c">
|
||||
<script>
|
||||
var ctx = document.getElementById('c').getContext('2d');
|
||||
|
||||
function roundtrip(property, vals) {
|
||||
for (var i = 0; i < vals.length; i++) {
|
||||
test(function() {
|
||||
ctx[property] = vals[i];
|
||||
assert_equals(ctx[property], vals[i]);
|
||||
}, property + ' roundtrips with ' + vals[i]);
|
||||
}
|
||||
}
|
||||
|
||||
var img = document.createElement('img');
|
||||
img.src = '../2x2.png';
|
||||
var pattern = ctx.createPattern(img, 'repeat');
|
||||
|
||||
var gradient = ctx.createLinearGradient(0.0, 0.0, 1.0, 1.0);
|
||||
|
||||
roundtrip('strokeStyle', ['#ff0000', gradient, pattern]);
|
||||
roundtrip('fillStyle', ['#ff0000', gradient, pattern]);
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue