summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/canvas/canvas-text-space-characters.html
blob: b42f32855a513fbc311f6ea363e8962382f255c6 (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
<!DOCTYPE html>
<html>
<head>
  <meta charcode="utf-16">
  <script src="../../resources/js-test.js"></script>
</head>
<body>
  <canvas></canvas>
  <script>

    if (window.testRunner)
      testRunner.dumpAsTextWithPixelResults();

    var canvas = document.querySelector("canvas");
    var context = canvas.getContext("2d");

    var testStr1 = 'a' + '\u0009' + 'b' + '\u000A' + 'c' + '\u000C' + 'd' + '\u000D' + 'e';
    var testStr2 = 'a' + '\u0020' + 'b' + '\u0020' + 'c' + '\u0020' + 'd' + '\u0020' + 'e';

    context.font = "12px Arial";
    context.fillText(testStr1, 0, 10);
    context.fillText(testStr2, 0, 30);

    testStr1Width = context.measureText(testStr1).width;
    testStr2Width = context.measureText(testStr2).width;

    shouldBeTrue("testStr1Width == testStr2Width");

  </script>
</body>
</html>