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

Side by Side Diff: test/codegen/lib/html/webgl_1_test.dart

Issue 1930043002: Add all dart:html tests from the sdk to test/codegen. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: ptal Created 4 years, 7 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
« no previous file with comments | « test/codegen/lib/html/utils.dart ('k') | test/codegen/lib/html/websocket_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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;
6 import 'package:unittest/unittest.dart';
7 import 'package:unittest/html_individual_config.dart';
8 import 'dart:html';
9 import 'dart:typed_data';
10 import 'dart:web_gl';
11 import 'dart:web_gl' as gl;
12
13 // Test that WebGL is present in dart:web_gl API
14
15 main() {
16 useHtmlIndividualConfiguration();
17
18 group('supported', () {
19 test('supported', () {
20 expect(RenderingContext.supported, isTrue);
21 });
22 });
23
24 group('functional', () {
25 test('unsupported fails', () {
26 var canvas = new CanvasElement();
27 var context = canvas.getContext3d();
28 if (RenderingContext.supported) {
29 expect(context, isNotNull);
30 expect(context, new isInstanceOf<RenderingContext>());
31 } else {
32 expect(context, isNull);
33 }
34 });
35
36 if (RenderingContext.supported) {
37 test('simple', () {
38 var canvas = new CanvasElement();
39 var context = canvas.getContext('experimental-webgl');
40 var shader = context.createShader(gl.VERTEX_SHADER);
41 context.shaderSource(shader, 'void main() { }');
42 context.compileShader(shader);
43 var success = context.getShaderParameter(shader, gl.COMPILE_STATUS);
44 expect(success, isTrue);
45 });
46
47 test('getContext3d', () {
48 var canvas = new CanvasElement();
49 var context = canvas.getContext3d();
50 expect(context, isNotNull);
51 expect(context, new isInstanceOf<RenderingContext>());
52
53 context = canvas.getContext3d(depth: false);
54 expect(context, isNotNull);
55 expect(context, new isInstanceOf<RenderingContext>());
56 });
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.texImage2DUntyped(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.texSubImage2DUntyped(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
92 test('getContextAttributes', () {
93 var canvas = new CanvasElement();
94 var context = canvas.getContext3d();
95 var attributes = context.getContextAttributes();
96
97 expect(attributes, isNotNull);
98 expect(attributes, new isInstanceOf<gl.ContextAttributes>());
99
100 expect(attributes.alpha, isBoolean);
101 expect(attributes.antialias, isBoolean);
102 expect(attributes.depth, isBoolean);
103 expect(attributes.premultipliedAlpha, isBoolean);
104 expect(attributes.preserveDrawingBuffer, isBoolean);
105 expect(attributes.stencil, isBoolean);
106 });
107 }
108 });
109 }
110
111 Matcher isBoolean = anyOf(isTrue, isFalse);
OLDNEW
« no previous file with comments | « test/codegen/lib/html/utils.dart ('k') | test/codegen/lib/html/websocket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698