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

Side by Side 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, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/html/html.status ('k') | tools/dom/idl/dart/dart.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library WebGL1Test; 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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library web_gl_test;
2 import '../../pkg/unittest/lib/unittest.dart'; 6 import '../../pkg/unittest/lib/unittest.dart';
3 import '../../pkg/unittest/lib/html_config.dart'; 7 import '../../pkg/unittest/lib/html_individual_config.dart';
4 import 'dart:html'; 8 import 'dart:html';
5 9
6 // Test that WebGL is present in dart:html API 10 // Test that WebGL is present in dart:html API
7 11
8 main() { 12 main() {
9 useHtmlConfiguration(); 13 useHtmlIndividualConfiguration();
10 14
11 test('simple', () { 15 group('supported', () {
12 var canvas = document.createElement("canvas"); 16 test('supported', () {
13 var gl = canvas.getContext("experimental-webgl"); 17 expect(WebGLRenderingContext.supported, isTrue);
14 var shader = gl.createShader(WebGLRenderingContext.VERTEX_SHADER); 18 });
15 gl.shaderSource(shader, "void main() { }"); 19 });
16 gl.compileShader(shader); 20
17 var success = 21 group('functional', () {
18 gl.getShaderParameter(shader, WebGLRenderingContext.COMPILE_STATUS); 22 test('unsupported fails', () {
19 expect(success, isTrue); 23 var canvas = new CanvasElement();
24 var gl = canvas.getContext3d();
25 if (WebGLRenderingContext.supported) {
26 expect(gl, isNotNull);
27 expect(gl, new isInstanceOf<WebGLRenderingContext>());
28 } else {
29 expect(gl, isNull);
30 }
31 });
32
33 if (WebGLRenderingContext.supported) {
34 test('simple', () {
35 var canvas = new CanvasElement();
36 var gl = canvas.getContext('experimental-webgl');
37 var shader = gl.createShader(WebGLRenderingContext.VERTEX_SHADER);
38 gl.shaderSource(shader, 'void main() { }');
39 gl.compileShader(shader);
40 var success =
41 gl.getShaderParameter(shader, WebGLRenderingContext.COMPILE_STATUS);
42 expect(success, isTrue);
43 });
44
45 test('getContext3d', () {
46 var canvas = new CanvasElement();
47 var gl = canvas.getContext3d();
48 expect(gl, isNotNull);
49 expect(gl, new isInstanceOf<WebGLRenderingContext>());
50
51 gl = canvas.getContext3d(depth: false);
52 expect(gl, isNotNull);
53 expect(gl, new isInstanceOf<WebGLRenderingContext>());
54 });
55 }
20 }); 56 });
21 } 57 }
OLDNEW
« 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