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

Side by Side Diff: tests/html/webgl_1_test.dart

Issue 12851013: Adding web_gl library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: sync to tot Created 7 years, 8 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 | « sdk/lib/web_gl/dartium/web_gl_dartium.dart ('k') | tools/create_sdk.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:web_gl';
10 import 'dart:web_gl' as gl;
9 11
10 // Test that WebGL is present in dart:html API 12 // Test that WebGL is present in dart:web_gl API
11 13
12 main() { 14 main() {
13 useHtmlIndividualConfiguration(); 15 useHtmlIndividualConfiguration();
14 16
15 group('supported', () { 17 group('supported', () {
16 test('supported', () { 18 test('supported', () {
17 expect(WebGLRenderingContext.supported, isTrue); 19 expect(RenderingContext.supported, isTrue);
18 }); 20 });
19 }); 21 });
20 22
21 group('functional', () { 23 group('functional', () {
22 test('unsupported fails', () { 24 test('unsupported fails', () {
23 var canvas = new CanvasElement(); 25 var canvas = new CanvasElement();
24 var gl = canvas.getContext3d(); 26 var context = canvas.getContext3d();
25 if (WebGLRenderingContext.supported) { 27 if (RenderingContext.supported) {
26 expect(gl, isNotNull); 28 expect(context, isNotNull);
27 expect(gl, new isInstanceOf<WebGLRenderingContext>()); 29 expect(context, new isInstanceOf<RenderingContext>());
28 } else { 30 } else {
29 expect(gl, isNull); 31 expect(context, isNull);
30 } 32 }
31 }); 33 });
32 34
33 if (WebGLRenderingContext.supported) { 35 if (RenderingContext.supported) {
34 test('simple', () { 36 test('simple', () {
35 var canvas = new CanvasElement(); 37 var canvas = new CanvasElement();
36 var gl = canvas.getContext('experimental-webgl'); 38 var context = canvas.getContext('experimental-webgl');
37 var shader = gl.createShader(WebGLRenderingContext.VERTEX_SHADER); 39 var shader = context.createShader(gl.VERTEX_SHADER);
38 gl.shaderSource(shader, 'void main() { }'); 40 context.shaderSource(shader, 'void main() { }');
39 gl.compileShader(shader); 41 context.compileShader(shader);
40 var success = 42 var success = context.getShaderParameter(shader, gl.COMPILE_STATUS);
41 gl.getShaderParameter(shader, WebGLRenderingContext.COMPILE_STATUS);
42 expect(success, isTrue); 43 expect(success, isTrue);
43 }); 44 });
44 45
45 test('getContext3d', () { 46 test('getContext3d', () {
46 var canvas = new CanvasElement(); 47 var canvas = new CanvasElement();
47 var gl = canvas.getContext3d(); 48 var context = canvas.getContext3d();
48 expect(gl, isNotNull); 49 expect(context, isNotNull);
49 expect(gl, new isInstanceOf<WebGLRenderingContext>()); 50 expect(context, new isInstanceOf<RenderingContext>());
50 51
51 gl = canvas.getContext3d(depth: false); 52 context = canvas.getContext3d(depth: false);
52 expect(gl, isNotNull); 53 expect(context, isNotNull);
53 expect(gl, new isInstanceOf<WebGLRenderingContext>()); 54 expect(context, new isInstanceOf<RenderingContext>());
54 }); 55 });
55 } 56 }
56 }); 57 });
57 } 58 }
59
OLDNEW
« no previous file with comments | « sdk/lib/web_gl/dartium/web_gl_dartium.dart ('k') | tools/create_sdk.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698