Update web-platform-tests to revision 28b5323e37274805b1d1416273e3a941c9c7e08e

This commit is contained in:
WPT Sync Bot 2018-06-18 21:08:01 -04:00
parent 615a127b99
commit f7775a289e
439 changed files with 8598 additions and 14793 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,2 @@
[remove-block-between-inline-and-abspos.html]
expected: FAIL

View file

@ -0,0 +1,2 @@
[remove-block-between-inline-and-float.html]
expected: FAIL

View file

@ -29,9 +29,6 @@
[Test @font-face matching for weight 1000]
expected: FAIL
[Test @font-face matching for weight 420]
expected: FAIL
[Test @font-face matching for weight 99]
expected: FAIL

View file

@ -0,0 +1,2 @@
[vh_not_refreshing_on_chrome.html]
expected: FAIL

View file

@ -0,0 +1,4 @@
[fetch-in-iframe.html]
[Untitled]
expected: FAIL

View file

@ -0,0 +1,4 @@
[fetch.html]
[Untitled]
expected: FAIL

View file

@ -0,0 +1,4 @@
[iframe-loads.html]
[Untitled]
expected: FAIL

View file

@ -0,0 +1,19 @@
[image-loads.html]
[Same-origin image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.]
expected: FAIL
[Same-origin image load with a 'Cross-Origin-Resource-Policy: same-site' response header.]
expected: FAIL
[Cross-origin cors image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.]
expected: FAIL
[Cross-origin cors image load with a 'Cross-Origin-Resource-Policy: same-site' response header.]
expected: FAIL
[Cross-origin no-cors image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.]
expected: FAIL
[Cross-origin no-cors image load with a 'Cross-Origin-Resource-Policy: same-site' response header.]
expected: FAIL

View file

@ -0,0 +1,9 @@
[scheme-restriction.any.html]
[Cross-Origin-Resource-Policy: same-site blocks retrieving HTTPS from HTTP]
expected: FAIL
[scheme-restriction.any.worker.html]
[Cross-Origin-Resource-Policy: same-site blocks retrieving HTTPS from HTTP]
expected: FAIL

View file

@ -0,0 +1,4 @@
[scheme-restriction.https.window.html]
[Cross-Origin-Resource-Policy does not block Mixed Content <img>]
expected: FAIL

View file

@ -0,0 +1,19 @@
[script-loads.html]
[Same-origin script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.]
expected: FAIL
[Same-origin script load with a 'Cross-Origin-Resource-Policy: same-site' response header.]
expected: FAIL
[Cross-origin cors script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.]
expected: FAIL
[Cross-origin cors script load with a 'Cross-Origin-Resource-Policy: same-site' response header.]
expected: FAIL
[Cross-origin no-cors script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.]
expected: FAIL
[Cross-origin no-cors script load with a 'Cross-Origin-Resource-Policy: same-site' response header.]
expected: FAIL

View file

@ -1,4 +1,5 @@
[javascript-url-abort-return-value-undefined.tentative.html]
expected: TIMEOUT
[Not aborting fetch for javascript:undefined navigation]
expected: FAIL
expected: TIMEOUT

View file

@ -30,3 +30,6 @@
[Set HTTP URL frame location.protocol to data]
expected: FAIL
[Set HTTP URL frame location.protocol to x]
expected: FAIL

View file

@ -1,3 +0,0 @@
[003-sets-origin.worker.html]
type: testharness
expected: TIMEOUT

View file

@ -1,4 +1,4 @@
[shader-uniform-packing-restrictions.html]
[context-creation-and-destruction.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -1,4 +1,4 @@
[shader-with-non-reserved-words.html]
[context-creation.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -0,0 +1,2 @@
[context-eviction-with-garbage-collection.html]
expected: TIMEOUT

View file

@ -0,0 +1,5 @@
[context-release-upon-reload.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -0,0 +1,5 @@
[context-release-with-workers.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN

View file

@ -50,10 +50,14 @@ function _assertPixelApprox(canvas, x,y, r,g,b,a, pos, colour, tolerance)
assert_approx_equals(c[3], a, tolerance, 'Alpha channel of the pixel at (' + x + ', ' + y + ')');
}
let _deferred = false;
function deferTest() {
_deferred = true;
}
function _addTest(testFn)
{
var deferred = false;
window.deferTest = function () { deferred = true; };
on_event(window, "load", function()
{
t.step(function() {
@ -62,7 +66,7 @@ function _addTest(testFn)
t.step(testFn, window, canvas, ctx);
});
if (!deferred) {
if (!_deferred) {
t.done();
}
});

View file

@ -6,6 +6,7 @@ function get_host_info() {
var ORIGINAL_HOST = '{{host}}';
var REMOTE_HOST = (ORIGINAL_HOST === 'localhost') ? '127.0.0.1' : ('www1.' + ORIGINAL_HOST);
var OTHER_HOST = '{{domains[www2]}}';
var NOTSAMESITE_HOST = (ORIGINAL_HOST === 'localhost') ? '127.0.0.1' : ('not-' + ORIGINAL_HOST);
return {
HTTP_PORT: HTTP_PORT,
@ -19,6 +20,7 @@ function get_host_info() {
HTTPS_ORIGIN_WITH_CREDS: 'https://foo:bar@' + ORIGINAL_HOST + ':' + HTTPS_PORT,
HTTP_ORIGIN_WITH_DIFFERENT_PORT: 'http://' + ORIGINAL_HOST + ':' + HTTP_PORT2,
HTTP_REMOTE_ORIGIN: 'http://' + REMOTE_HOST + ':' + HTTP_PORT,
HTTP_NOTSAMESITE_ORIGIN: 'http://' + NOTSAMESITE_HOST + ':' + HTTP_PORT,
HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT: 'http://' + REMOTE_HOST + ':' + HTTP_PORT2,
HTTPS_REMOTE_ORIGIN: 'https://' + REMOTE_HOST + ':' + HTTPS_PORT,
HTTPS_REMOTE_ORIGIN_WITH_CREDS: 'https://foo:bar@' + REMOTE_HOST + ':' + HTTPS_PORT,

View file

@ -1,55 +0,0 @@
"use strict";
// https://console.spec.whatwg.org/#count
// https://console.spec.whatwg.org/#countreset
// TODO(domfarolino): make this a link to
// https://console.spec.whatwg/org/#counting pending
// the resolution of https://github.com/whatwg/console/issues/135
// TODO(domfarolino): DRY up the label conversion tests for count/countReset/time/timeEnd
// by probably making a helper function that passes in the console method to perform the
// conversion with so we're not duplicating everything
test(() => {
let countLabelToStringCalled = false;
console.count({
toString() {
countLabelToStringCalled = true;
}
});
assert_true(countLabelToStringCalled, "toString() must be called on count()'s label when label is an object");
}, "console.count()'s label gets converted to string via label.toString() when label is an object");
test(() => {
assert_throws({name: "Error"}, () => {
console.count({
toString() {
throw new Error("conversion error");
}
});
}, "count() must re-throw any exceptions thrown by label.toString() conversion");
}, "console.count() throws exceptions generated by erroneous label.toString() conversion");
test(() => {
let countLabelToStringCalled = false;
console.countReset({
toString() {
countLabelToStringCalled = true;
}
});
assert_true(countLabelToStringCalled, "toString() must be called on countReset()'s label when label is an object");
}, "console.countReset()'s label gets converted to string via label.toString() when label is an object");
test(() => {
assert_throws({name: "Error"}, () => {
console.countReset({
toString() {
throw new Error("conversion error");
}
});
}, "countReset() must re-throw any exceptions thrown by label.toString() conversion");
}, "console.countReset() throws exceptions generated by erroneous label.toString() conversion");

View file

@ -0,0 +1,29 @@
"use strict";
// https://console.spec.whatwg/org/#counting
// https://console.spec.whatwg/org/#timing
const methods = ['count', 'countReset', 'time', 'timeLog', 'timeEnd'];
for (const method of methods) {
test(() => {
let labelToStringCalled = false;
console[method]({
toString() {
labelToStringCalled = true;
}
});
assert_true(labelToStringCalled, `${method}() must call toString() on label when label is an object`);
}, `console.${method}()'s label gets converted to string via label.toString() when label is an object`);
test(() => {
assert_throws({name: 'Error'}, () => {
console[method]({
toString() {
throw new Error('conversion error');
}
});
}, `${method} must re-throw any exceptions thrown by label.toString() conversion`);
}, `console.${method}() throws exceptions generated by erroneous label.toString() conversion`);
}

View file

@ -1,46 +0,0 @@
"use strict";
// https://console.spec.whatwg.org/#timing
test(() => {
let timeLabelToStringCalled = false;
console.time({
toString() {
timeLabelToStringCalled = true;
}
});
assert_true(timeLabelToStringCalled, "toString() must be called on time()'s label when label is an object");
}, "console.time()'s label gets converted to string via label.toString() when label is an object");
test(() => {
let timeEndLabelToStringCalled = false;
console.timeEnd({
toString() {
timeEndLabelToStringCalled = true;
}
});
assert_true(timeEndLabelToStringCalled, "toString() must be called on timeEnd()'s label when label is an object");
}, "console.timeEnd()'s label gets converted to string via label.toString() when label is an object");
test(() => {
assert_throws({name: "Error"}, () => {
console.time({
toString() {
throw new Error("conversion error");
}
});
}, "time() must re-throw any exceptions thrown by label.toString() conversion");
}, "console.time() throws exceptions generated by erroneous label.toString() conversion");
test(() => {
assert_throws({name: "Error"}, () => {
console.timeEnd({
toString() {
throw new Error("conversion error");
}
});
}, "timeEnd() must re-throw any exceptions thrown by label.toString() conversion");
}, "console.timeEnd() throws exceptions generated by erroneous label.toString() conversion");

View file

@ -3,5 +3,5 @@ Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: reporting-api-doesnt-send-reports-without-violation={{$id:uuid()}}; Path=/content-security-policy/reporting-api
Report-To: { "group": "csp-group", "max-age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}" }] }
Report-To: { "group": "csp-group", "max_age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}" }] }
Content-Security-Policy: script-src 'self' 'unsafe-inline'; img-src 'self'; report-to csp-group

View file

@ -3,5 +3,5 @@ Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: reporting-api-report-only-sends-reports-on-violation={{$id:uuid()}}; Path=/content-security-policy/reporting-api
Report-To: { "group": "csp-group", "max-age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}" }] }
Report-To: { "group": "csp-group", "max_age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}" }] }
Content-Security-Policy-Report-Only: script-src 'self' 'unsafe-inline'; img-src 'none'; report-to csp-group

View file

@ -4,4 +4,4 @@ Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: reporting-api-report-to-overrides-report-uri-1={{$id:uuid()}}; Path=/content-security-policy/reporting-api
Content-Security-Policy: script-src 'self' 'unsafe-inline'; img-src 'none'; report-uri "/content-security-policy/support/report.py?op=put&reportID={{$id}}"; report-to csp-group
Report-To: { "group": "csp-group", "max-age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id:uuid()}}" }] }
Report-To: { "group": "csp-group", "max_age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id:uuid()}}" }] }

View file

@ -4,4 +4,4 @@ Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: reporting-api-report-to-overrides-report-uri-2={{$id:uuid()}}; Path=/content-security-policy/reporting-api
Content-Security-Policy: script-src 'self' 'unsafe-inline'; img-src 'none'; report-to csp-group; report-uri "/content-security-policy/support/report.py?op=put&reportID={{$id}}"
Report-To: { "group": "csp-group", "max-age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id:uuid()}}" }] }
Report-To: { "group": "csp-group", "max_age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id:uuid()}}" }] }

View file

@ -3,5 +3,5 @@ Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0, false
Pragma: no-cache
Set-Cookie: reporting-api-sends-reports-on-violation={{$id:uuid()}}; Path=/content-security-policy/reporting-api
Report-To: { "group": "csp-group", "max-age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}" }] }
Report-To: { "group": "csp-group", "max_age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}" }] }
Content-Security-Policy: script-src 'self' 'unsafe-inline'; img-src 'none'; report-to csp-group

View file

@ -2,5 +2,5 @@ Expires: Mon, 26 Jul 1997 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: reporting-api-works-on-frame-src={{$id:uuid()}}; Path=/content-security-policy/reporting-api
Report-To: { "group": "csp-group", "max-age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}" }] }
Report-To: { "group": "csp-group", "max_age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/content-security-policy/support/report.py?op=put&reportID={{$id}}" }] }
Content-Security-Policy: script-src 'self' 'unsafe-inline'; frame-src 'none'; report-to csp-group

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<title>Removing block between inline and float should put the two on the same line</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#absolute-positioning" title="9.6 Absolute positioning">
<link rel="match" href="../../reference/ref-filled-green-200px-square.html">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<!-- This is a block with block children, so inlines need to be wrapped inside
anonymous blocks. A float and out-of-flow positioned box is neutral here,
in that it can either live among block children OR among inline
children. If it is (or becomes) sibling of an inline child, though, it
should be wrapped inside the same anonymous block as the inline, or layout
will be wrong. -->
<div style="width:200px; background:red;">
<div style="height:50px; background:green;"></div>
<div style="display:inline-block; vertical-align:top; width:100px; height:150px; background:green;"></div>
<div id="removeMe" style="height:100px;"></div>
<span style="position:absolute; width:100px; height:150px; background:green;"></span>
</div>
<script>
document.body.offsetTop; // Trigger layout.
document.getElementById("removeMe").style.display = "none";
</script>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<title>Removing block between inline and float should put the two on the same line</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#floats" title="9.5 Floats">
<link rel="match" href="../../reference/ref-filled-green-200px-square.html">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<!-- This is a block with block children, so inlines need to be wrapped inside
anonymous blocks. A float and out-of-flow positioned box is neutral here,
in that it can either live among block children OR among inline
children. If it is (or becomes) sibling of an inline child, though, it
should be wrapped inside the same anonymous block as the inline, or layout
will be wrong. -->
<div style="width:200px; background:red;">
<div style="height:50px; background:green;"></div>
<div style="display:inline-block; vertical-align:top; width:100px; height:150px; background:green;"></div>
<div id="removeMe" style="height:100px;"></div>
<div style="float:left; width:100px; height:150px; background:green;"></div>
</div>
<script>
document.body.offsetTop; // Trigger layout.
document.getElementById("removeMe").style.display = "none";
</script>

View file

@ -0,0 +1,2 @@
<!DOCTYPE html>
<span style="color:green">This text should be green.</span>

View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<title>CSS Test: ::first-letter stops applying to element becoming inline.</title>
<link rel="author" title="Rune Lillesveen" href="mailto:futhark@chromium.org">
<link rel="match" href="first-letter-block-to-inline-ref.html">
<link rel="help" href="https://drafts.csswg.org/css-pseudo-4/#first-letter-pseudo">
<style>
#outer.block::first-letter { color: red }
#outer.block { display: block }
</style>
<span id="outer" class="block">
<span id="inner">This text should be green.</span>
</span>
<script>
outer.offsetTop;
outer.className = "";
inner.style.color = "green";
</script>

View file

@ -13,15 +13,6 @@
<div id="myDiv"></div>
<div id="log"></div>
<script>
/*test readonly*/
test(function(){assert_readonly(window.screen, "availWidth");}, "Screen.availWidth is readonly");
test(function(){assert_readonly(window.screen, "availHeight");}, "Screen.availHeight is readonly");
test(function(){assert_readonly(window.screen, "width");}, "Screen.width is readonly");
test(function(){assert_readonly(window.screen, "height");}, "Screen.height is readonly");
test(function(){assert_readonly(window.screen, "colorDepth");}, "Screen.colorDepth is readonly");
test(function(){assert_readonly(window.screen, "pixelDepth");}, "Screen.pixelDepth is readonly");
test(function(){assert_true(window.screen.width >= 0 && window.screen.width < 6000000);},
"window.screen.width >= 0 && window.screen.width < 6000000");
test(function(){assert_true(window.screen.height >= 0 && window.screen.height < 6000000);},

View file

@ -1,70 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSSOM MediaQueryList Test: Properties and Functions</title>
<link rel="author" title="Joe Balancio" href="mailto:jlbalancio@gmail.com" />
<link rel="help" href="http://www.w3.org/TR/cssom-view/#extensions-to-the-window-interface" />
<link rel="help" href="http://www.w3.org/TR/cssom-view/#the-mediaquerylist-interface" />
<meta name="flags" content="dom" />
<meta name="assert" content="All properties exist and are readonly. All functions exist and are instances of Function" />
<script src="/resources/testharness.js" type="text/javascript" />
<script src="/resources/testharnessreport.js" type="text/javascript" />
</head>
<body>
<noscript>Test not run - javascript required.</noscript>
<div id="log" />
<script type="text/javascript"><![CDATA[
var mediaQueryList;
test(
function(){
assert_own_property(window, "matchMedia");
mediaQueryList = window.matchMedia('foo');
}, 'window_exposes_matchmedia', {
assert: ['window.matchMedia is exposed by window. If this fails, the rest of the test fails.']
}
);
/*
MediaQueryList Functions
*/
test(
function(){
assert_inherits(mediaQueryList, "addListener");
assert_inherits(mediaQueryList, "removeListener");
}, 'mediaquerylist_inherited_functions', {
assert: ['MediaQueryList functions are inherited']
}
);
test(
function(){
assert_true(mediaQueryList.addListener instanceof Function);
assert_true(mediaQueryList.removeListener instanceof Function);
}, 'mediaquerylist_functions', {
assert: ['MediaQueryList functions are instances of Function']
}
);
/*
MediaQueryList Properties
*/
test(
function() {
assert_inherits(mediaQueryList, 'media');
assert_inherits(mediaQueryList, 'matches');
}, 'mediaquerylist_properties', {
assert: ['MediaQueryList properties are inherited']
}
);
test(
function() {
assert_readonly(mediaQueryList, 'media');
assert_readonly(mediaQueryList, 'matches');
}, 'mediaquerylist_properties_readonly', {
assert: ['MediaQueryList properties are readonly']
}
);
]]>
</script>
</body>
</html>

View file

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSSOM Window Test: Properties and Functions</title>
<link rel="author" title="Joe Balancio" href="mailto:jlbalancio@gmail.com" />
<link rel="help" href="http://www.w3.org/TR/cssom-view/#extensions-to-the-window-interface" />
<meta name="flags" content="dom" />
<meta name="assert" content="All properties exist and are readonly. All functions exist and are instances of Function" />
<script src="/resources/testharness.js" type="text/javascript" />
<script src="/resources/testharnessreport.js" type="text/javascript" />
</head>
<body>
<noscript>Test not run - javascript required.</noscript>
<div id="log" />
<script type="text/javascript"><![CDATA[
/*
Window Functions
*/
test(
function(){
assert_own_property(window, "matchMedia");
assert_own_property(window, "scroll");
assert_own_property(window, "scrollTo");
assert_own_property(window, "scrollBy");
}, 'window_exposed_functions', {
assert: ['window functions are exposed']
}
);
test(
function(){
assert_true(window.matchMedia instanceof Function);
assert_true(window.scroll instanceof Function);
assert_true(window.scrollTo instanceof Function);
assert_true(window.scrollBy instanceof Function);
}, 'window_functions', {
assert: ['window functions are instances of Function']
}
);
/*
Window Properties
*/
test(
function() {
assert_own_property(window, 'screen');
assert_own_property(window, 'innerWidth');
assert_own_property(window, 'innerHeight');
assert_own_property(window, 'scrollX');
assert_own_property(window, 'pageXOffset');
assert_own_property(window, 'scrollY');
assert_own_property(window, 'pageYOffset');
assert_own_property(window, 'screenX');
assert_own_property(window, 'screenY');
assert_own_property(window, 'outerWidth');
assert_own_property(window, 'outerHeight');
}, 'window_properties', {
assert: ['window properties are owned by window']
}
);
test(
function() {
assert_readonly(window, 'screen');
assert_readonly(window, 'innerWidth');
assert_readonly(window, 'innerHeight');
assert_readonly(window, 'scrollX');
assert_readonly(window, 'pageXOffset');
assert_readonly(window, 'scrollY');
assert_readonly(window, 'pageYOffset');
assert_readonly(window, 'screenX');
assert_readonly(window, 'screenY');
assert_readonly(window, 'outerWidth');
assert_readonly(window, 'outerHeight');
}, 'window_properties_readonly', {
assert: ['window properties are readonly']
}
);
]]>
</script>
</body>
</html>

View file

@ -70,7 +70,7 @@ var validSelectors = [
{name: "Type selector, matching body element", selector: "body", expect: [] /*no matches*/, exclude: ["document"], level: 1, testType: TEST_QSA},
// Universal Selector
// Testing "*" for entire an entire context node is handled separately.
{name: "Universal selector, matching all elements", selector: "*", expect: ["universal", "universal-p1", "universal-code1", "universal-hr1", "universal-pre1", "universal-span1", "universal-p2", "universal-a1", "universal-address1", "universal-code2", "universal-a2"], level: 2, testType: TEST_MATCH},
{name: "Universal selector, matching all children of element with specified ID", selector: "#universal>*", expect: ["universal-p1", "universal-hr1", "universal-pre1", "universal-p2", "universal-address1"], level: 2, testType: TEST_QSA | TEST_MATCH},
{name: "Universal selector, matching all grandchildren of element with specified ID", selector: "#universal>*>*", expect: ["universal-code1", "universal-span1", "universal-a1", "universal-code2"], level: 2, testType: TEST_QSA | TEST_MATCH},
{name: "Universal selector, matching all children of empty element with specified ID", selector: "#empty>*", expect: [] /*no matches*/, level: 2, testType: TEST_QSA},
@ -449,10 +449,6 @@ var validSelectors = [
var scopedSelectors = [
//{name: "", selector: "", ctx: "", ref: "", expect: [], level: 1, testType: TEST_FIND | TEST_MATCH},
// Universal Selector
{name: "Universal selector, matching all descendants of the specified reference element", selector: "*", ctx: "#universal", expect: ["universal-p1", "universal-code1", "universal-hr1", "universal-pre1", "universal-span1",
"universal-p2", "universal-a1", "universal-address1", "universal-code2", "universal-a2"], unexpected: ["universal", "empty"], level: 2, testType: TEST_FIND | TEST_MATCH},
// Attribute Selectors
// - presence [att]
{name: "Attribute presence selector, matching align attribute with value", selector: ".attr-presence-div1[align]", ctx: "#attr-presence", expect: ["attr-presence-div1"], level: 2, testType: TEST_FIND | TEST_MATCH},

View file

@ -0,0 +1,10 @@
<script>
'use strict';
let worker = new Worker('feature-policy-usb-worker.js');
worker.onmessage = event => {
window.parent.postMessage(event.data, '*');
};
worker.postMessage({ type: 'ready' });
</script>

View file

@ -0,0 +1,14 @@
'use strict';
// Dedicated worker
if (typeof postMessage === 'function') {
onmessage = event => {
switch(event.data.type) {
case 'ready':
navigator.usb.getDevices().then(
() => postMessage({ enabled: true }),
error => postMessage ({ enabled: false }));
break;
}
};
}

View file

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
</head>
<body>
<script>
const host = get_host_info();
const remoteBaseURL = host.HTTP_REMOTE_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;
const notSameSiteBaseURL = host.HTTP_NOTSAMESITE_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;
const localBaseURL = host.HTTP_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;
function with_iframe(url)
{
return new Promise(function(resolve) {
var frame = document.createElement('iframe');
frame.src = url;
frame.onload = function() { resolve(frame); };
document.body.appendChild(frame);
});
}
function loadIFrameAndFetch(iframeURL, fetchURL, expectedFetchResult, title)
{
promise_test(async () => {
const frame = await with_iframe(iframeURL);
let receiveMessage;
const promise = new Promise((resolve, reject) => {
receiveMessage = (event) => {
if (event.data !== expectedFetchResult) {
reject("Received unexpected message " + event.data);
return;
}
resolve();
}
window.addEventListener("message", receiveMessage, false);
});
frame.contentWindow.postMessage(fetchURL, "*");
return promise.finally(() => {
frame.remove();
window.removeEventListener("message", receiveMessage, false);
});
}, title);
}
// This above data URL should be equivalent to resources/iframeFetch.html
var dataIFrameURL = "data:text/html;base64,PCFET0NUWVBFIGh0bWw+CjxodG1sPgo8aGVhZD4KICAgIDxzY3JpcHQ+CiAgICAgICAgZnVuY3Rpb24gcHJvY2Vzc01lc3NhZ2UoZXZlbnQpCiAgICAgICAgewogICAgICAgICAgICBmZXRjaChldmVudC5kYXRhLCB7IG1vZGU6ICJuby1jb3JzIiB9KS50aGVuKCgpID0+IHsKICAgICAgICAgICAgICAgIHBhcmVudC5wb3N0TWVzc2FnZSgib2siLCAiKiIpOwogICAgICAgICAgICB9LCAoKSA9PiB7CiAgICAgICAgICAgICAgICBwYXJlbnQucG9zdE1lc3NhZ2UoImtvIiwgIioiKTsKICAgICAgICAgICAgfSk7CiAgICAgICAgfQogICAgICAgIHdpbmRvdy5hZGRFdmVudExpc3RlbmVyKCJtZXNzYWdlIiwgcHJvY2Vzc01lc3NhZ2UsIGZhbHNlKTsKICAgIDwvc2NyaXB0Pgo8L2hlYWQ+Cjxib2R5PgogICAgPGgzPlRoZSBpZnJhbWUgbWFraW5nIGEgc2FtZSBvcmlnaW4gZmV0Y2ggY2FsbC48L2gzPgo8L2JvZHk+CjwvaHRtbD4K";
loadIFrameAndFetch(dataIFrameURL, localBaseURL + "resources/hello.py?corp=same-origin", "ko",
"Cross-origin fetch in a data: iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
loadIFrameAndFetch(dataIFrameURL, localBaseURL + "resources/hello.py?corp=same-site", "ko",
"Cross-origin fetch in a data: iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-site' response header.");
loadIFrameAndFetch(remoteBaseURL + "resources/iframeFetch.html", localBaseURL + "resources/hello.py?corp=same-origin", "ko",
"Cross-origin fetch in a cross origin iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
loadIFrameAndFetch(notSameSiteBaseURL + "resources/iframeFetch.html", localBaseURL + "resources/hello.py?corp=same-site", "ko",
"Cross-origin fetch in a cross origin iframe load fails if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-site' response header.");
loadIFrameAndFetch(remoteBaseURL + "resources/iframeFetch.html", remoteBaseURL + "resources/hello.py?corp=same-origin", "ok",
"Same-origin fetch in a cross origin iframe load succeeds if the server blocks cross-origin loads with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
</script>
</body>
</html>

View file

@ -0,0 +1,83 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
</head>
<body>
<script>
const host = get_host_info();
const localBaseURL = host.HTTP_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;
const sameSiteBaseURL = "http://" + host.ORIGINAL_HOST + ":" + host.HTTP_PORT2 + window.location.pathname.replace(/\/[^\/]*$/, '/') ;
const notSameSiteBaseURL = host.HTTP_NOTSAMESITE_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;
const httpsBaseURL = host.HTTPS_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;
promise_test(async () => {
const response = await fetch("./resources/hello.py?corp=same-origin");
assert_equals(await response.text(), "hello");
}, "Same-origin fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
promise_test(async () => {
const response = await fetch("./resources/hello.py?corp=same-site");
assert_equals(await response.text(), "hello");
}, "Same-origin fetch with a 'Cross-Origin-Resource-Policy: same-site' response header.");
promise_test(async (test) => {
const response = await fetch(notSameSiteBaseURL + "resources/hello.py?corp=same-origin");
assert_equals(await response.text(), "hello");
}, "Cross-origin cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
promise_test(async (test) => {
const response = await fetch(notSameSiteBaseURL + "resources/hello.py?corp=same-site");
assert_equals(await response.text(), "hello");
}, "Cross-origin cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header.");
promise_test((test) => {
const remoteURL = notSameSiteBaseURL + "resources/hello.py?corp=same-origin";
return promise_rejects(test, new TypeError, fetch(remoteURL, { mode : "no-cors" }));
}, "Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
promise_test((test) => {
const remoteURL = notSameSiteBaseURL + "resources/hello.py?corp=same-site";
return promise_rejects(test, new TypeError, fetch(remoteURL, { mode: "no-cors" }));
}, "Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header.");
promise_test((test) => {
const remoteURL = httpsBaseURL + "resources/hello.py?corp=same-site";
return fetch(remoteURL, { mode: "no-cors" });
}, "Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-site' response header.");
promise_test((test) => {
const remoteURL = httpsBaseURL + "resources/hello.py?corp=same-origin";
return promise_rejects(test, new TypeError, fetch(remoteURL, { mode : "no-cors" }));
}, "Cross-origin no-cors fetch to a same-site URL with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
promise_test(async (test) => {
const remoteSameSiteURL = sameSiteBaseURL + "resources/hello.py?corp=same-site";
await fetch(remoteSameSiteURL, { mode: "no-cors" });
return promise_rejects(test, new TypeError, fetch(sameSiteBaseURL + "resources/hello.py?corp=same-origin", { mode: "no-cors" }));
}, "Valid cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-site' response header.");
promise_test((test) => {
const finalURL = notSameSiteBaseURL + "resources/hello.py?corp=same-origin";
return promise_rejects(test, new TypeError, fetch("resources/redirect.py?redirectTo=" + encodeURIComponent(finalURL), { mode: "no-cors" }));
}, "Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header after a redirection.");
promise_test((test) => {
const finalURL = localBaseURL + "resources/hello.py?corp=same-origin";
return fetch(notSameSiteBaseURL + "resources/redirect.py?redirectTo=" + encodeURIComponent(finalURL), { mode: "no-cors" });
}, "Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' response header after a cross-origin redirection.");
promise_test(async (test) => {
const finalURL = localBaseURL + "resources/hello.py?corp=same-origin";
await fetch(finalURL, { mode: "no-cors" });
return promise_rejects(test, new TypeError, fetch(notSameSiteBaseURL + "resources/redirect.py?corp=same-origin&redirectTo=" + encodeURIComponent(finalURL), { mode: "no-cors" }));
}, "Cross-origin no-cors fetch with a 'Cross-Origin-Resource-Policy: same-origin' redirect response header.");
</script>
</body>
</html>

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
</head>
<body>
<script>
const host = get_host_info();
const remoteBaseURL = host.HTTP_REMOTE_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;
const localBaseURL = host.HTTP_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;
function with_iframe(url) {
return new Promise(function(resolve) {
var frame = document.createElement('iframe');
frame.src = url;
frame.onload = function() { resolve(frame); };
document.body.appendChild(frame);
});
}
promise_test(async() => {
const url = remoteBaseURL + "resources/iframe.py?corp=same-origin";
await new Promise((resolve, reject) => {
return fetch(url, { mode: "no-cors" }).then(reject, resolve);
});
const iframe = await with_iframe(url);
return new Promise((resolve, reject) => {
window.addEventListener("message", (event) => {
if (event.data !== "pong") {
reject(event.data);
return;
}
resolve();
}, false);
iframe.contentWindow.postMessage("ping", "*");
}).finally(() => {
iframe.remove();
});
}, "Load an iframe that has Cross-Origin-Resource-Policy header");
</script>
</body>
</html>

View file

@ -0,0 +1,53 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
</head>
<body>
<div id="testDiv"></div>
<script>
const host = get_host_info();
const notSameSiteBaseURL = host.HTTP_NOTSAMESITE_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;
const ok = true;
const ko = false;
const noCors = false;
function loadImage(url, shoudLoad, corsMode, title)
{
promise_test(() => {
const img = new Image();
if (corsMode)
img.crossOrigin = corsMode;
img.src = url;
return new Promise((resolve, reject) => {
img.onload = shoudLoad ? resolve : reject;
img.onerror = shoudLoad ? reject : resolve;
testDiv.appendChild(img);
}).finally(() => {
testDiv.innerHTML = "";
});
}, title);
}
loadImage("./resources/image.py?corp=same-origin", ok, noCors,
"Same-origin image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
loadImage("./resources/image.py?corp=same-site", ok, noCors,
"Same-origin image load with a 'Cross-Origin-Resource-Policy: same-site' response header.");
loadImage(notSameSiteBaseURL + "resources/image.py?corp=same-origin&acao=*", ok, "anonymous",
"Cross-origin cors image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
loadImage(notSameSiteBaseURL + "resources/image.py?corp=same-site&acao=*", ok, "anonymous",
"Cross-origin cors image load with a 'Cross-Origin-Resource-Policy: same-site' response header.");
loadImage(notSameSiteBaseURL + "resources/image.py?corp=same-origin&acao=*", ko, noCors,
"Cross-origin no-cors image load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
loadImage(notSameSiteBaseURL + "resources/image.py?corp=same-site&acao=*", ko, noCors,
"Cross-origin no-cors image load with a 'Cross-Origin-Resource-Policy: same-site' response header.");
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 B

View file

@ -0,0 +1,6 @@
def main(request, response):
headers = [("Cross-Origin-Resource-Policy", request.GET['corp'])]
if 'origin' in request.headers:
headers.append(('Access-Control-Allow-Origin', request.headers['origin']))
return 200, headers, "hello"

View file

@ -0,0 +1,5 @@
def main(request, response):
headers = [("Content-Type", "text/html"),
("Cross-Origin-Resource-Policy", request.GET['corp'])]
return 200, headers, "<body><h3>The iframe</h3><script>window.onmessage = () => { parent.postMessage('pong', '*'); }</script></body>"

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<script>
function processMessage(event)
{
fetch(event.data, { mode: "no-cors" }).then(() => {
parent.postMessage("ok", "*");
}, () => {
parent.postMessage("ko", "*");
});
}
window.addEventListener("message", processMessage, false);
</script>
</head>
<body>
<h3>The iframe making a same origin fetch call.</h3>
</body>
</html>

View file

@ -0,0 +1,20 @@
import os.path
def main(request, response):
type = request.GET.first("type", None)
body = open(os.path.join(os.path.dirname(__file__), "green.png"), "rb").read()
response.add_required_headers = False
response.writer.write_status(200)
if 'corp' in request.GET:
response.writer.write_header("cross-origin-resource-policy", request.GET['corp'])
if 'acao' in request.GET:
response.writer.write_header("access-control-allow-origin", request.GET['acao'])
response.writer.write_header("content-length", len(body))
if(type != None):
response.writer.write_header("content-type", type)
response.writer.end_headers()
response.writer.write(body)

View file

@ -0,0 +1,6 @@
def main(request, response):
headers = [("Location", request.GET['redirectTo'])]
if 'corp' in request.GET:
headers.append(('Cross-Origin-Resource-Policy', request.GET['corp']))
return 302, headers, ""

View file

@ -0,0 +1,6 @@
def main(request, response):
headers = [("Cross-Origin-Resource-Policy", request.GET['corp'])]
if 'origin' in request.headers:
headers.append(('Access-Control-Allow-Origin', request.headers['origin']))
return 200, headers, ""

View file

@ -0,0 +1,7 @@
// META: script=/common/get-host-info.sub.js
promise_test(t => {
return promise_rejects(t,
new TypeError(),
fetch(get_host_info().HTTPS_REMOTE_ORIGIN + "/fetch/cross-origin-resource-policy/resources/hello.py?corp=same-site", { mode: "no-cors" }));
}, "Cross-Origin-Resource-Policy: same-site blocks retrieving HTTPS from HTTP");

View file

@ -0,0 +1,13 @@
// META: script=/common/get-host-info.sub.js
promise_test(t => {
const img = new Image();
img.src = get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/cross-origin-resource-policy/resources/image.py?corp=same-site";
return new Promise((resolve, reject) => {
img.onload = resolve;
img.onerror = reject;
document.body.appendChild(img);
}).finally(() => {
img.remove();
});
}, "Cross-Origin-Resource-Policy does not block Mixed Content <img>");

View file

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
</head>
<body>
<div id="testDiv"></div>
<script>
const host = get_host_info();
const notSameSiteBaseURL = host.HTTP_NOTSAMESITE_ORIGIN + window.location.pathname.replace(/\/[^\/]*$/, '/') ;
const ok = true;
const ko = false;
const noCors = false;
function loadScript(url, shoudLoad, corsMode, title)
{
promise_test(() => {
const script = document.createElement("script");
if (corsMode)
script.crossOrigin = corsMode;
script.src = url;
return new Promise((resolve, reject) => {
script.onload = shoudLoad ? resolve : reject;
script.onerror = shoudLoad ? reject : resolve;
testDiv.appendChild(script);
});
}, title);
}
loadScript("./resources/script.py?corp=same-origin", ok, noCors,
"Same-origin script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
loadScript("./resources/script.py?corp=same-site", ok, noCors,
"Same-origin script load with a 'Cross-Origin-Resource-Policy: same-site' response header.");
loadScript(notSameSiteBaseURL + "resources/script.py?corp=same-origin&acao=*", ok, "anonymous",
"Cross-origin cors script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
loadScript(notSameSiteBaseURL + "resources/script.py?corp=same-site&acao=*", ok, "anonymous",
"Cross-origin cors script load with a 'Cross-Origin-Resource-Policy: same-site' response header.");
loadScript(notSameSiteBaseURL + "resources/script.py?corp=same-origin&acao=*", ko, noCors,
"Cross-origin no-cors script load with a 'Cross-Origin-Resource-Policy: same-origin' response header.");
loadScript(notSameSiteBaseURL + "resources/script.py?corp=same-site&acao=*", ko, noCors,
"Cross-origin no-cors script load with a 'Cross-Origin-Resource-Policy: same-site' response header.");
</script>
</body>
</html>

View file

@ -0,0 +1,18 @@
// META: script=/common/get-host-info.sub.js
const crossOriginURL = get_host_info().HTTP_REMOTE_ORIGIN + "/fetch/cross-origin-resource-policy/resources/hello.py?corp=";
[
"same",
"same, same-origin",
"SAME-ORIGIN",
"Same-Origin",
"same-origin, <>",
"same-origin, same-origin"
].forEach(incorrectHeaderValue => {
// Note: an incorrect value results in a successful load, so this test is only meaningful in
// implementations with support for the header.
promise_test(t => {
return fetch(crossOriginURL + encodeURIComponent(incorrectHeaderValue), { mode: "no-cors" });
}, "Parsing Cross-Origin-Resource-Policy: " + incorrectHeaderValue);
});

View file

@ -0,0 +1,3 @@
suggested_reviewers:
- SummerLW
- NavidZ

View file

@ -1,2 +0,0 @@
@SummerLW
@NavidZ

View file

@ -0,0 +1,8 @@
dictionary PointerEventInit : MouseEventInit {
sequence<PointerEvent> coalescedEvents;
};
[Constructor(DOMString type, optional PointerEventInit eventInitDict)]
interface PointerEvent : MouseEvent {
sequence<PointerEvent> getCoalescedEvents();
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.align.default</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.align.default</h1>
<p class="desc"></p>
<script>
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
t.done();
});
</script>

View file

@ -0,0 +1,20 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.align.default
// Description:
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.align.invalid</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.align.invalid</h1>
<p class="desc"></p>
<script>
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.textAlign = 'start';
ctx.textAlign = 'bogus';
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
ctx.textAlign = 'start';
ctx.textAlign = 'END';
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
ctx.textAlign = 'start';
ctx.textAlign = 'end ';
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
ctx.textAlign = 'start';
ctx.textAlign = 'end\0';
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.align.invalid
// Description:
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.textAlign = 'start';
ctx.textAlign = 'bogus';
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
ctx.textAlign = 'start';
ctx.textAlign = 'END';
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
ctx.textAlign = 'start';
ctx.textAlign = 'end ';
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
ctx.textAlign = 'start';
ctx.textAlign = 'end\0';
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
t.done();
});
done();

View file

@ -0,0 +1,37 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.align.valid</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.align.valid</h1>
<p class="desc"></p>
<script>
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.textAlign = 'start';
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
ctx.textAlign = 'end';
_assertSame(ctx.textAlign, 'end', "ctx.textAlign", "'end'");
ctx.textAlign = 'left';
_assertSame(ctx.textAlign, 'left', "ctx.textAlign", "'left'");
ctx.textAlign = 'right';
_assertSame(ctx.textAlign, 'right', "ctx.textAlign", "'right'");
ctx.textAlign = 'center';
_assertSame(ctx.textAlign, 'center', "ctx.textAlign", "'center'");
t.done();
});
</script>

View file

@ -0,0 +1,33 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.align.valid
// Description:
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.textAlign = 'start';
_assertSame(ctx.textAlign, 'start', "ctx.textAlign", "'start'");
ctx.textAlign = 'end';
_assertSame(ctx.textAlign, 'end', "ctx.textAlign", "'end'");
ctx.textAlign = 'left';
_assertSame(ctx.textAlign, 'left', "ctx.textAlign", "'left'");
ctx.textAlign = 'right';
_assertSame(ctx.textAlign, 'right', "ctx.textAlign", "'right'");
ctx.textAlign = 'center';
_assertSame(ctx.textAlign, 'center', "ctx.textAlign", "'center'");
t.done();
});
done();

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.baseline.default</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.baseline.default</h1>
<p class="desc"></p>
<script>
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
_assertSame(ctx.textBaseline, 'alphabetic', "ctx.textBaseline", "'alphabetic'");
t.done();
});
</script>

View file

@ -0,0 +1,20 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.baseline.default
// Description:
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
_assertSame(ctx.textBaseline, 'alphabetic', "ctx.textBaseline", "'alphabetic'");
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.baseline.invalid</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.baseline.invalid</h1>
<p class="desc"></p>
<script>
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.textBaseline = 'top';
ctx.textBaseline = 'bogus';
_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'");
ctx.textBaseline = 'top';
ctx.textBaseline = 'MIDDLE';
_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'");
ctx.textBaseline = 'top';
ctx.textBaseline = 'middle ';
_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'");
ctx.textBaseline = 'top';
ctx.textBaseline = 'middle\0';
_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'");
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.baseline.invalid
// Description:
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.textBaseline = 'top';
ctx.textBaseline = 'bogus';
_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'");
ctx.textBaseline = 'top';
ctx.textBaseline = 'MIDDLE';
_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'");
ctx.textBaseline = 'top';
ctx.textBaseline = 'middle ';
_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'");
ctx.textBaseline = 'top';
ctx.textBaseline = 'middle\0';
_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'");
t.done();
});
done();

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.baseline.valid</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.baseline.valid</h1>
<p class="desc"></p>
<script>
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.textBaseline = 'top';
_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'");
ctx.textBaseline = 'hanging';
_assertSame(ctx.textBaseline, 'hanging', "ctx.textBaseline", "'hanging'");
ctx.textBaseline = 'middle';
_assertSame(ctx.textBaseline, 'middle', "ctx.textBaseline", "'middle'");
ctx.textBaseline = 'alphabetic';
_assertSame(ctx.textBaseline, 'alphabetic', "ctx.textBaseline", "'alphabetic'");
ctx.textBaseline = 'ideographic';
_assertSame(ctx.textBaseline, 'ideographic', "ctx.textBaseline", "'ideographic'");
ctx.textBaseline = 'bottom';
_assertSame(ctx.textBaseline, 'bottom', "ctx.textBaseline", "'bottom'");
t.done();
});
</script>

View file

@ -0,0 +1,36 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.baseline.valid
// Description:
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.textBaseline = 'top';
_assertSame(ctx.textBaseline, 'top', "ctx.textBaseline", "'top'");
ctx.textBaseline = 'hanging';
_assertSame(ctx.textBaseline, 'hanging', "ctx.textBaseline", "'hanging'");
ctx.textBaseline = 'middle';
_assertSame(ctx.textBaseline, 'middle', "ctx.textBaseline", "'middle'");
ctx.textBaseline = 'alphabetic';
_assertSame(ctx.textBaseline, 'alphabetic', "ctx.textBaseline", "'alphabetic'");
ctx.textBaseline = 'ideographic';
_assertSame(ctx.textBaseline, 'ideographic', "ctx.textBaseline", "'ideographic'");
ctx.textBaseline = 'bottom';
_assertSame(ctx.textBaseline, 'bottom', "ctx.textBaseline", "'bottom'");
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.align.center</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.align.center</h1>
<p class="desc">textAlign center is the center of the em squares (not the bounding box)</p>
<script>
var t = async_test("textAlign center is the center of the em squares (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'center';
ctx.fillText('DD', 50, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.align.center
// Description:textAlign center is the center of the em squares (not the bounding box)
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("textAlign center is the center of the em squares (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'center';
ctx.fillText('DD', 50, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.align.end.ltr</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.align.end.ltr</h1>
<p class="desc">textAlign end with ltr is the right edge</p>
<script>
var t = async_test("textAlign end with ltr is the right edge");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'end';
ctx.fillText('DD', 100, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.align.end.ltr
// Description:textAlign end with ltr is the right edge
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("textAlign end with ltr is the right edge");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'end';
ctx.fillText('DD', 100, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.align.end.rtl</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.align.end.rtl</h1>
<p class="desc">textAlign end with rtl is the left edge</p>
<script>
var t = async_test("textAlign end with rtl is the left edge");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'end';
ctx.fillText('DD', 0, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.align.end.rtl
// Description:textAlign end with rtl is the left edge
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("textAlign end with rtl is the left edge");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'end';
ctx.fillText('DD', 0, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.align.left</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.align.left</h1>
<p class="desc">textAlign left is the left of the first em square (not the bounding box)</p>
<script>
var t = async_test("textAlign left is the left of the first em square (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'left';
ctx.fillText('DD', 0, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.align.left
// Description:textAlign left is the left of the first em square (not the bounding box)
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("textAlign left is the left of the first em square (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'left';
ctx.fillText('DD', 0, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.align.right</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.align.right</h1>
<p class="desc">textAlign right is the right of the last em square (not the bounding box)</p>
<script>
var t = async_test("textAlign right is the right of the last em square (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'right';
ctx.fillText('DD', 100, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.align.right
// Description:textAlign right is the right of the last em square (not the bounding box)
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("textAlign right is the right of the last em square (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'right';
ctx.fillText('DD', 100, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.align.start.ltr</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.align.start.ltr</h1>
<p class="desc">textAlign start with ltr is the left edge</p>
<script>
var t = async_test("textAlign start with ltr is the left edge");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'start';
ctx.fillText('DD', 0, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.align.start.ltr
// Description:textAlign start with ltr is the left edge
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("textAlign start with ltr is the left edge");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'start';
ctx.fillText('DD', 0, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.align.start.rtl</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.align.start.rtl</h1>
<p class="desc">textAlign start with rtl is the right edge</p>
<script>
var t = async_test("textAlign start with rtl is the right edge");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'start';
ctx.fillText('DD', 100, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.align.start.rtl
// Description:textAlign start with rtl is the right edge
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("textAlign start with rtl is the right edge");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textAlign = 'start';
ctx.fillText('DD', 100, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.baseline.alphabetic</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.baseline.alphabetic</h1>
<p class="desc"></p>
<script>
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'alphabetic';
ctx.fillText('CC', 0, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.baseline.alphabetic
// Description:
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'alphabetic';
ctx.fillText('CC', 0, 37.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.baseline.bottom</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.baseline.bottom</h1>
<p class="desc">textBaseline bottom is the bottom of the em square (not the bounding box)</p>
<script>
var t = async_test("textBaseline bottom is the bottom of the em square (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'bottom';
ctx.fillText('CC', 0, 50);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.baseline.bottom
// Description:textBaseline bottom is the bottom of the em square (not the bounding box)
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("textBaseline bottom is the bottom of the em square (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'bottom';
ctx.fillText('CC', 0, 50);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.baseline.hanging</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.baseline.hanging</h1>
<p class="desc"></p>
<script>
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'hanging';
ctx.fillText('CC', 0, 12.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.baseline.hanging
// Description:
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'hanging';
ctx.fillText('CC', 0, 12.5);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.baseline.ideographic</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.baseline.ideographic</h1>
<p class="desc"></p>
<script>
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'ideographic';
ctx.fillText('CC', 0, 31.25);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.baseline.ideographic
// Description:
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'ideographic';
ctx.fillText('CC', 0, 31.25);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.baseline.middle</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.baseline.middle</h1>
<p class="desc">textBaseline middle is the middle of the em square (not the bounding box)</p>
<script>
var t = async_test("textBaseline middle is the middle of the em square (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'middle';
ctx.fillText('CC', 0, 25);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.baseline.middle
// Description:textBaseline middle is the middle of the em square (not the bounding box)
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("textBaseline middle is the middle of the em square (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'middle';
ctx.fillText('CC', 0, 25);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,38 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.baseline.top</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.baseline.top</h1>
<p class="desc">textBaseline top is the top of the em square (not the bounding box)</p>
<script>
var t = async_test("textBaseline top is the top of the em square (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'top';
ctx.fillText('CC', 0, 0);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
</script>

View file

@ -0,0 +1,34 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.baseline.top
// Description:textBaseline top is the top of the em square (not the bounding box)
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("textBaseline top is the top of the em square (not the bounding box)");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.font = '50px CanvasTest';
deferTest();
step_timeout(t.step_func_done(function () {
ctx.fillStyle = '#f00';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.textBaseline = 'top';
ctx.fillText('CC', 0, 0);
_assertPixelApprox(offscreenCanvas, 5,5, 0,255,0,255, "5,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,5, 0,255,0,255, "95,5", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 25,25, 0,255,0,255, "25,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 75,25, 0,255,0,255, "75,25", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 5,45, 0,255,0,255, "5,45", "0,255,0,255", 2);
_assertPixelApprox(offscreenCanvas, 95,45, 0,255,0,255, "95,45", "0,255,0,255", 2);
}), 500);
t.done();
});
done();

View file

@ -0,0 +1,29 @@
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.draw.fill.basic</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.draw.fill.basic</h1>
<p class="desc">fillText draws filled text</p>
<script>
var t = async_test("fillText draws filled text");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.fillStyle = '#000';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.strokeStyle = '#f00';
ctx.font = '35px Arial, sans-serif';
ctx.fillText('PASS', 5, 35);
t.done();
});
</script>

View file

@ -0,0 +1,25 @@
// DO NOT EDIT! This test has been generated by tools/gentest.py.
// OffscreenCanvas test in a worker:2d.text.draw.fill.basic
// Description:fillText draws filled text
// Note:
importScripts("/resources/testharness.js");
importScripts("/common/canvas-tests.js");
var t = async_test("fillText draws filled text");
t.step(function() {
var offscreenCanvas = new OffscreenCanvas(100, 50);
var ctx = offscreenCanvas.getContext('2d');
ctx.fillStyle = '#000';
ctx.fillRect(0, 0, 100, 50);
ctx.fillStyle = '#0f0';
ctx.strokeStyle = '#f00';
ctx.font = '35px Arial, sans-serif';
ctx.fillText('PASS', 5, 35);
t.done();
});
done();

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