Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /html/canvas/element/text/2d.text.drawing.style.fontStretch.settings.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<meta charset="UTF-8">
<title>Canvas test: 2d.text.drawing.style.fontStretch.settings</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/html/canvas/resources/canvas-tests.js"></script>
<link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css">
<body class="show_output">
<h1>2d.text.drawing.style.fontStretch.settings</h1>
<p class="desc">Testing value setting of fontStretch in Canvas</p>
<p class="output">Actual output:</p>
<canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
<ul id="d"></ul>
<script>
var t = async_test("Testing value setting of fontStretch in Canvas");
_addTest(function(canvas, ctx) {
// Setting fontStretch with lower cases
ctx.fontStretch = "ultra-condensed";
_assertSame(ctx.fontStretch, "ultra-condensed", "ctx.fontStretch", "\"ultra-condensed\"");
ctx.fontStretch = "extra-condensed";
_assertSame(ctx.fontStretch, "extra-condensed", "ctx.fontStretch", "\"extra-condensed\"");
ctx.fontStretch = "condensed";
_assertSame(ctx.fontStretch, "condensed", "ctx.fontStretch", "\"condensed\"");
ctx.fontStretch = "semi-condensed";
_assertSame(ctx.fontStretch, "semi-condensed", "ctx.fontStretch", "\"semi-condensed\"");
ctx.fontStretch = "normal";
_assertSame(ctx.fontStretch, "normal", "ctx.fontStretch", "\"normal\"");
ctx.fontStretch = "semi-expanded";
_assertSame(ctx.fontStretch, "semi-expanded", "ctx.fontStretch", "\"semi-expanded\"");
ctx.fontStretch = "expanded";
_assertSame(ctx.fontStretch, "expanded", "ctx.fontStretch", "\"expanded\"");
ctx.fontStretch = "extra-expanded";
_assertSame(ctx.fontStretch, "extra-expanded", "ctx.fontStretch", "\"extra-expanded\"");
ctx.fontStretch = "ultra-expanded";
_assertSame(ctx.fontStretch, "ultra-expanded", "ctx.fontStretch", "\"ultra-expanded\"");
// Setting fontStretch with lower cases and upper cases word,
// these values should be ignored.
ctx.fontStretch = "ulTra-condensed";
_assertSame(ctx.fontStretch, "ultra-expanded", "ctx.fontStretch", "\"ultra-expanded\"");
ctx.fontStretch = "Extra-condensed";
_assertSame(ctx.fontStretch, "ultra-expanded", "ctx.fontStretch", "\"ultra-expanded\"");
ctx.fontStretch = "cOndensed";
_assertSame(ctx.fontStretch, "ultra-expanded", "ctx.fontStretch", "\"ultra-expanded\"");
ctx.fontStretch = "Semi-Condensed";
_assertSame(ctx.fontStretch, "ultra-expanded", "ctx.fontStretch", "\"ultra-expanded\"");
ctx.fontStretch = "normaL";
_assertSame(ctx.fontStretch, "ultra-expanded", "ctx.fontStretch", "\"ultra-expanded\"");
ctx.fontStretch = "semi-Expanded";
_assertSame(ctx.fontStretch, "ultra-expanded", "ctx.fontStretch", "\"ultra-expanded\"");
ctx.fontStretch = "Expanded";
_assertSame(ctx.fontStretch, "ultra-expanded", "ctx.fontStretch", "\"ultra-expanded\"");
ctx.fontStretch = "eXtra-expanded";
_assertSame(ctx.fontStretch, "ultra-expanded", "ctx.fontStretch", "\"ultra-expanded\"");
ctx.fontStretch = "abcd";
_assertSame(ctx.fontStretch, "ultra-expanded", "ctx.fontStretch", "\"ultra-expanded\"");
});
</script>