mirror of
https://github.com/servo/servo.git
synced 2025-09-16 18:08:23 +01:00
Update web-platform-tests to revision dc5cbf088edcdb266541d4e5a76149a2c6e716a0
This commit is contained in:
parent
1d40075f03
commit
079092dfea
2381 changed files with 90360 additions and 17722 deletions
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>Canvas test: 2d.text.draw.fill.maxWidth.NaN</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.text.draw.fill.maxWidth.NaN</h1>
|
||||
<p class="desc">fillText handles maxWidth correctly</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("fillText handles maxWidth correctly");
|
||||
_addTest(function(canvas, ctx) {
|
||||
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.font = '35px Arial, sans-serif';
|
||||
ctx.fillText('fail fail fail fail fail', 5, 35, NaN);
|
||||
_assertGreen(ctx, 100, 50);
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
|
@ -24,9 +24,9 @@ g.addColorStop(0, 'rgba(255,255,0, 0)');
|
|||
g.addColorStop(1, 'rgba(0,0,255, 1)');
|
||||
ctx.fillStyle = g;
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
_assertPixelApprox(canvas, 25,25, 191,191,63,63, "25,25", "191,191,63,63", 3);
|
||||
_assertPixelApprox(canvas, 50,25, 127,127,127,127, "50,25", "127,127,127,127", 3);
|
||||
_assertPixelApprox(canvas, 75,25, 63,63,191,191, "75,25", "63,63,191,191", 3);
|
||||
_assertPixelApprox(canvas, 25,25, 190,190,65,65, "25,25", "190,190,65,65", 3);
|
||||
_assertPixelApprox(canvas, 50,25, 126,126,128,128, "50,25", "126,126,128,128", 3);
|
||||
_assertPixelApprox(canvas, 75,25, 62,62,192,192, "75,25", "62,62,192,192", 3);
|
||||
|
||||
|
||||
});
|
||||
|
|
|
@ -1,45 +1,119 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>CanvasRenderingContext2D imageSmoothingEnabled test</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="author" title="ShinHyunjin" href="mailto:jini7927@gmail.com">
|
||||
<link rel="help" href="http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas/#image-smoothing">
|
||||
</head>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<canvas id="test_canvas_1"></canvas>
|
||||
<canvas id="test_canvas_2"></canvas>
|
||||
<canvas id="test_canvas_3"></canvas>
|
||||
<meta charset="utf-8">
|
||||
<title>CanvasRenderingContext2D imageSmoothingEnabled test</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#image-smoothing">
|
||||
<script>
|
||||
function createTestImage() {
|
||||
var image = document.createElement('canvas');
|
||||
var imgctx = image.getContext('2d');
|
||||
imgctx.fillStyle = "#F00";
|
||||
imgctx.fillRect(0, 0, 2, 2);
|
||||
imgctx.fillStyle = "#0F0";
|
||||
imgctx.fillRect(0, 0, 1, 1);
|
||||
return image;
|
||||
}
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
test(function() {
|
||||
var canvas = document.getElementById('test_canvas_1');
|
||||
var ctx = canvas.getContext('2d');
|
||||
test(function() {
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
assert_true(ctx.imageSmoothingEnabled);
|
||||
}, "When the canvas context is created, imageSmoothingEnabled must be set to true.");
|
||||
|
||||
assert_true(ctx.imageSmoothingEnabled);
|
||||
}, "When the CanvasRenderingContext2D object is created, the attribute must be set to true.");
|
||||
test(function() {
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
assert_false(ctx.imageSmoothingEnabled);
|
||||
}, "On getting imageSmoothingEnabled, the user agent must return the last value it was set to.");
|
||||
|
||||
test(function() {
|
||||
var canvas = document.getElementById('test_canvas_2');
|
||||
var ctx = canvas.getContext('2d');
|
||||
test(function() {
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
var image = createTestImage();
|
||||
ctx.scale(10, 10);
|
||||
ctx.drawImage(image, 0, 0);
|
||||
var pixels = ctx.getImageData(9, 9, 1, 1).data;
|
||||
assert_not_equals(pixels[0], 0);
|
||||
assert_not_equals(pixels[1], 255);
|
||||
}, "Test that image smoothing is actually on by default and just the attribute value.");
|
||||
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
assert_false(ctx.imageSmoothingEnabled);
|
||||
}, "On getting the imageSmoothingEnabled attribute, the user agent must return the last value it was set to.");
|
||||
test(function() {
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
ctx.imageSmoothingEnabled = true;
|
||||
var image = createTestImage();
|
||||
ctx.scale(10, 10);
|
||||
ctx.drawImage(image, 0, 0);
|
||||
var pixels = ctx.getImageData(9, 9, 1, 1).data;
|
||||
assert_not_equals(pixels[0], 0);
|
||||
assert_not_equals(pixels[1], 255);
|
||||
}, "Test that image smoothing works when imageSmoothingEnabled is set to true");
|
||||
|
||||
test(function() {
|
||||
var canvas = document.getElementById('test_canvas_3');
|
||||
var ctx = canvas.getContext('2d');
|
||||
test(function() {
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
var image = createTestImage();
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.scale(10, 10);
|
||||
ctx.drawImage(image, 0, 0);
|
||||
var pixels = ctx.getImageData(9, 9, 1, 1).data;
|
||||
assert_array_equals(pixels, [0, 255, 0, 255]);
|
||||
}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with drawImage().");
|
||||
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
assert_equals(ctx.imageSmoothingEnabled, false);
|
||||
}, "On setting the imageSmoothingEnabled attribute, it must be set to the new value.");
|
||||
})();
|
||||
test(function() {
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
var image = createTestImage();
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.scale(10, 10);
|
||||
ctx.fillStyle = ctx.createPattern(image, 'repeat');
|
||||
ctx.fillRect(0, 0, 10, 10);
|
||||
var pixels = ctx.getImageData(9, 9, 1, 1).data;
|
||||
assert_array_equals(pixels, [0, 255, 0, 255]);
|
||||
}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with fillRect and createPattern().");
|
||||
|
||||
test(function() {
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
var image = createTestImage();
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.fillStyle = ctx.createPattern(image, 'repeat');
|
||||
ctx.scale(10, 10);
|
||||
ctx.rect(0, 0, 10, 10);
|
||||
ctx.fill();
|
||||
var pixels = ctx.getImageData(9, 9, 1, 1).data;
|
||||
assert_array_equals(pixels, [0, 255, 0, 255]);
|
||||
}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with fill() and createPattern().");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
test(function() {
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
var image = createTestImage();
|
||||
ctx.strokeStyle = ctx.createPattern(image, 'repeat');
|
||||
ctx.lineWidth = 5;
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.scale(10, 10);
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(0, 0);
|
||||
ctx.lineTo(10, 10);
|
||||
ctx.stroke();
|
||||
var pixels = ctx.getImageData(9, 9, 1, 1).data;
|
||||
assert_array_equals(pixels, [0, 255, 0, 255]);
|
||||
}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) works with stroke() and createPattern().");
|
||||
|
||||
test(function() {
|
||||
var repaints = 5;
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
|
||||
function draw() {
|
||||
ctx.clearRect(0, 0, 10, 10);
|
||||
ctx.setTransform(1, 0, 0, 1, 0, 0);
|
||||
var image = createTestImage();
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.scale(10, 10);
|
||||
ctx.drawImage(image, 0, 0);
|
||||
var pixels = ctx.getImageData(9, 9, 1, 1).data;
|
||||
assert_array_equals(pixels, [0, 255, 0, 255]);
|
||||
}
|
||||
|
||||
while (repaints > 0) {
|
||||
draw();
|
||||
repaints = repaints - 1;
|
||||
}
|
||||
|
||||
}, "Test that imageSmoothingEnabled = false (nearest-neighbor interpolation) still works after repaints.");
|
||||
</script>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
<title>HTML5 Canvas Test: Shadows for images</title>
|
||||
<link rel="author" title="Microsoft" href="http://www.microsoft.com" />
|
||||
<link rel="help" href="http://www.w3.org/TR/2dcontext/#shadows" />
|
||||
<link rel="match" href="canvas_shadows_002-ref.htm" />
|
||||
<meta name="assert" content="Shadows must be drawn for images." />
|
||||
<script type="text/javascript">
|
||||
function runTest() {
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>CanvasRenderingContext2D imageSmoothingEnabled save/restore test</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/scripting.html#image-smoothing">
|
||||
<script>
|
||||
function createTestImage() {
|
||||
var image = document.createElement('canvas');
|
||||
var imgctx = image.getContext('2d');
|
||||
imgctx.fillStyle = "#F00";
|
||||
imgctx.fillRect(0, 0, 2, 2);
|
||||
imgctx.fillStyle = "#0F0";
|
||||
imgctx.fillRect(0, 0, 1, 1);
|
||||
return image;
|
||||
}
|
||||
|
||||
test(function() {
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
ctx.save();
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.restore();
|
||||
assert_equals(ctx.imageSmoothingEnabled, true);
|
||||
}, "Test that restore() undoes any modifications to imageSmoothingEnabled.");
|
||||
|
||||
test(function() {
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
var old = ctx.imageSmoothingEnabled;
|
||||
ctx.save();
|
||||
assert_equals(ctx.imageSmoothingEnabled, old);
|
||||
ctx.restore();
|
||||
}, "Test that save() doesn't modify the values of imageSmoothingEnabled.");
|
||||
|
||||
test(function() {
|
||||
var ctx = document.createElement('canvas').getContext('2d');
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.save();
|
||||
ctx.imageSmoothingEnabled = true;
|
||||
ctx.restore();
|
||||
var image = createTestImage();
|
||||
ctx.scale(10, 10);
|
||||
ctx.drawImage(image, 0, 0);
|
||||
var pixels = ctx.getImageData(0, 0, 1, 1).data;
|
||||
assert_array_equals(pixels, [0, 255, 0, 255]);
|
||||
}, "Test that restoring actually changes smoothing and not just the attribute value.");
|
||||
</script>
|
|
@ -128,18 +128,18 @@ if len(sys.argv) > 1 and sys.argv[1] == '--test':
|
|||
doctest.testmod()
|
||||
sys.exit()
|
||||
|
||||
templates = yaml.load(open('templates.yaml').read())
|
||||
name_mapping = yaml.load(open('name2dir.yaml').read())
|
||||
templates = yaml.load(open('templates.yaml', "r").read())
|
||||
name_mapping = yaml.load(open('name2dir.yaml', "r").read())
|
||||
|
||||
spec_assertions = []
|
||||
for s in yaml.load(open('spec.yaml').read())['assertions']:
|
||||
for s in yaml.load(open('spec.yaml', "r").read())['assertions']:
|
||||
if 'meta' in s:
|
||||
eval(compile(s['meta'], '<meta spec assertion>', 'exec'), {}, {'assertions':spec_assertions})
|
||||
else:
|
||||
spec_assertions.append(s)
|
||||
|
||||
tests = []
|
||||
for t in sum([ yaml.load(open(f).read()) for f in ['tests.yaml', 'tests2d.yaml', 'tests2dtext.yaml']], []):
|
||||
for t in sum([ yaml.load(open(f, "r").read()) for f in ['tests.yaml', 'tests2d.yaml', 'tests2dtext.yaml']], []):
|
||||
if 'DISABLED' in t:
|
||||
continue
|
||||
if 'meta' in t:
|
||||
|
@ -423,6 +423,10 @@ for i in range(len(tests)):
|
|||
|
||||
notes = '<p class="notes">%s' % test['notes'] if 'notes' in test else ''
|
||||
|
||||
scripts = ''
|
||||
for s in test.get('scripts', []):
|
||||
scripts += '<script src="%s"></script>\n' % (s)
|
||||
|
||||
images = ''
|
||||
for i in test.get('images', []):
|
||||
id = i.split('/')[-1]
|
||||
|
@ -453,7 +457,7 @@ for i in range(len(tests)):
|
|||
'desc':desc, 'escaped_desc':escaped_desc,
|
||||
'prev':prev, 'next':next, 'refs':refs, 'notes':notes, 'images':images,
|
||||
'fonts':fonts, 'fonthack':fonthack,
|
||||
'canvas':canvas, 'expected':expectation_html, 'code':code,
|
||||
'canvas':canvas, 'expected':expectation_html, 'code':code, 'scripts':scripts,
|
||||
'mochi_name':mochi_name, 'mochi_desc':mochi_desc, 'mochi_code':mochi_code,
|
||||
'mochi_setup':mochi_setup, 'mochi_footer':mochi_footer, 'mochi_images':mochi_images,
|
||||
'fallback':fallback
|
||||
|
@ -543,7 +547,7 @@ def write_results():
|
|||
if not os.path.exists('results.yaml'):
|
||||
print "Can't find results.yaml"
|
||||
else:
|
||||
for resultset in yaml.load(open('results.yaml').read()):
|
||||
for resultset in yaml.load(open('results.yaml', "r").read()):
|
||||
#title = "%s (%s)" % (resultset['ua'], resultset['time'])
|
||||
title = resultset['name']
|
||||
#assert title not in uas # don't allow repetitions
|
||||
|
|
|
@ -9,7 +9,7 @@ import html5lib.treebuilders.dom
|
|||
|
||||
def extract():
|
||||
parser = html5lib.html5parser.HTMLParser(tree=html5lib.treebuilders.dom.TreeBuilder)
|
||||
doc = parser.parse(open('current-work'), encoding='utf-8')
|
||||
doc = parser.parse(open('current-work', "r"), encoding='utf-8')
|
||||
|
||||
head = doc.getElementsByTagName('head')[0]
|
||||
for n in head.childNodes:
|
||||
|
|
|
@ -108,7 +108,7 @@ w3c: |
|
|||
|
||||
});
|
||||
</script>
|
||||
%(images)s
|
||||
%(scripts)s%(images)s
|
||||
|
||||
mochitest: |
|
||||
<!DOCTYPE HTML>
|
||||
|
|
|
@ -869,27 +869,29 @@
|
|||
# TODO: work out what security exception should be thrown
|
||||
# TODO: test same-origin vs same-host
|
||||
|
||||
- name: security.drawImage.image.sub
|
||||
- name: security.drawImage.image
|
||||
desc: drawImage of different-origin image makes the canvas origin-unclean
|
||||
mozilla: { disabled } # relies on external resources
|
||||
testing:
|
||||
- security.drawImage.image
|
||||
- security.toDataURL
|
||||
- security.getImageData
|
||||
images:
|
||||
- http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png
|
||||
scripts:
|
||||
- /common/get-host-info.sub.js
|
||||
- data:text/javascript,addCrossOriginYellowImage()
|
||||
code: |
|
||||
ctx.drawImage(document.getElementById('yellow.png'), 0, 0);
|
||||
@assert throws SECURITY_ERR canvas.toDataURL();
|
||||
@assert throws SECURITY_ERR ctx.getImageData(0, 0, 1, 1);
|
||||
|
||||
- name: security.drawImage.canvas.sub
|
||||
- name: security.drawImage.canvas
|
||||
desc: drawImage of unclean canvas makes the canvas origin-unclean
|
||||
mozilla: { disabled } # relies on external resources
|
||||
testing:
|
||||
- security.drawImage.canvas
|
||||
images:
|
||||
- http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png
|
||||
scripts:
|
||||
- /common/get-host-info.sub.js
|
||||
- data:text/javascript,addCrossOriginYellowImage()
|
||||
code: |
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = 100;
|
||||
|
@ -900,26 +902,28 @@
|
|||
@assert throws SECURITY_ERR canvas.toDataURL();
|
||||
@assert throws SECURITY_ERR ctx.getImageData(0, 0, 1, 1);
|
||||
|
||||
- name: security.pattern.create.sub
|
||||
- name: security.pattern.create
|
||||
desc: Creating an unclean pattern does not make the canvas origin-unclean
|
||||
mozilla: { disabled } # relies on external resources
|
||||
testing:
|
||||
- security.start
|
||||
images:
|
||||
- http://{{domains[www]}}:{{ports[http][0]}}/images/yellow.png
|
||||
scripts:
|
||||
- /common/get-host-info.sub.js
|
||||
- data:text/javascript,addCrossOriginYellowImage()
|
||||
code: |
|
||||
var p = ctx.createPattern(document.getElementById('yellow.png'), 'repeat');
|
||||
canvas.toDataURL();
|
||||
ctx.getImageData(0, 0, 1, 1);
|
||||
@assert true; // okay if there was no exception
|
||||
|
||||
- name: security.pattern.cross.sub
|
||||
- name: security.pattern.cross
|
||||
desc: Using an unclean pattern makes the target canvas origin-unclean, not the pattern canvas
|
||||
mozilla: { disabled } # relies on external resources
|
||||
testing:
|
||||
- security.start
|
||||
images:
|
||||
- http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png
|
||||
scripts:
|
||||
- /common/get-host-info.sub.js
|
||||
- data:text/javascript,addCrossOriginYellowImage()
|
||||
code: |
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = 100;
|
||||
|
@ -933,15 +937,16 @@
|
|||
canvas2.toDataURL();
|
||||
ctx2.getImageData(0, 0, 1, 1);
|
||||
|
||||
- name: security.pattern.canvas.timing.sub
|
||||
- name: security.pattern.canvas.timing
|
||||
desc: Pattern safety depends on whether the source was origin-clean, not on whether it still is clean
|
||||
notes: Disagrees with spec on "is" vs "was"
|
||||
mozilla: { disabled } # relies on external resources
|
||||
testing:
|
||||
- security.start
|
||||
- security.fillStyle.canvas
|
||||
images:
|
||||
- http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png
|
||||
scripts:
|
||||
- /common/get-host-info.sub.js
|
||||
- data:text/javascript,addCrossOriginYellowImage()
|
||||
code: |
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = 100;
|
||||
|
@ -957,13 +962,14 @@
|
|||
ctx.getImageData(0, 0, 1, 1);
|
||||
@assert true; // okay if there was no exception
|
||||
|
||||
- name: security.pattern.image.fillStyle.sub
|
||||
- name: security.pattern.image.fillStyle
|
||||
desc: Setting fillStyle to a pattern of a different-origin image makes the canvas origin-unclean
|
||||
mozilla: { disabled } # relies on external resources
|
||||
testing:
|
||||
- security.fillStyle.image
|
||||
images:
|
||||
- http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png
|
||||
scripts:
|
||||
- /common/get-host-info.sub.js
|
||||
- data:text/javascript,addCrossOriginYellowImage()
|
||||
code: |
|
||||
var p = ctx.createPattern(document.getElementById('yellow.png'), 'repeat');
|
||||
ctx.fillStyle = p;
|
||||
|
@ -971,13 +977,14 @@
|
|||
@assert throws SECURITY_ERR canvas.toDataURL();
|
||||
@assert throws SECURITY_ERR ctx.getImageData(0, 0, 1, 1);
|
||||
|
||||
- name: security.pattern.canvas.fillStyle.sub
|
||||
- name: security.pattern.canvas.fillStyle
|
||||
desc: Setting fillStyle to a pattern of an unclean canvas makes the canvas origin-unclean
|
||||
mozilla: { bug: 354127, disabled } # relies on external resources
|
||||
testing:
|
||||
- security.fillStyle.canvas
|
||||
images:
|
||||
- http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png
|
||||
scripts:
|
||||
- /common/get-host-info.sub.js
|
||||
- data:text/javascript,addCrossOriginYellowImage()
|
||||
code: |
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = 100;
|
||||
|
@ -990,13 +997,14 @@
|
|||
@assert throws SECURITY_ERR canvas.toDataURL();
|
||||
@assert throws SECURITY_ERR ctx.getImageData(0, 0, 1, 1);
|
||||
|
||||
- name: security.pattern.image.strokeStyle.sub
|
||||
- name: security.pattern.image.strokeStyle
|
||||
desc: Setting strokeStyle to a pattern of a different-origin image makes the canvas origin-unclean
|
||||
mozilla: { disabled } # relies on external resources
|
||||
testing:
|
||||
- security.strokeStyle.image
|
||||
images:
|
||||
- http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png
|
||||
scripts:
|
||||
- /common/get-host-info.sub.js
|
||||
- data:text/javascript,addCrossOriginYellowImage()
|
||||
code: |
|
||||
var p = ctx.createPattern(document.getElementById('yellow.png'), 'repeat');
|
||||
ctx.strokeStyle = p;
|
||||
|
@ -1004,13 +1012,14 @@
|
|||
@assert throws SECURITY_ERR canvas.toDataURL();
|
||||
@assert throws SECURITY_ERR ctx.getImageData(0, 0, 1, 1);
|
||||
|
||||
- name: security.pattern.canvas.strokeStyle.sub
|
||||
- name: security.pattern.canvas.strokeStyle
|
||||
desc: Setting strokeStyle to a pattern of an unclean canvas makes the canvas origin-unclean
|
||||
mozilla: { bug: 354127, disabled } # relies on external resources
|
||||
testing:
|
||||
- security.strokeStyle.canvas
|
||||
images:
|
||||
- http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png
|
||||
scripts:
|
||||
- /common/get-host-info.sub.js
|
||||
- data:text/javascript,addCrossOriginYellowImage()
|
||||
code: |
|
||||
var canvas2 = document.createElement('canvas');
|
||||
canvas2.width = 100;
|
||||
|
@ -1043,13 +1052,14 @@
|
|||
img.src = data;
|
||||
expected: green
|
||||
|
||||
- name: security.reset.sub
|
||||
- name: security.reset
|
||||
desc: Resetting the canvas state does not reset the origin-clean flag
|
||||
mozilla: { disabled } # relies on external resources
|
||||
testing:
|
||||
- initial.reset
|
||||
images:
|
||||
- http://{{domains[www2]}}:{{ports[http][0]}}/images/yellow.png
|
||||
scripts:
|
||||
- /common/get-host-info.sub.js
|
||||
- data:text/javascript,addCrossOriginYellowImage()
|
||||
code: |
|
||||
canvas.width = 50;
|
||||
ctx.drawImage(document.getElementById('yellow.png'), 0, 0);
|
||||
|
|
|
@ -1668,9 +1668,9 @@
|
|||
g.addColorStop(1, 'rgba(0,0,255, 1)');
|
||||
ctx.fillStyle = g;
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
@assert pixel 25,25 ==~ 191,191,63,63 +/- 3;
|
||||
@assert pixel 50,25 ==~ 127,127,127,127 +/- 3;
|
||||
@assert pixel 75,25 ==~ 63,63,191,191 +/- 3;
|
||||
@assert pixel 25,25 ==~ 190,190,65,65 +/- 3;
|
||||
@assert pixel 50,25 ==~ 126,126,128,128 +/- 3;
|
||||
@assert pixel 75,25 ==~ 62,62,192,192 +/- 3;
|
||||
expected: |
|
||||
size 100 50
|
||||
g = cairo.LinearGradient(0, 0, 100, 0)
|
||||
|
|
|
@ -320,6 +320,19 @@
|
|||
_assertGreen(ctx, 100, 50);
|
||||
expected: green
|
||||
|
||||
- name: 2d.text.draw.fill.maxWidth.NaN
|
||||
desc: fillText handles maxWidth correctly
|
||||
testing:
|
||||
- 2d.text.draw.maxwidth
|
||||
code: |
|
||||
ctx.fillStyle = '#0f0';
|
||||
ctx.fillRect(0, 0, 100, 50);
|
||||
ctx.fillStyle = '#f00';
|
||||
ctx.font = '35px Arial, sans-serif';
|
||||
ctx.fillText('fail fail fail fail fail', 5, 35, NaN);
|
||||
_assertGreen(ctx, 100, 50);
|
||||
expected: green
|
||||
|
||||
- name: 2d.text.draw.stroke.basic
|
||||
desc: strokeText draws stroked text
|
||||
manual:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue