2d.canvas.host.size.attributes.idl.html (1360B)
1 <!DOCTYPE html> 2 <!-- DO NOT EDIT! This test has been generated by /html/canvas/tools/gentest.py. --> 3 <meta charset="UTF-8"> 4 <title>Canvas test: 2d.canvas.host.size.attributes.idl</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/html/canvas/resources/canvas-tests.js"></script> 8 <link rel="stylesheet" href="/html/canvas/resources/canvas-tests.css"> 9 <body class="show_output"> 10 11 <h1>2d.canvas.host.size.attributes.idl</h1> 12 <p class="desc">Getting/setting width/height IDL attributes</p> 13 14 15 <p class="output">Actual output:</p> 16 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (fallback content)</p></canvas> 17 18 <ul id="d"></ul> 19 <script> 20 var t = async_test("Getting/setting width/height IDL attributes"); 21 _addTest(function(canvas, ctx) { 22 23 canvas.width = '100'; 24 canvas.height = '100'; 25 _assertSame(canvas.width, 100, "canvas.width", "100"); 26 _assertSame(canvas.height, 100, "canvas.height", "100"); 27 canvas.width = 301.999; 28 canvas.height = 301.001; 29 _assertSame(canvas.width, 301, "canvas.width", "301"); 30 _assertSame(canvas.height, 301, "canvas.height", "301"); 31 canvas.width = "+1.5e2"; 32 canvas.height = "0x96"; 33 _assertSame(canvas.width, 150, "canvas.width", "150"); 34 _assertSame(canvas.height, 150, "canvas.height", "150"); 35 36 }); 37 </script>