Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=
5 -->
6 <head>
7 <title>Test for Bug </title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
13 <canvas id="display" height="200" width="200"></canvas>
14 <pre id="test">
15 <script type="application/javascript">
17 var canvas = document.getElementById("display");
18 var cx = canvas.getContext("2d");
20 is(cx.font, "10px sans-serif", "initial font of canvas context");
22 cx.font = "italic 16px sans-serif";
23 is(cx.font, "italic 16px sans-serif", "valid font should round-trip");
24 cx.font = "bold 12px serif; background: green";
25 is(cx.font, "italic 16px sans-serif", "invalid font should be ignored");
27 cx.font = "bold 12px/3.0 serif";
28 is(cx.font, "bold 12px serif", "line-height should be dropped");
29 cx.font = "inherit";
30 is(cx.font, "bold 12px serif", "inherit should be ignored");
31 cx.font = "boold 18px sans-serif";
32 is(cx.font, "bold 12px serif", "syntax error should be ignored");
33 cx.font = "menu";
34 todo_is(cx.font, "menu", "system fonts should work");
36 function textmeas() {
37 return cx.measureText("hello").width;
38 }
40 cx.font = "66px serif";
41 var w_at_66 = textmeas();
42 cx.font = "20px serif";
43 var w_at_20 = textmeas();
44 ok(w_at_66 > w_at_20, "text should be wider at 66px than at 20px");
46 canvas.style.fontSize = "33px";
47 cx.font = "2em serif";
48 is(cx.font, "2em serif", "serialization of em");
49 is(textmeas(), w_at_66, "em should be relative to canvas font size");
50 canvas.style.fontSize = "16px";
51 is(cx.font, "2em serif", "serialization of em");
52 is(textmeas(), w_at_66,
53 "em should be relative to canvas font size at time of setting");
54 document.body.removeChild(canvas);
55 is(cx.font, "2em serif", "serialization of em");
56 is(textmeas(), w_at_66,
57 "em should be relative to canvas font size at time of setting");
58 canvas.style.fontSize = "33px";
59 cx.font = "2em serif";
60 is(cx.font, "2em serif", "serialization of em");
61 is(textmeas(), w_at_20,
62 "em should be relative to 10px when canvas not in document");
63 document.body.appendChild(canvas);
65 </script>
66 </pre>
67 </body>
68 </html>