OLD | NEW |
1 #library('InstanceOfTest'); | 1 #library('InstanceOfTest'); |
2 #import('../../pkg/unittest/unittest.dart'); | 2 #import('../../pkg/unittest/unittest.dart'); |
3 #import('../../pkg/unittest/html_config.dart'); | 3 #import('../../pkg/unittest/html_config.dart'); |
4 #import('dart:html'); | 4 #import('dart:html'); |
5 | 5 |
6 main() { | 6 main() { |
7 CanvasElement canvas; | 7 CanvasElement canvas; |
8 | 8 |
9 canvas = new Element.tag('canvas'); | 9 canvas = new Element.tag('canvas'); |
10 canvas.attributes['width'] = 100; | 10 canvas.attributes['width'] = 100; |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 CanvasRenderingContext2D context = canvas.getContext('2d'); | 23 CanvasRenderingContext2D context = canvas.getContext('2d'); |
24 Expect.isTrue(context is CanvasRenderingContext); | 24 Expect.isTrue(context is CanvasRenderingContext); |
25 Expect.isTrue(context is CanvasRenderingContext2D); | 25 Expect.isTrue(context is CanvasRenderingContext2D); |
26 Expect.isFalse(context is Element); | 26 Expect.isFalse(context is Element); |
27 Expect.isFalse(context is CanvasElement); | 27 Expect.isFalse(context is CanvasElement); |
28 Expect.isFalse(context is ImageData); | 28 Expect.isFalse(context is ImageData); |
29 // Expect.isFalse(context is CanvasPixelArray); | 29 // Expect.isFalse(context is CanvasPixelArray); |
30 | 30 |
31 // FIXME(b/5286633): Interface injection type check workaround. | 31 // FIXME(b/5286633): Interface injection type check workaround. |
32 var image = context.createImageData(canvas.width.dynamic, canvas.height.dyna
mic); | 32 var image = context.createImageData(canvas.width as Dynamic, |
| 33 canvas.height as Dynamic); |
33 Expect.isFalse(image is CanvasRenderingContext); | 34 Expect.isFalse(image is CanvasRenderingContext); |
34 Expect.isFalse(image is CanvasRenderingContext2D); | 35 Expect.isFalse(image is CanvasRenderingContext2D); |
35 Expect.isFalse(image is Element); | 36 Expect.isFalse(image is Element); |
36 Expect.isFalse(image is CanvasElement); | 37 Expect.isFalse(image is CanvasElement); |
37 Expect.isTrue(image is ImageData); | 38 Expect.isTrue(image is ImageData); |
38 // Expect.isFalse(image is CanvasPixelArray); | 39 // Expect.isFalse(image is CanvasPixelArray); |
39 | 40 |
40 // Include CanvasPixelArray since constructor and prototype are not | 41 // Include CanvasPixelArray since constructor and prototype are not |
41 // available until one is created. | 42 // available until one is created. |
42 var bytes = image.data; | 43 var bytes = image.data; |
43 Expect.isFalse(bytes is CanvasRenderingContext); | 44 Expect.isFalse(bytes is CanvasRenderingContext); |
44 Expect.isFalse(bytes is CanvasRenderingContext2D); | 45 Expect.isFalse(bytes is CanvasRenderingContext2D); |
45 Expect.isFalse(bytes is Element); | 46 Expect.isFalse(bytes is Element); |
46 Expect.isFalse(bytes is CanvasElement); | 47 Expect.isFalse(bytes is CanvasElement); |
47 Expect.isFalse(bytes is ImageData); | 48 Expect.isFalse(bytes is ImageData); |
48 Expect.isTrue(bytes is Uint8ClampedArray); | 49 Expect.isTrue(bytes is Uint8ClampedArray); |
49 | 50 |
50 // FIXME: Ensure this is an SpanElement when we next update | 51 // FIXME: Ensure this is an SpanElement when we next update |
51 // WebKit IDL. | 52 // WebKit IDL. |
52 var span = new Element.tag('span'); | 53 var span = new Element.tag('span'); |
53 Expect.isTrue(span is Element); | 54 Expect.isTrue(span is Element); |
54 }); | 55 }); |
55 } | 56 } |
OLD | NEW |