mirror of
https://github.com/servo/servo.git
synced 2025-08-18 03:45:33 +01:00
Update web-platform-tests to revision ea852ede3b4e0632fd453ed520b26b22692c2d92
This commit is contained in:
parent
2ab23c79a7
commit
92fa6ede85
109 changed files with 2169 additions and 873 deletions
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>OffscreenCanvas test: 2d.text.measure.actualBoundingBox</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.text.measure.actualBoundingBox</h1>
|
||||
<p class="desc">Testing actualBoundingBox for OffscreenCanvas</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("Testing actualBoundingBox for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
ctx.direction = 'ltr';
|
||||
ctx.align = 'left'
|
||||
ctx.baseline = 'alphabetic'
|
||||
// Some platforms may return '-0'.
|
||||
_assertSame(Math.abs(ctx.measureText('A').actualBoundingBoxLeft), 0, "Math.abs(ctx.measureText('A').actualBoundingBoxLeft)", "0");
|
||||
// Different platforms may render text slightly different.
|
||||
_assert(ctx.measureText('A').actualBoundingBoxRight >= 50, "ctx.measureText('A').actualBoundingBoxRight >= 50");
|
||||
_assert(ctx.measureText('A').actualBoundingBoxAscent >= 35, "ctx.measureText('A').actualBoundingBoxAscent >= 35");
|
||||
_assertSame(Math.abs(ctx.measureText('A').actualBoundingBoxDescent), 0, "Math.abs(ctx.measureText('A').actualBoundingBoxDescent)", "0");
|
||||
|
||||
_assertSame(Math.abs(ctx.measureText('ABCD').actualBoundingBoxLeft), 0, "Math.abs(ctx.measureText('ABCD').actualBoundingBoxLeft)", "0");
|
||||
_assert(ctx.measureText('ABCD').actualBoundingBoxRight >= 200, "ctx.measureText('ABCD').actualBoundingBoxRight >= 200");
|
||||
_assert(ctx.measureText('ABCD').actualBoundingBoxAscent >= 85, "ctx.measureText('ABCD').actualBoundingBoxAscent >= 85");
|
||||
_assert(ctx.measureText('ABCD').actualBoundingBoxDescent >= 37, "ctx.measureText('ABCD').actualBoundingBoxDescent >= 37");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,42 @@
|
|||
// DO NOT EDIT! This test has been generated by tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.text.measure.actualBoundingBox
|
||||
// Description:Testing actualBoundingBox for OffscreenCanvas
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/common/canvas-tests.js");
|
||||
|
||||
var t = async_test("Testing actualBoundingBox for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
ctx.direction = 'ltr';
|
||||
ctx.align = 'left'
|
||||
ctx.baseline = 'alphabetic'
|
||||
// Some platforms may return '-0'.
|
||||
_assertSame(Math.abs(ctx.measureText('A').actualBoundingBoxLeft), 0, "Math.abs(ctx.measureText('A').actualBoundingBoxLeft)", "0");
|
||||
// Different platforms may render text slightly different.
|
||||
_assert(ctx.measureText('A').actualBoundingBoxRight >= 50, "ctx.measureText('A').actualBoundingBoxRight >= 50");
|
||||
_assert(ctx.measureText('A').actualBoundingBoxAscent >= 35, "ctx.measureText('A').actualBoundingBoxAscent >= 35");
|
||||
_assertSame(Math.abs(ctx.measureText('A').actualBoundingBoxDescent), 0, "Math.abs(ctx.measureText('A').actualBoundingBoxDescent)", "0");
|
||||
|
||||
_assertSame(Math.abs(ctx.measureText('ABCD').actualBoundingBoxLeft), 0, "Math.abs(ctx.measureText('ABCD').actualBoundingBoxLeft)", "0");
|
||||
_assert(ctx.measureText('ABCD').actualBoundingBoxRight >= 200, "ctx.measureText('ABCD').actualBoundingBoxRight >= 200");
|
||||
_assert(ctx.measureText('ABCD').actualBoundingBoxAscent >= 85, "ctx.measureText('ABCD').actualBoundingBoxAscent >= 85");
|
||||
_assert(ctx.measureText('ABCD').actualBoundingBoxDescent >= 37, "ctx.measureText('ABCD').actualBoundingBoxDescent >= 37");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
});
|
||||
done();
|
|
@ -0,0 +1,48 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>OffscreenCanvas test: 2d.text.measure.advances</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.text.measure.advances</h1>
|
||||
<p class="desc">Testing width advances for OffscreenCanvas</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("Testing width advances for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
ctx.direction = 'ltr';
|
||||
ctx.align = 'left'
|
||||
// Some platforms may return '-0'.
|
||||
_assertSame(Math.abs(ctx.measureText('Hello').advances[0]), 0, "Math.abs(ctx.measureText('Hello').advances[\""+(0)+"\"])", "0");
|
||||
// Different platforms may render text slightly different.
|
||||
_assert(ctx.measureText('Hello').advances[1] >= 36, "ctx.measureText('Hello').advances[\""+(1)+"\"] >= 36");
|
||||
_assert(ctx.measureText('Hello').advances[2] >= 58, "ctx.measureText('Hello').advances[\""+(2)+"\"] >= 58");
|
||||
_assert(ctx.measureText('Hello').advances[3] >= 70, "ctx.measureText('Hello').advances[\""+(3)+"\"] >= 70");
|
||||
_assert(ctx.measureText('Hello').advances[4] >= 80, "ctx.measureText('Hello').advances[\""+(4)+"\"] >= 80");
|
||||
|
||||
var tm = ctx.measureText('Hello');
|
||||
_assertSame(ctx.measureText('Hello').advances[0], tm.advances[0], "ctx.measureText('Hello').advances[\""+(0)+"\"]", "tm.advances[\""+(0)+"\"]");
|
||||
_assertSame(ctx.measureText('Hello').advances[1], tm.advances[1], "ctx.measureText('Hello').advances[\""+(1)+"\"]", "tm.advances[\""+(1)+"\"]");
|
||||
_assertSame(ctx.measureText('Hello').advances[2], tm.advances[2], "ctx.measureText('Hello').advances[\""+(2)+"\"]", "tm.advances[\""+(2)+"\"]");
|
||||
_assertSame(ctx.measureText('Hello').advances[3], tm.advances[3], "ctx.measureText('Hello').advances[\""+(3)+"\"]", "tm.advances[\""+(3)+"\"]");
|
||||
_assertSame(ctx.measureText('Hello').advances[4], tm.advances[4], "ctx.measureText('Hello').advances[\""+(4)+"\"]", "tm.advances[\""+(4)+"\"]");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,44 @@
|
|||
// DO NOT EDIT! This test has been generated by tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.text.measure.advances
|
||||
// Description:Testing width advances for OffscreenCanvas
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/common/canvas-tests.js");
|
||||
|
||||
var t = async_test("Testing width advances for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
ctx.direction = 'ltr';
|
||||
ctx.align = 'left'
|
||||
// Some platforms may return '-0'.
|
||||
_assertSame(Math.abs(ctx.measureText('Hello').advances[0]), 0, "Math.abs(ctx.measureText('Hello').advances[\""+(0)+"\"])", "0");
|
||||
// Different platforms may render text slightly different.
|
||||
_assert(ctx.measureText('Hello').advances[1] >= 36, "ctx.measureText('Hello').advances[\""+(1)+"\"] >= 36");
|
||||
_assert(ctx.measureText('Hello').advances[2] >= 58, "ctx.measureText('Hello').advances[\""+(2)+"\"] >= 58");
|
||||
_assert(ctx.measureText('Hello').advances[3] >= 70, "ctx.measureText('Hello').advances[\""+(3)+"\"] >= 70");
|
||||
_assert(ctx.measureText('Hello').advances[4] >= 80, "ctx.measureText('Hello').advances[\""+(4)+"\"] >= 80");
|
||||
|
||||
var tm = ctx.measureText('Hello');
|
||||
_assertSame(ctx.measureText('Hello').advances[0], tm.advances[0], "ctx.measureText('Hello').advances[\""+(0)+"\"]", "tm.advances[\""+(0)+"\"]");
|
||||
_assertSame(ctx.measureText('Hello').advances[1], tm.advances[1], "ctx.measureText('Hello').advances[\""+(1)+"\"]", "tm.advances[\""+(1)+"\"]");
|
||||
_assertSame(ctx.measureText('Hello').advances[2], tm.advances[2], "ctx.measureText('Hello').advances[\""+(2)+"\"]", "tm.advances[\""+(2)+"\"]");
|
||||
_assertSame(ctx.measureText('Hello').advances[3], tm.advances[3], "ctx.measureText('Hello').advances[\""+(3)+"\"]", "tm.advances[\""+(3)+"\"]");
|
||||
_assertSame(ctx.measureText('Hello').advances[4], tm.advances[4], "ctx.measureText('Hello').advances[\""+(4)+"\"]", "tm.advances[\""+(4)+"\"]");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
});
|
||||
done();
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>OffscreenCanvas test: 2d.text.measure.baselines</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.text.measure.baselines</h1>
|
||||
<p class="desc">Testing baselines for OffscreenCanvas</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("Testing baselines for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
ctx.direction = 'ltr';
|
||||
ctx.align = 'left'
|
||||
_assertSame(Math.abs(ctx.measureText('A').getBaselines().alphabetic), 0, "Math.abs(ctx.measureText('A').getBaselines().alphabetic)", "0");
|
||||
_assertSame(ctx.measureText('A').getBaselines().ideographic, -39, "ctx.measureText('A').getBaselines().ideographic", "-39");
|
||||
_assertSame(ctx.measureText('A').getBaselines().hanging, 68, "ctx.measureText('A').getBaselines().hanging", "68");
|
||||
|
||||
_assertSame(Math.abs(ctx.measureText('ABCD').getBaselines().alphabetic), 0, "Math.abs(ctx.measureText('ABCD').getBaselines().alphabetic)", "0");
|
||||
_assertSame(ctx.measureText('ABCD').getBaselines().ideographic, -39, "ctx.measureText('ABCD').getBaselines().ideographic", "-39");
|
||||
_assertSame(ctx.measureText('ABCD').getBaselines().hanging, 68, "ctx.measureText('ABCD').getBaselines().hanging", "68");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,37 @@
|
|||
// DO NOT EDIT! This test has been generated by tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.text.measure.baselines
|
||||
// Description:Testing baselines for OffscreenCanvas
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/common/canvas-tests.js");
|
||||
|
||||
var t = async_test("Testing baselines for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
ctx.direction = 'ltr';
|
||||
ctx.align = 'left'
|
||||
_assertSame(Math.abs(ctx.measureText('A').getBaselines().alphabetic), 0, "Math.abs(ctx.measureText('A').getBaselines().alphabetic)", "0");
|
||||
_assertSame(ctx.measureText('A').getBaselines().ideographic, -39, "ctx.measureText('A').getBaselines().ideographic", "-39");
|
||||
_assertSame(ctx.measureText('A').getBaselines().hanging, 68, "ctx.measureText('A').getBaselines().hanging", "68");
|
||||
|
||||
_assertSame(Math.abs(ctx.measureText('ABCD').getBaselines().alphabetic), 0, "Math.abs(ctx.measureText('ABCD').getBaselines().alphabetic)", "0");
|
||||
_assertSame(ctx.measureText('ABCD').getBaselines().ideographic, -39, "ctx.measureText('ABCD').getBaselines().ideographic", "-39");
|
||||
_assertSame(ctx.measureText('ABCD').getBaselines().hanging, 68, "ctx.measureText('ABCD').getBaselines().hanging", "68");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
});
|
||||
done();
|
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>OffscreenCanvas test: 2d.text.measure.emHeights</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.text.measure.emHeights</h1>
|
||||
<p class="desc">Testing emHeights for OffscreenCanvas</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("Testing emHeights for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
ctx.direction = 'ltr';
|
||||
ctx.align = 'left'
|
||||
_assertSame(ctx.measureText('A').emHeightAscent, 37.5, "ctx.measureText('A').emHeightAscent", "37.5");
|
||||
_assertSame(ctx.measureText('A').emHeightDescent, 12.5, "ctx.measureText('A').emHeightDescent", "12.5");
|
||||
_assertSame(ctx.measureText('A').emHeightDescent + ctx.measureText('A').emHeightAscent, 50, "ctx.measureText('A').emHeightDescent + ctx.measureText('A').emHeightAscent", "50");
|
||||
|
||||
_assertSame(ctx.measureText('ABCD').emHeightAscent, 37.5, "ctx.measureText('ABCD').emHeightAscent", "37.5");
|
||||
_assertSame(ctx.measureText('ABCD').emHeightDescent, 12.5, "ctx.measureText('ABCD').emHeightDescent", "12.5");
|
||||
_assertSame(ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent, 50, "ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent", "50");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,37 @@
|
|||
// DO NOT EDIT! This test has been generated by tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.text.measure.emHeights
|
||||
// Description:Testing emHeights for OffscreenCanvas
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/common/canvas-tests.js");
|
||||
|
||||
var t = async_test("Testing emHeights for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
ctx.direction = 'ltr';
|
||||
ctx.align = 'left'
|
||||
_assertSame(ctx.measureText('A').emHeightAscent, 37.5, "ctx.measureText('A').emHeightAscent", "37.5");
|
||||
_assertSame(ctx.measureText('A').emHeightDescent, 12.5, "ctx.measureText('A').emHeightDescent", "12.5");
|
||||
_assertSame(ctx.measureText('A').emHeightDescent + ctx.measureText('A').emHeightAscent, 50, "ctx.measureText('A').emHeightDescent + ctx.measureText('A').emHeightAscent", "50");
|
||||
|
||||
_assertSame(ctx.measureText('ABCD').emHeightAscent, 37.5, "ctx.measureText('ABCD').emHeightAscent", "37.5");
|
||||
_assertSame(ctx.measureText('ABCD').emHeightDescent, 12.5, "ctx.measureText('ABCD').emHeightDescent", "12.5");
|
||||
_assertSame(ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent, 50, "ctx.measureText('ABCD').emHeightDescent + ctx.measureText('ABCD').emHeightAscent", "50");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
});
|
||||
done();
|
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
|
||||
<title>OffscreenCanvas test: 2d.text.measure.fontBoundingBox</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/common/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.text.measure.fontBoundingBox</h1>
|
||||
<p class="desc">Testing fontBoundingBox for OffscreenCanvas</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("Testing fontBoundingBox for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
ctx.direction = 'ltr';
|
||||
ctx.align = 'left'
|
||||
_assertSame(ctx.measureText('A').fontBoundingBoxAscent, 85, "ctx.measureText('A').fontBoundingBoxAscent", "85");
|
||||
_assertSame(ctx.measureText('A').fontBoundingBoxDescent, 39, "ctx.measureText('A').fontBoundingBoxDescent", "39");
|
||||
|
||||
_assertSame(ctx.measureText('ABCD').fontBoundingBoxAscent, 85, "ctx.measureText('ABCD').fontBoundingBoxAscent", "85");
|
||||
_assertSame(ctx.measureText('ABCD').fontBoundingBoxDescent, 39, "ctx.measureText('ABCD').fontBoundingBoxDescent", "39");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
});
|
||||
</script>
|
|
@ -0,0 +1,35 @@
|
|||
// DO NOT EDIT! This test has been generated by tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.text.measure.fontBoundingBox
|
||||
// Description:Testing fontBoundingBox for OffscreenCanvas
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/common/canvas-tests.js");
|
||||
|
||||
var t = async_test("Testing fontBoundingBox for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
ctx.direction = 'ltr';
|
||||
ctx.align = 'left'
|
||||
_assertSame(ctx.measureText('A').fontBoundingBoxAscent, 85, "ctx.measureText('A').fontBoundingBoxAscent", "85");
|
||||
_assertSame(ctx.measureText('A').fontBoundingBoxDescent, 39, "ctx.measureText('A').fontBoundingBoxDescent", "39");
|
||||
|
||||
_assertSame(ctx.measureText('ABCD').fontBoundingBoxAscent, 85, "ctx.measureText('ABCD').fontBoundingBoxAscent", "85");
|
||||
_assertSame(ctx.measureText('ABCD').fontBoundingBoxDescent, 39, "ctx.measureText('ABCD').fontBoundingBoxDescent", "39");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
});
|
||||
done();
|
|
@ -6,26 +6,31 @@
|
|||
<script src="/common/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.text.measure.width.basic</h1>
|
||||
<p class="desc"></p>
|
||||
<p class="desc">The width of character is same as font used for OffscreenCanvas</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("");
|
||||
var t = async_test("The width of character is same as font used for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText('A').width, 50, "ctx.measureText('A').width", "50");
|
||||
_assertSame(ctx.measureText('AA').width, 100, "ctx.measureText('AA').width", "100");
|
||||
_assertSame(ctx.measureText('ABCD').width, 200, "ctx.measureText('ABCD').width", "200");
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText('A').width, 50, "ctx.measureText('A').width", "50");
|
||||
_assertSame(ctx.measureText('AA').width, 100, "ctx.measureText('AA').width", "100");
|
||||
_assertSame(ctx.measureText('ABCD').width, 200, "ctx.measureText('ABCD').width", "200");
|
||||
|
||||
ctx.font = '100px CanvasTest';
|
||||
_assertSame(ctx.measureText('A').width, 100, "ctx.measureText('A').width", "100");
|
||||
}), 500);
|
||||
ctx.font = '100px CanvasTest';
|
||||
_assertSame(ctx.measureText('A').width, 100, "ctx.measureText('A').width", "100");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
|
|
|
@ -1,27 +1,32 @@
|
|||
// DO NOT EDIT! This test has been generated by tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.text.measure.width.basic
|
||||
// Description:
|
||||
// Description:The width of character is same as font used for OffscreenCanvas
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/common/canvas-tests.js");
|
||||
|
||||
var t = async_test("");
|
||||
var t = async_test("The width of character is same as font used for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText('A').width, 50, "ctx.measureText('A').width", "50");
|
||||
_assertSame(ctx.measureText('AA').width, 100, "ctx.measureText('AA').width", "100");
|
||||
_assertSame(ctx.measureText('ABCD').width, 200, "ctx.measureText('ABCD').width", "200");
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText('A').width, 50, "ctx.measureText('A').width", "50");
|
||||
_assertSame(ctx.measureText('AA').width, 100, "ctx.measureText('AA').width", "100");
|
||||
_assertSame(ctx.measureText('ABCD').width, 200, "ctx.measureText('ABCD').width", "200");
|
||||
|
||||
ctx.font = '100px CanvasTest';
|
||||
_assertSame(ctx.measureText('A').width, 100, "ctx.measureText('A').width", "100");
|
||||
}), 500);
|
||||
ctx.font = '100px CanvasTest';
|
||||
_assertSame(ctx.measureText('A').width, 100, "ctx.measureText('A').width", "100");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
|
|
|
@ -6,21 +6,26 @@
|
|||
<script src="/common/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.text.measure.width.empty</h1>
|
||||
<p class="desc">The empty string has zero width</p>
|
||||
<p class="desc">The empty string has zero width for OffscreenCanvas</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("The empty string has zero width");
|
||||
var t = async_test("The empty string has zero width for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText("").width, 0, "ctx.measureText(\"\").width", "0");
|
||||
}), 500);
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText("").width, 0, "ctx.measureText(\"\").width", "0");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
|
|
|
@ -1,22 +1,27 @@
|
|||
// DO NOT EDIT! This test has been generated by tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.text.measure.width.empty
|
||||
// Description:The empty string has zero width
|
||||
// Description:The empty string has zero width for OffscreenCanvas
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/common/canvas-tests.js");
|
||||
|
||||
var t = async_test("The empty string has zero width");
|
||||
var t = async_test("The empty string has zero width for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText("").width, 0, "ctx.measureText(\"\").width", "0");
|
||||
}), 500);
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText("").width, 0, "ctx.measureText(\"\").width", "0");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
|
|
|
@ -6,27 +6,32 @@
|
|||
<script src="/common/canvas-tests.js"></script>
|
||||
|
||||
<h1>2d.text.measure.width.space</h1>
|
||||
<p class="desc">Space characters are converted to U+0020 and collapsed (per CSS)</p>
|
||||
<p class="desc">Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas</p>
|
||||
|
||||
|
||||
<script>
|
||||
var t = async_test("Space characters are converted to U+0020 and collapsed (per CSS)");
|
||||
var t = async_test("Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
|
||||
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
|
||||
_assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150");
|
||||
_assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200");
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
|
||||
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
|
||||
_assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150");
|
||||
_assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200");
|
||||
|
||||
_assertSame(ctx.measureText(' AB').width, 100, "ctx.measureText(' AB').width", "100");
|
||||
_assertSame(ctx.measureText('AB ').width, 100, "ctx.measureText('AB ').width", "100");
|
||||
}), 500);
|
||||
_assertSame(ctx.measureText(' AB').width, 100, "ctx.measureText(' AB').width", "100");
|
||||
_assertSame(ctx.measureText('AB ').width, 100, "ctx.measureText('AB ').width", "100");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
|
|
|
@ -1,28 +1,33 @@
|
|||
// DO NOT EDIT! This test has been generated by tools/gentest.py.
|
||||
// OffscreenCanvas test in a worker:2d.text.measure.width.space
|
||||
// Description:Space characters are converted to U+0020 and collapsed (per CSS)
|
||||
// Description:Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas
|
||||
// Note:
|
||||
|
||||
importScripts("/resources/testharness.js");
|
||||
importScripts("/common/canvas-tests.js");
|
||||
|
||||
var t = async_test("Space characters are converted to U+0020 and collapsed (per CSS)");
|
||||
var t = async_test("Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas");
|
||||
t.step(function() {
|
||||
|
||||
var offscreenCanvas = new OffscreenCanvas(100, 50);
|
||||
var ctx = offscreenCanvas.getContext('2d');
|
||||
|
||||
deferTest();
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
|
||||
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
|
||||
_assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150");
|
||||
_assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200");
|
||||
var f = new FontFace("CanvasTest", "/fonts/CanvasTest.ttf");
|
||||
let fonts = (self.fonts ? self.fonts : document.fonts);
|
||||
fonts.add(f);
|
||||
fonts.ready.then(() => {
|
||||
step_timeout(t.step_func_done(function () {
|
||||
ctx.font = '50px CanvasTest';
|
||||
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
|
||||
_assertSame(ctx.measureText('A B').width, 150, "ctx.measureText('A B').width", "150");
|
||||
_assertSame(ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width, 150, "ctx.measureText('A \\x09\\x0a\\x0c\\x0d \\x09\\x0a\\x0c\\x0dB').width", "150");
|
||||
_assert(ctx.measureText('A \x0b B').width >= 200, "ctx.measureText('A \\x0b B').width >= 200");
|
||||
|
||||
_assertSame(ctx.measureText(' AB').width, 100, "ctx.measureText(' AB').width", "100");
|
||||
_assertSame(ctx.measureText('AB ').width, 100, "ctx.measureText('AB ').width", "100");
|
||||
}), 500);
|
||||
_assertSame(ctx.measureText(' AB').width, 100, "ctx.measureText(' AB').width", "100");
|
||||
_assertSame(ctx.measureText('AB ').width, 100, "ctx.measureText('AB ').width", "100");
|
||||
}), 500);
|
||||
});
|
||||
|
||||
t.done();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue