servo/tests/wpt/web-platform-tests/offscreen-canvas/text/2d.text.measure.width.empty.html

28 lines
791 B
HTML

<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by tools/gentest.py. -->
<title>OffscreenCanvas test: 2d.text.measure.width.empty</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<h1>2d.text.measure.width.empty</h1>
<p class="desc">The empty string has zero width</p>
<script>
var t = async_test("The empty string has zero width");
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);
t.done();
});
</script>