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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/webgl/point-size.html

Issue 1601093008: Remove duplicated WebGL layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: third_party/WebKit/LayoutTests/fast/canvas/webgl/point-size.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/point-size.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/point-size.html
deleted file mode 100644
index 616abe4b3d7a4f6f2367c04b85366ba93968833b..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/point-size.html
+++ /dev/null
@@ -1,124 +0,0 @@
-<html>
-<head>
-<script src="../../../resources/js-test.js"></script>
-<script src="resources/webgl-test.js"></script>
-<script id="vshader" type="x-shader/x-vertex">
-attribute vec3 pos;
-attribute vec4 colorIn;
-uniform float pointSize;
-varying vec4 color;
-
-void main()
-{
- gl_PointSize = pointSize;
- color = colorIn;
- gl_Position = vec4(pos.xyz, 3.0);
-}
-</script>
-
-<script id="fshader" type="x-shader/x-fragment">
-#ifdef GL_ES
-precision mediump float;
-#endif
-varying vec4 color;
-
-void main()
-{
- gl_FragColor = color;
-}
-</script>
-
-<script>
-function runTest()
-{
- var gl = initWebGL('testbed', 'vshader', 'fshader', ['pos', 'colorIn'], [0, 0, 0, 1], 1, { antialias: false });
- if (!gl) {
- testFailed('initWebGL(..) failed');
- return false;
- }
- gl.disable(gl.BLEND);
- gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
-
- // The choice of (0.4, 0.4) ensures that the centers of the surrounding
- // pixels are not contained within the point when it is of size 1, but
- // that they definitely are when it is of size 2.
- var vertices = new Float32Array([
- 0.4, 0.4, 0.0]);
- var colors = new Uint8Array([
- 255, 0, 0, 255]);
-
- var colorOffset = vertices.byteLength;
-
- var vbo = gl.createBuffer();
- gl.bindBuffer(gl.ARRAY_BUFFER, vbo);
- gl.bufferData(gl.ARRAY_BUFFER, colorOffset + colors.byteLength, gl.STATIC_DRAW);
- gl.bufferSubData(gl.ARRAY_BUFFER, 0, vertices);
- gl.bufferSubData(gl.ARRAY_BUFFER, colorOffset, colors);
-
- gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
- gl.enableVertexAttribArray(0);
- gl.vertexAttribPointer(1, 4, gl.UNSIGNED_BYTE, true, 0, colorOffset);
- gl.enableVertexAttribArray(1);
-
- var locPointSize = gl.getUniformLocation(gl.program, 'pointSize');
-
- debug('Draw a point of size 1 and verify it does not touch any other pixels.');
-
- gl.uniform1f(locPointSize, 1.0);
- gl.drawArrays(gl.POINTS, 0, vertices.length / 3);
- var buf = new Uint8Array(2 * 2 * 4);
- gl.readPixels(0, 0, 2, 2, gl.RGBA, gl.UNSIGNED_BYTE, buf);
- var index = 0;
- for (var y = 0; y < 2; ++y) {
- for (var x = 0; x < 2; ++x) {
- var correctColor = [0, 0, 0];
- if (x == 1 && y == 1)
- correctColor[0] = 255;
- if (buf[index] != correctColor[0] || buf[index + 1] != correctColor[1] || buf[index + 2] != correctColor[2]) {
- testFailed('Drawing a point of size 1 touched pixels that should not be touched');
- return false;
- }
- index += 4;
- }
- }
- gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
-
- debug('Draw a point of size 2 and verify it fills the appropriate region.');
-
- var pointSizeRange = gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE);
- if (pointSizeRange < 2.0)
- return true;
-
- gl.uniform1f(locPointSize, 2.0);
- gl.drawArrays(gl.POINTS, 0, vertices.length / 3);
- gl.readPixels(0, 0, 2, 2, gl.RGBA, gl.UNSIGNED_BYTE, buf);
- index = 0;
- for (var y = 0; y < 2; ++y) {
- for (var x = 0; x < 2; ++x) {
- var correctColor = [255, 0, 0];
- if (buf[index] != correctColor[0] || buf[index + 1] != correctColor[1] || buf[index + 2] != correctColor[2]) {
- testFailed('Drawing a point of size 2 failed to fill the appropriate region');
- return false;
- }
- index += 4;
- }
- }
-
- return true;
-}
-</script>
-</head>
-<body>
-<canvas id="testbed" width="2px" height="2px"></canvas>
-<div id="description"></div>
-<div id="console"></div>
-<script>
-description('Verify GL_VERTEX_PROGRAM_POINT_SIZE is enabled in WebGL');
-
-if (runTest())
- testPassed("");
-</script>
-
-
-</body>
-</html>

Powered by Google App Engine
This is Rietveld 408576698