[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

cmarrin at apple.com cmarrin at apple.com
Thu Apr 8 00:55:14 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 9e2844c076cb0d54f9358d11d99bec43a5a0a021
Author: cmarrin at apple.com <cmarrin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 5 23:42:03 2010 +0000

            New test for texImage2d and texSubImage2d cases
            New test for texImage2d using ImageData which tests rendering.
            https://bugs.webkit.org/show_bug.cgi?id=31562
            Also bug: https://bugs.webkit.org/show_bug.cgi?id=31493
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52834 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 7f31539..6fd41f4 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-01-05  Rachel Petterson  <rlp at google.com>
+
+        Reviewed by Simon Fraser.
+
+        With Chris Marrin  <cmarrin at apple.com>.
+
+        New test for texImage2d and texSubImage2d cases 
+        New test for texImage2d using ImageData which tests rendering.
+        https://bugs.webkit.org/show_bug.cgi?id=31562
+        Also bug: https://bugs.webkit.org/show_bug.cgi?id=31493
+
+        * fast/canvas/webgl/script-tests/texImageTest.js: Added.
+        * fast/canvas/webgl/texImage2DImageDataTest-expected.txt: Added.
+        * fast/canvas/webgl/texImage2DImageDataTest.html: Added.
+        * fast/canvas/webgl/texImageTest-expected.txt: Added.
+        * fast/canvas/webgl/texImageTest.html: Added.
+
 2010-01-05  Chris Fleizach  <cfleizach at apple.com>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/fast/canvas/webgl/script-tests/texImageTest.js b/LayoutTests/fast/canvas/webgl/script-tests/texImageTest.js
new file mode 100644
index 0000000..51bfd35
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/script-tests/texImageTest.js
@@ -0,0 +1,28 @@
+description("Test of texImage2d and texSubImage2d");
+
+var context = create3DContext();
+var image = document.createElement("img");
+var video = document.createElement("video");
+var canvas2d = document.createElement("canvas");
+var context2d = canvas2d.getContext("2d");
+var imageData = context2d.createImageData(64, 64);
+var array = new WebGLUnsignedByteArray([ 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255 ]);
+
+shouldThrow("context.texImage2D(context.TEXTURE_2D)");
+shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 64, 64, 0, context.RGBA, context.UNSIGNED_BYTE, 0)");
+shouldThrow("context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 0, context.RGBA, context.UNSIGNED_BYTE, 0)");
+shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 2, 2, 0, context.RGBA, context.UNSIGNED_BYTE, array)");
+shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, imageData, true)");
+shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, image)");
+shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, canvas2d, false)");
+shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, video, true, false)");
+
+shouldThrow("context.texSubImage2D(context.TEXTURE_2D)");
+shouldBeUndefined("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, 0)");
+shouldThrow("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, context.UNSIGNED_BYTE, 0)");
+shouldBeUndefined("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, imageData, false)");
+shouldBeUndefined("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, image)");
+shouldBeUndefined("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, canvas2d, true)");
+shouldBeUndefined("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, video, false, true)");
+
+successfullyParsed = true;
diff --git a/LayoutTests/fast/canvas/webgl/texImage2DImageDataTest-expected.txt b/LayoutTests/fast/canvas/webgl/texImage2DImageDataTest-expected.txt
new file mode 100644
index 0000000..3280957
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/texImage2DImageDataTest-expected.txt
@@ -0,0 +1,2 @@
+ 
+Test PASSED
diff --git a/LayoutTests/fast/canvas/webgl/texImage2DImageDataTest.html b/LayoutTests/fast/canvas/webgl/texImage2DImageDataTest.html
new file mode 100644
index 0000000..560ab62
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/texImage2DImageDataTest.html
@@ -0,0 +1,147 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>texImage2D ImageData Test</title>
+    <script src="resources/utils3d.js"> </script>
+    <script id="vshader" type="x-shader/x-vertex">
+        attribute vec3 vPosition;
+        attribute vec2 vTexCoord0;
+        varying vec2 texCoord;
+        void main()
+        {
+            gl_Position = vec4(vPosition.x, vPosition.y, vPosition.z, 1.0);
+            texCoord = vTexCoord0;
+        }
+    </script>
+
+    <script id="fshader" type="x-shader/x-fragment">
+        uniform sampler2D tex;
+        varying vec2 texCoord;
+        void main()
+        {
+            gl_FragColor = texture2D(tex, texCoord);
+        }
+    </script>
+
+    <script>
+        function fail(x,y, buf, shouldBe)
+        {
+            var i = (y*64+x) * 4;
+            var reason = "pixel at ("+x+","+y+") is ("+buf[i]+","+buf[i+1]+","+buf[i+2]+","+buf[i+3]+"), should be "+shouldBe;
+            document.getElementById("results").innerHTML = "Test <span style='color:red'>FAILED</span> "+reason;
+        }
+        
+        function pass()
+        {
+            document.getElementById("results").innerHTML = "Test <span style='color:green'>PASSED</span>";
+        }
+        
+        function checkGLError()
+        {
+            var error = gl.getError();
+            if (error != gl.NO_ERROR) {
+                var str = "GL Error: " + error;
+                document.body.appendChild(document.createTextNode(str));
+                throw str;
+            }
+        }
+        
+        function init()
+        {
+            if (window.layoutTestController) {
+                layoutTestController.overridePreference("WebKitWebGLEnabled", "1");
+                layoutTestController.dumpAsText();
+            }
+            // Set up a canvas to get image data from
+            var canvas2d = document.getElementById("texcanvas");
+            var context2d = canvas2d.getContext("2d");
+            context2d.fillStyle = 'red';
+            context2d.fillRect(0,0,64,64);
+                        
+            gl = initWebGL("example", "vshader", "fshader", [ "vPosition", "vTexCoord0"], [ 1, 0, 1, 1 ], 100);
+            gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+            
+            var vertexObject = gl.createBuffer();
+            gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
+            var vertices = new WebGLFloatArray([
+                -1,  1, 0,
+                -1, -1, 0,
+                 1,  1, 0,
+                 1, -1, 0,
+                 1,  1, 0,
+                -1, -1, 0]);
+            var texCoords = new WebGLFloatArray([
+                 0, 1,
+                 0, 0,
+                 1, 1,
+                 1, 0,
+                 1, 1,
+                 0, 0]);
+            g_texCoordOffset = vertices.byteLength;
+            gl.bufferData(gl.ARRAY_BUFFER, g_texCoordOffset + texCoords.byteLength, gl.STATIC_DRAW);
+            gl.bufferSubData(gl.ARRAY_BUFFER, 0, vertices);
+            gl.bufferSubData(gl.ARRAY_BUFFER, g_texCoordOffset, texCoords);
+            
+            gl.enableVertexAttribArray(0);
+            gl.vertexAttribPointer(0, 3, gl.FLOAT, gl.FALSE, 0, 0);
+            gl.enableVertexAttribArray(1);
+            gl.vertexAttribPointer(1, 2, gl.FLOAT, gl.FALSE, 0, g_texCoordOffset);
+
+            // Create a texture from the canvas's image data
+            var tex = gl.createTexture();
+            gl.bindTexture(gl.TEXTURE_2D, tex);
+            gl.texImage2D(gl.TEXTURE_2D, 0, context2d.getImageData(0, 0, 64, 64));
+            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);
+            gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
+            gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
+            
+            g_textureLoc = gl.getUniformLocation(gl.program, "tex");
+            gl.uniform1i(g_textureLoc, 0);
+            
+            gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+            gl.drawArrays(gl.TRIANGLES, 0, 6);
+            
+            checkGLError();
+
+            // Test several locations
+            // Each line should be all red 
+            var buf = gl.readPixels(0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE);
+            
+            var offset15 = 3840; // (15*64) * 4
+            var offset40 = 10240; // (40*64) * 4
+            var offset63 = 16128; // (63*64) * 4
+            for (var i = 0; i < 64; ++i) {
+                var test0 = (buf[i*4] != 255 || buf[i*4+1] != 0 || buf[i*4+2] != 0 || buf[i*4+3] != 255);
+                var test15 = (buf[offset15+i*4] != 255 || buf[offset15+i*4+1] != 0 || buf[offset15+i*4+2] != 0 || buf[offset15+i*4+3] != 255);
+                var test40 = (buf[offset40+i*4] != 255 || buf[offset40+i*4+1] != 0 || buf[offset40+i*4+2] != 0 || buf[offset40+i*4+3] != 255);
+                var test63 = (buf[offset63+i*4] != 255 || buf[offset63+i*4+1] != 0 || buf[offset63+i*4+2] != 0 || buf[offset63+i*4+3] != 255);
+                if (test0) {
+                    fail(i, 0, buf, "(255,0,0,255)");
+                    return;
+                }
+                if (test15) {
+                    fail(i, 15, buf, "(255,0,0,255)");
+                    return;
+                }
+                if (test40) {
+                    fail(i, 40, buf, "(255,0,0,255)");
+                    return;
+                }
+                if (test63) {
+                    fail(i, 63, buf, "(255,0,0,255)");
+                    return;
+                }
+            }
+            pass();
+       }
+    </script>
+  </head>
+  <body onload="init()">
+    <canvas id="texcanvas" width="64px" height="64px"></canvas>
+    <canvas id="example" width="64px" height="64px">
+    There is supposed to be an example drawing here, but it's not important.
+    </canvas>
+    <div id="results">Test <span style="color:red">FAILED</span></div>
+  </body>
+</html>
diff --git a/LayoutTests/fast/canvas/webgl/texImageTest-expected.txt b/LayoutTests/fast/canvas/webgl/texImageTest-expected.txt
new file mode 100644
index 0000000..7761958
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/texImageTest-expected.txt
@@ -0,0 +1,23 @@
+Test of texImage2d and texSubImage2d
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS context.texImage2D(context.TEXTURE_2D) threw exception SyntaxError: Syntax error.
+PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 64, 64, 0, context.RGBA, context.UNSIGNED_BYTE, 0) is undefined.
+PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 0, context.RGBA, context.UNSIGNED_BYTE, 0) threw exception SyntaxError: Syntax error.
+PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 2, 2, 0, context.RGBA, context.UNSIGNED_BYTE, array) is undefined.
+PASS context.texImage2D(context.TEXTURE_2D, 0, imageData, true) is undefined.
+PASS context.texImage2D(context.TEXTURE_2D, 0, image) is undefined.
+PASS context.texImage2D(context.TEXTURE_2D, 0, canvas2d, false) is undefined.
+PASS context.texImage2D(context.TEXTURE_2D, 0, video, true, false) is undefined.
+PASS context.texSubImage2D(context.TEXTURE_2D) threw exception SyntaxError: Syntax error.
+PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, 0) is undefined.
+PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, context.UNSIGNED_BYTE, 0) threw exception SyntaxError: Syntax error.
+PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, imageData, false) is undefined.
+PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, image) is undefined.
+PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, canvas2d, true) is undefined.
+PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, video, false, true) is undefined.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/webgl/texImageTest.html b/LayoutTests/fast/canvas/webgl/texImageTest.html
new file mode 100644
index 0000000..75e09b5
--- /dev/null
+++ b/LayoutTests/fast/canvas/webgl/texImageTest.html
@@ -0,0 +1,15 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
+<script src="../../js/resources/js-test-pre.js"></script>
+<script src="resources/webgl-test.js"></script>
+</head>
+<body>
+<div id="description"></div>
+<div id="console"></div>
+
+<script src="script-tests/texImageTest.js"></script>
+
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list