| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library web_gl_test; | 5 library web_gl_test; |
| 6 import '../../pkg/unittest/lib/unittest.dart'; | 6 import '../../pkg/unittest/lib/unittest.dart'; |
| 7 import '../../pkg/unittest/lib/html_individual_config.dart'; | 7 import '../../pkg/unittest/lib/html_individual_config.dart'; |
| 8 import 'dart:html'; | 8 import 'dart:html'; |
| 9 import 'dart:typed_data'; |
| 9 import 'dart:web_gl'; | 10 import 'dart:web_gl'; |
| 10 import 'dart:web_gl' as gl; | 11 import 'dart:web_gl' as gl; |
| 11 | 12 |
| 12 // Test that WebGL is present in dart:web_gl API | 13 // Test that WebGL is present in dart:web_gl API |
| 13 | 14 |
| 14 main() { | 15 main() { |
| 15 useHtmlIndividualConfiguration(); | 16 useHtmlIndividualConfiguration(); |
| 16 | 17 |
| 17 group('supported', () { | 18 group('supported', () { |
| 18 test('supported', () { | 19 test('supported', () { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 46 test('getContext3d', () { | 47 test('getContext3d', () { |
| 47 var canvas = new CanvasElement(); | 48 var canvas = new CanvasElement(); |
| 48 var context = canvas.getContext3d(); | 49 var context = canvas.getContext3d(); |
| 49 expect(context, isNotNull); | 50 expect(context, isNotNull); |
| 50 expect(context, new isInstanceOf<RenderingContext>()); | 51 expect(context, new isInstanceOf<RenderingContext>()); |
| 51 | 52 |
| 52 context = canvas.getContext3d(depth: false); | 53 context = canvas.getContext3d(depth: false); |
| 53 expect(context, isNotNull); | 54 expect(context, isNotNull); |
| 54 expect(context, new isInstanceOf<RenderingContext>()); | 55 expect(context, new isInstanceOf<RenderingContext>()); |
| 55 }); | 56 }); |
| 57 |
| 58 test('texImage2D', () { |
| 59 var canvas = new CanvasElement(); |
| 60 var context = canvas.getContext3d(); |
| 61 var pixels = new Uint8List.fromList([0,0,3,255,0,0,0,0,0,0]); |
| 62 context.texImage2D(1, 1, 1, 1, 10, 10, 1, 1, pixels); |
| 63 |
| 64 canvas = new CanvasElement(); |
| 65 document.body.children.add(canvas); |
| 66 var context2 = canvas.getContext('2d'); |
| 67 context.texImage2DData(1, 1, 1, 1, 10, |
| 68 context2.getImageData(10, 10, 10, 10)); |
| 69 |
| 70 context.texImage2DImage(1, 1, 1, 1, 10, new ImageElement()); |
| 71 context.texImage2DCanvas(1, 1, 1, 1, 10, new CanvasElement()); |
| 72 context.texImage2DVideo(1, 1, 1, 1, 10, new VideoElement()); |
| 73 }); |
| 74 |
| 75 test('texSubImage2D', () { |
| 76 var canvas = new CanvasElement(); |
| 77 var context = canvas.getContext3d(); |
| 78 var pixels = new Uint8List.fromList([0,0,3,255,0,0,0,0,0,0]); |
| 79 context.texSubImage2D(1, 1, 1, 1, 10, 10, 1, 1, pixels); |
| 80 |
| 81 canvas = new CanvasElement(); |
| 82 document.body.children.add(canvas); |
| 83 var context2 = canvas.getContext('2d'); |
| 84 context.texSubImage2DData(1, 1, 1, 1, 1, 10, |
| 85 context2.getImageData(10, 10, 10, 10)); |
| 86 |
| 87 context.texSubImage2DImage(1, 1, 1, 1, 1, 10, new ImageElement()); |
| 88 context.texSubImage2DCanvas(1, 1, 1, 1, 1, 10, new CanvasElement()); |
| 89 context.texSubImage2DVideo(1, 1, 1, 1, 1, 10, new VideoElement()); |
| 90 }); |
| 56 } | 91 } |
| 57 }); | 92 }); |
| 58 } | 93 } |
| 59 | 94 |
| OLD | NEW |