| 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'; | |
| 10 import 'dart:web_gl'; | 9 import 'dart:web_gl'; |
| 11 import 'dart:web_gl' as gl; | 10 import 'dart:web_gl' as gl; |
| 12 | 11 |
| 13 // Test that WebGL is present in dart:web_gl API | 12 // Test that WebGL is present in dart:web_gl API |
| 14 | 13 |
| 15 main() { | 14 main() { |
| 16 useHtmlIndividualConfiguration(); | 15 useHtmlIndividualConfiguration(); |
| 17 | 16 |
| 18 group('supported', () { | 17 group('supported', () { |
| 19 test('supported', () { | 18 test('supported', () { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 47 test('getContext3d', () { | 46 test('getContext3d', () { |
| 48 var canvas = new CanvasElement(); | 47 var canvas = new CanvasElement(); |
| 49 var context = canvas.getContext3d(); | 48 var context = canvas.getContext3d(); |
| 50 expect(context, isNotNull); | 49 expect(context, isNotNull); |
| 51 expect(context, new isInstanceOf<RenderingContext>()); | 50 expect(context, new isInstanceOf<RenderingContext>()); |
| 52 | 51 |
| 53 context = canvas.getContext3d(depth: false); | 52 context = canvas.getContext3d(depth: false); |
| 54 expect(context, isNotNull); | 53 expect(context, isNotNull); |
| 55 expect(context, new isInstanceOf<RenderingContext>()); | 54 expect(context, new isInstanceOf<RenderingContext>()); |
| 56 }); | 55 }); |
| 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 }); | |
| 91 } | 56 } |
| 92 }); | 57 }); |
| 93 } | 58 } |
| 94 | 59 |
| OLD | NEW |