summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/canvas/element/text/2d.text.drawing.style.fontStretch.settings.html
blob: b19eced89171199dcfb57f1d5aea4b8f7e83c427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. -->
<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 textRendering 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>