Chromium Code Reviews| Index: tests/html/webgl_1_test.dart |
| diff --git a/tests/html/webgl_1_test.dart b/tests/html/webgl_1_test.dart |
| index 87073d3488a2e060b73e58335098e75dd861b495..a2f61c038f52639a614017d7400ba7e2a6068c47 100644 |
| --- a/tests/html/webgl_1_test.dart |
| +++ b/tests/html/webgl_1_test.dart |
| @@ -1,21 +1,57 @@ |
| -library WebGL1Test; |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +library web_gl_test; |
| import '../../pkg/unittest/lib/unittest.dart'; |
| -import '../../pkg/unittest/lib/html_config.dart'; |
| +import '../../pkg/unittest/lib/html_individual_config.dart'; |
| import 'dart:html'; |
| // Test that WebGL is present in dart:html API |
| main() { |
| - useHtmlConfiguration(); |
| - |
| - test('simple', () { |
| - var canvas = document.createElement("canvas"); |
| - var gl = canvas.getContext("experimental-webgl"); |
| - var shader = gl.createShader(WebGLRenderingContext.VERTEX_SHADER); |
| - gl.shaderSource(shader, "void main() { }"); |
| - gl.compileShader(shader); |
| - var success = |
| - gl.getShaderParameter(shader, WebGLRenderingContext.COMPILE_STATUS); |
| - expect(success, isTrue); |
| + useHtmlIndividualConfiguration(); |
| + |
| + group('supported', () { |
| + test('supported', () { |
| + expect(WebGLRenderingContext.supported, true); |
| + }); |
| + }); |
| + |
| + group('functional', () { |
| + test('unsupported fails', () { |
| + var canvas = new CanvasElement(); |
| + var gl = canvas.getContext3d(); |
| + if (WebGLRenderingContext.supported) { |
| + expect(gl, isNotNull); |
| + expect(gl is WebGLRenderingContext, true); |
|
Anton Muhin
2013/01/29 12:05:59
new IsInstanceOf<...>? overall, it looks like you
blois
2013/01/29 21:50:08
Interesting- I only see one other test which uses
|
| + } else { |
| + expect(gl, null); |
| + } |
| + }); |
| + |
| + if (WebGLRenderingContext.supported) { |
| + test('simple', () { |
| + var canvas = new CanvasElement(); |
| + var gl = canvas.getContext("experimental-webgl"); |
|
Anton Muhin
2013/01/29 12:05:59
nit: mix of ' and "
blois
2013/01/29 21:50:08
Done.
|
| + var shader = gl.createShader(WebGLRenderingContext.VERTEX_SHADER); |
| + gl.shaderSource(shader, "void main() { }"); |
| + gl.compileShader(shader); |
| + var success = |
| + gl.getShaderParameter(shader, WebGLRenderingContext.COMPILE_STATUS); |
| + expect(success, isTrue); |
| + }); |
| + |
| + test('getContext3d', () { |
| + var canvas = new CanvasElement(); |
| + var gl = canvas.getContext3d(); |
| + expect(gl, isNotNull); |
| + expect(gl is WebGLRenderingContext, true); |
| + |
| + gl = canvas.getContext3d(depth: false); |
| + expect(gl, isNotNull); |
| + expect(gl is WebGLRenderingContext, true); |
| + }); |
| + } |
| }); |
| } |