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

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

Issue 2150003002: Recognize WEBGL extensions on Firefox (copy with regenerated files) (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | « tests/html/html.status ('k') | tools/dom/scripts/generator.py » ('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) 2016, 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
7 import 'package:unittest/unittest.dart';
8 import 'package:unittest/html_individual_config.dart';
9 import 'dart:html';
10 import 'dart:typed_data';
11 import 'dart:web_gl';
12 import 'dart:web_gl' as gl;
13
14 // Test that various webgl extensions are available. Only test advertised
15 // supported extensions. If the extension has methods, we just test the presence
16 // of some methods - we don't test if functionality works.
17
18 main() {
19 useHtmlIndividualConfiguration();
20
21 if (!RenderingContext.supported) return;
22
23
24 const allExtensions = const [
25 'ANGLE_instanced_arrays',
26 'EXT_blend_minmax',
27 'EXT_color_buffer_float',
28 'EXT_color_buffer_half_float',
29 'EXT_disjoint_timer_query',
30 'EXT_frag_depth',
31 'EXT_sRGB',
32 'EXT_shader_texture_lod',
33 'EXT_texture_filter_anisotropic',
34 'OES_element_index_uint',
35 'OES_standard_derivatives',
36 'OES_texture_float',
37 'OES_texture_float_linear',
38 'OES_texture_half_float',
39 'OES_texture_half_float_linear',
40 'OES_vertex_array_object',
41 'WEBGL_color_buffer_float',
42 'WEBGL_compressed_texture_atc',
43 'WEBGL_compressed_texture_es3',
44 'WEBGL_compressed_texture_etc1',
45 'WEBGL_compressed_texture_pvrtc',
46 'WEBGL_compressed_texture_s3tc',
47 'WEBGL_debug_renderer_info',
48 'WEBGL_debug_shaders',
49 'WEBGL_depth_texture',
50 'WEBGL_draw_buffers',
51 'WEBGL_lose_context',
52 ];
53
54 getExtension(String name) {
55 expect(name, isIn(allExtensions), reason: 'unknown extension');
56 var canvas = new CanvasElement();
57 var context = canvas.getContext3d();
58 var supportedExtensions = context.getSupportedExtensions();
59 if (supportedExtensions.contains(name)) {
60 var extension = context.getExtension(name);
61 expect(extension, isNotNull);
62 return extension;
63 }
64 return null;
65 }
66
67 testType(name, typeMatcher) {
68 test('type', () {
69 var extension = getExtension(name);
70 if (extension == null) return;
71 expect(extension, typeMatcher);
72 // Ensure that isInstanceOf<X> is not instantiated for an erroneous type
73 // X. If X is erroneous, there is only a warning at compile time and X is
74 // treated as dynamic, which would make the above line pass.
75 expect(1, isNot(typeMatcher), reason: 'invalid typeMatcher');
76 });
77 }
78
79 group('ANGLE_instanced_arrays', () {
80 const name = 'ANGLE_instanced_arrays';
81 testType(name, const isInstanceOf<AngleInstancedArrays>());
82 test('vertexAttribDivisorAngle', () {
83 var extension = getExtension(name);
84 if (extension == null) return;
85 expect(extension.vertexAttribDivisorAngle, isFunction);
86 });
87 });
88
89 group('EXT_blend_minmax', () {
90 testType('EXT_blend_minmax', const isInstanceOf<ExtBlendMinMax>());
91 });
92
93 group('EXT_frag_depth', () {
94 testType('EXT_frag_depth', const isInstanceOf<ExtFragDepth>());
95 });
96
97 group('EXT_sRGB', () {
98 testType('EXT_sRGB', const isInstanceOf<EXTsRgb>());
99 });
100
101 group('EXT_shader_texture_lod', () {
102 testType(
103 'EXT_shader_texture_lod', const isInstanceOf<ExtShaderTextureLod>());
104 });
105
106 group('EXT_texture_filter_anisotropic', () {
107 testType('EXT_texture_filter_anisotropic',
108 const isInstanceOf<ExtTextureFilterAnisotropic>());
109 });
110
111 group('OES_element_index_uint', () {
112 testType(
113 'OES_element_index_uint', const isInstanceOf<OesElementIndexUint>());
114 });
115
116 group('OES_standard_derivatives', () {
117 testType('OES_standard_derivatives',
118 const isInstanceOf<OesStandardDerivatives>());
119 });
120
121 group('OES_texture_float', () {
122 testType('OES_texture_float', const isInstanceOf<OesTextureFloat>());
123 });
124
125 group('OES_texture_float_linear', () {
126 testType('OES_texture_float_linear',
127 const isInstanceOf<OesTextureFloatLinear>());
128 });
129
130 group('OES_texture_half_float', () {
131 testType(
132 'OES_texture_half_float', const isInstanceOf<OesTextureHalfFloat>());
133 });
134
135 group('OES_texture_half_float_linear', () {
136 testType('OES_texture_half_float_linear',
137 const isInstanceOf<OesTextureHalfFloatLinear>());
138 });
139
140 group('OES_vertex_array_object', () {
141 testType(
142 'OES_vertex_array_object', const isInstanceOf<OesVertexArrayObject>());
143 });
144
145 group('WEBGL_compressed_texture_atc', () {
146 testType('WEBGL_compressed_texture_atc',
147 const isInstanceOf<CompressedTextureAtc>());
148 });
149
150 group('WEBGL_compressed_texture_etc1', () {
151 testType('WEBGL_compressed_texture_etc1',
152 const isInstanceOf<CompressedTextureETC1>());
153 });
154
155 group('WEBGL_compressed_texture_pvrtc', () {
156 testType('WEBGL_compressed_texture_pvrtc',
157 const isInstanceOf<CompressedTexturePvrtc>());
158 });
159
160 group('WEBGL_compressed_texture_s3tc', () {
161 testType('WEBGL_compressed_texture_s3tc',
162 const isInstanceOf<CompressedTextureS3TC>());
163 });
164
165 group('WEBGL_debug_renderer_info', () {
166 testType(
167 'WEBGL_debug_renderer_info', const isInstanceOf<DebugRendererInfo>());
168 });
169
170 group('WEBGL_debug_shaders', () {
171 testType('WEBGL_debug_shaders', const isInstanceOf<DebugShaders>());
172 });
173
174 group('WEBGL_depth_texture', () {
175 testType('WEBGL_depth_texture', const isInstanceOf<DepthTexture>());
176 });
177
178 group('WEBGL_draw_buffers', () {
179 const name = 'WEBGL_draw_buffers';
180 testType(name, const isInstanceOf<DrawBuffers>());
181 test('drawBuffersWebgl', () {
182 var extension = getExtension(name);
183 if (extension == null) return;
184 expect(extension.drawBuffersWebgl, isFunction);
185 });
186 });
187
188 group('WEBGL_lose_context', () {
189 const name = 'WEBGL_lose_context';
190 testType(name, const isInstanceOf<LoseContext>());
191 test('loseContext', () {
192 var extension = getExtension(name);
193 if (extension == null) return;
194 expect(extension.loseContext, isFunction);
195 });
196 });
197 }
198
199 Matcher isFunction = const isInstanceOf<Function>();
OLDNEW
« no previous file with comments | « tests/html/html.status ('k') | tools/dom/scripts/generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698