Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Unified Diff: tests/html/webgl_1_test.dart

Issue 12077039: Adding supported checks for WebGL (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/html/html.status ('k') | tools/dom/idl/dart/dart.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..32c076a7677c4dae49ae65c40656b9388a71ae86 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, isTrue);
+ });
+ });
+
+ group('functional', () {
+ test('unsupported fails', () {
+ var canvas = new CanvasElement();
+ var gl = canvas.getContext3d();
+ if (WebGLRenderingContext.supported) {
+ expect(gl, isNotNull);
+ expect(gl, new isInstanceOf<WebGLRenderingContext>());
+ } else {
+ expect(gl, isNull);
+ }
+ });
+
+ if (WebGLRenderingContext.supported) {
+ test('simple', () {
+ var canvas = new CanvasElement();
+ 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);
+ });
+
+ test('getContext3d', () {
+ var canvas = new CanvasElement();
+ var gl = canvas.getContext3d();
+ expect(gl, isNotNull);
+ expect(gl, new isInstanceOf<WebGLRenderingContext>());
+
+ gl = canvas.getContext3d(depth: false);
+ expect(gl, isNotNull);
+ expect(gl, new isInstanceOf<WebGLRenderingContext>());
+ });
+ }
});
}
« no previous file with comments | « tests/html/html.status ('k') | tools/dom/idl/dart/dart.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698