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

Unified Diff: conformance/premultiplyalpha-test.html

Issue 8344024: Remove older revision of webgl conformance tests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 9 years, 2 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
« no previous file with comments | « conformance/point-size.html ('k') | conformance/program-test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: conformance/premultiplyalpha-test.html
===================================================================
--- conformance/premultiplyalpha-test.html (revision 106149)
+++ conformance/premultiplyalpha-test.html (working copy)
@@ -1,143 +0,0 @@
-<!--
-Copyright (c) 2011 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
- -->
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<title>Test the WebGL premultipledAlpha context creation flag.</title>
-<link rel="stylesheet" href="../resources/js-test-style.css"/>
-<script src="../resources/js-test-pre.js"></script>
-<script src="resources/webgl-test.js"> </script>
-<script src="resources/webgl-test-utils.js"> </script>
-</head>
-<body>
-<div id="description"></div><div id="console"></div>
-<script>
-var wtu = WebGLTestUtils;
-
-var tests = [
- // If premultipledAlpha is true then
- // [texture] [canvas] [dataURL]
- // 32, 64, 128, 128 -> 64, 128, 255, 128 -> 64, 128, 255, 128
- { creationAttributes: {},
- sentColor: [32, 64, 128, 128],
- expectedColor: [64, 128, 255, 128],
- errorRange: 2,
- useToDataURL: true,
- },
- // If premultipledAlpha is true then
- // [texture] [canvas] [texture]
- // 32, 64, 128, 128 -> 64, 128, 255, 128 -> 64, 128, 255, 128
- { creationAttributes: {},
- sentColor: [32, 64, 128, 128],
- expectedColor: [64, 128, 255, 128],
- errorRange: 2,
- useToDataURL: false,
- },
- // If premultipledAlpha is false then
- // [texture] [canvas] [dataURL]
- // 255, 192, 128, 1 -> 255, 192, 128, 1 -> 255, 192, 128, 1
- { creationAttributes: {premultipliedAlpha: false},
- sentColor: [255, 192, 128, 1],
- expectedColor: [255, 192, 128, 1],
- errorRange: 0,
- useToDataURL: true,
- },
- // If premultipledAlpha is false then
- // [texture] [canvas] [texture]
- // 255, 192, 128, 1 -> 255, 192, 128, 1 -> 255, 192, 128, 1
- { creationAttributes: {premultipliedAlpha: false},
- sentColor: [255, 192, 128, 1],
- expectedColor: [255, 192, 128, 1],
- errorRange: 0,
- useToDataURL: false,
- }
-];
-
-var g_count = 0;
-var gl;
-var canvas;
-var premultipledAlpha;
-
-description("Test the WebGL premultipledAlpha context creation flag.");
-doNextTest();
-function doNextTest() {
- if (g_count < tests.length) {
- var test = tests[g_count++];
- canvas = document.createElement("canvas");
- gl = wtu.create3DContext(canvas, test.creationAttributes);
- var premultipliedAlpha = test.creationAttributes.premultipliedAlpha != false;
- debug("")
- debug("testing: premultipliedAlpha: " + premultipliedAlpha + " toDataURL: " + test.useToDataURL);
-
- shouldBe('gl.getContextAttributes().premultipledAlpha', 'premultipledAlpha');
-
- console.log(gl.getContextAttributes());
- var program = wtu.setupTexturedQuad(gl);
-
- glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
- var tex = gl.createTexture();
- wtu.fillTexture(gl, tex, 2, 2, test.sentColor, 0);
- var loc = gl.getUniformLocation(program, "tex");
- gl.uniform1i(loc, 0);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
-
- wtu.drawQuad(gl);
- glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from drawing.");
-
- function loadTexture() {
- var pngTex = gl.createTexture();
- // not needed as it's the default
- // gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
- gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, false);
- gl.bindTexture(gl.TEXTURE_2D, pngTex);
- if (test.useToDataURL) {
- // create texture from image
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this);
- } else {
- // create texture from canvas
- gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas);
- }
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
- gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
- glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from creating copy.");
- wtu.drawQuad(gl);
- glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from 2nd drawing.");
- wtu.checkCanvas(
- gl, test.expectedColor,
- "should draw with " + test.expectedColor, test.errorRange);
-
- doNextTest();
- }
-
- if (test.useToDataURL) {
- // Load canvas into string using toDataURL
- var png = canvas.toDataURL();
- // Load string into the texture
- var input = document.createElement("img");
- input.onload = loadTexture;
- input.src = png;
- } else {
- // Load canvas into the texture asynchronously (to prevent unbounded stack consumption)
- setTimeout(loadTexture, 0);
- }
- } else {
- successfullyParsed = true;
- finishTest();
- }
-}
-
-</script>
-
-</body>
-</html>
-
-
« no previous file with comments | « conformance/point-size.html ('k') | conformance/program-test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698