OLD | NEW |
1 library InstanceOfTest; | 1 library InstanceOfTest; |
2 import '../../pkg/unittest/lib/unittest.dart'; | 2 import '../../pkg/unittest/lib/unittest.dart'; |
3 import '../../pkg/unittest/lib/html_config.dart'; | 3 import '../../pkg/unittest/lib/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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 CanvasRenderingContext2D context = canvas.getContext('2d'); | 37 CanvasRenderingContext2D context = canvas.getContext('2d'); |
38 expect(context, isCanvasRenderingContext); | 38 expect(context, isCanvasRenderingContext); |
39 expect(context, isCanvasRenderingContext2D); | 39 expect(context, isCanvasRenderingContext2D); |
40 expect(context, isNot(isElement)); | 40 expect(context, isNot(isElement)); |
41 expect(context, isNot(isCanvasElement)); | 41 expect(context, isNot(isCanvasElement)); |
42 expect(context, isNot(isImageData)); | 42 expect(context, isNot(isImageData)); |
43 // expect(context, isNot(isCanvasPixelArray)); | 43 // expect(context, isNot(isCanvasPixelArray)); |
44 | 44 |
45 // FIXME(b/5286633): Interface injection type check workaround. | 45 // FIXME(b/5286633): Interface injection type check workaround. |
46 var image = context.createImageData(canvas.width as Dynamic, | 46 var image = context.createImageData(canvas.width as dynamic, |
47 canvas.height as Dynamic); | 47 canvas.height as dynamic); |
48 expect(image, isNot(isCanvasRenderingContext)); | 48 expect(image, isNot(isCanvasRenderingContext)); |
49 expect(image, isNot(isCanvasRenderingContext2D)); | 49 expect(image, isNot(isCanvasRenderingContext2D)); |
50 expect(image, isNot(isElement)); | 50 expect(image, isNot(isElement)); |
51 expect(image, isNot(isCanvasElement)); | 51 expect(image, isNot(isCanvasElement)); |
52 expect(image, isImageData); | 52 expect(image, isImageData); |
53 // expect(image, isNot(isCanvasPixelArray)); | 53 // expect(image, isNot(isCanvasPixelArray)); |
54 | 54 |
55 // Include CanvasPixelArray since constructor and prototype are not | 55 // Include CanvasPixelArray since constructor and prototype are not |
56 // available until one is created. | 56 // available until one is created. |
57 var bytes = image.data; | 57 var bytes = image.data; |
58 expect(bytes, isNot(isCanvasRenderingContext)); | 58 expect(bytes, isNot(isCanvasRenderingContext)); |
59 expect(bytes, isNot(isCanvasRenderingContext2D)); | 59 expect(bytes, isNot(isCanvasRenderingContext2D)); |
60 expect(bytes, isNot(isElement)); | 60 expect(bytes, isNot(isElement)); |
61 expect(bytes, isNot(isCanvasElement)); | 61 expect(bytes, isNot(isCanvasElement)); |
62 expect(bytes, isNot(isImageData)); | 62 expect(bytes, isNot(isImageData)); |
63 expect(bytes, isUint8ClampedArray); | 63 expect(bytes, isUint8ClampedArray); |
64 | 64 |
65 // FIXME: Ensure this is an SpanElement when we next update | 65 // FIXME: Ensure this is an SpanElement when we next update |
66 // WebKit IDL. | 66 // WebKit IDL. |
67 var span = new Element.tag('span'); | 67 var span = new Element.tag('span'); |
68 expect(span, isElement); | 68 expect(span, isElement); |
69 }); | 69 }); |
70 } | 70 } |
OLD | NEW |