Mercurial > hg > extraction-interface
comparison geotemco/lib/excanvas/testcases/clearpath.html @ 0:b12c99b7c3f0
commit for previous development
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 19 Jan 2015 17:13:49 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b12c99b7c3f0 |
---|---|
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <title>Clear path Test</title> | |
5 <style> | |
6 | |
7 body { | |
8 text-align: center | |
9 } | |
10 | |
11 </style> | |
12 <!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]--> | |
13 <script> | |
14 | |
15 window.onload = function() { | |
16 var ctx = document.getElementById('c').getContext('2d'); | |
17 | |
18 // Need to test clearRect, strokeRect, fillRect | |
19 ctx.beginPath(); | |
20 ctx.moveTo(0, 50); | |
21 ctx.lineTo(50, 100); | |
22 | |
23 ctx.strokeRect(100.5, 125.5, 49, 49); | |
24 | |
25 ctx.lineTo(100, 50); | |
26 | |
27 ctx.fillRect(50, 125, 50, 50); | |
28 | |
29 ctx.lineTo(50, 0); | |
30 | |
31 // clearRect is not correctly implmented in ExCanvas but for this test its | |
32 // current behavior is enough. | |
33 ctx.clearRect(50, 125, 100, 50); | |
34 | |
35 ctx.lineTo(0, 50); | |
36 ctx.stroke(); | |
37 }; | |
38 | |
39 </script> | |
40 </head> | |
41 <body> | |
42 | |
43 <canvas id=c width=200 height=200></canvas> | |
44 | |
45 <p>This tests the clearing of the path. You should only see a diamond shape | |
46 above.</p> | |
47 | |
48 </body> | |
49 </html> |