Title: [118565] trunk/LayoutTests
Revision
118565
Author
[email protected]
Date
2012-05-25 14:38:07 -0700 (Fri, 25 May 2012)

Log Message

Incorporate new tex-image-and-sub-image-2d-with-video*.html tests
https://bugs.webkit.org/show_bug.cgi?id=87042

Reviewed by James Robinson.

Incorporated current version of video-related WebGL tests from
Khronos repository testing uploading to all packed pixel formats.

* fast/canvas/webgl/resources/tex-image-and-sub-image-2d-with-video.js: Added.
(generateTest.runOneIteration):
(generateTest.runTest):
* fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt:
* fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgb565-expected.txt: Copied from LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt.
* fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgb565.html: Added.
* fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba4444-expected.txt: Copied from LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt.
* fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba4444.html: Added.
* fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba5551-expected.txt: Copied from LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt.
* fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba5551.html: Added.
* fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (118564 => 118565)


--- trunk/LayoutTests/ChangeLog	2012-05-25 21:36:00 UTC (rev 118564)
+++ trunk/LayoutTests/ChangeLog	2012-05-25 21:38:07 UTC (rev 118565)
@@ -1,3 +1,25 @@
+2012-05-25  Kenneth Russell  <[email protected]>
+
+        Incorporate new tex-image-and-sub-image-2d-with-video*.html tests
+        https://bugs.webkit.org/show_bug.cgi?id=87042
+
+        Reviewed by James Robinson.
+
+        Incorporated current version of video-related WebGL tests from
+        Khronos repository testing uploading to all packed pixel formats.
+
+        * fast/canvas/webgl/resources/tex-image-and-sub-image-2d-with-video.js: Added.
+        (generateTest.runOneIteration):
+        (generateTest.runTest):
+        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt:
+        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgb565-expected.txt: Copied from LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt.
+        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgb565.html: Added.
+        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba4444-expected.txt: Copied from LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt.
+        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba4444.html: Added.
+        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba5551-expected.txt: Copied from LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt.
+        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba5551.html: Added.
+        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html:
+
 2012-05-25  Jessie Berlin  <[email protected]>
 
         Rebaseline the Windows getComputedStyle results to reflect features

Added: trunk/LayoutTests/fast/canvas/webgl/resources/tex-image-and-sub-image-2d-with-video.js (0 => 118565)


--- trunk/LayoutTests/fast/canvas/webgl/resources/tex-image-and-sub-image-2d-with-video.js	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/resources/tex-image-and-sub-image-2d-with-video.js	2012-05-25 21:38:07 UTC (rev 118565)
@@ -0,0 +1,104 @@
+// This block needs to be outside the onload handler in order for this
+// test to run reliably in WebKit's test harness (at least the
+// Chromium port). https://bugs.webkit.org/show_bug.cgi?id=87448
+if (window.initNonKhronosFramework) {
+    window.initNonKhronosFramework(true);
+}
+
+function generateTest(pixelFormat, pixelType, prologue) {
+    var wtu = WebGLTestUtils;
+    var gl = null;
+    var textureLoc = null;
+    var successfullyParsed = false;
+
+    var init = function()
+    {
+        description('Verify texImage2D and texSubImage2D code paths taking video elements (' + pixelFormat + '/' + pixelType + ')');
+
+        gl = wtu.create3DContext("example");
+
+        if (!prologue(gl)) {
+            finishTest();
+            return;
+        }
+
+        var program = wtu.setupTexturedQuad(gl);
+
+        gl.clearColor(0,0,0,1);
+        gl.clearDepth(1);
+
+        textureLoc = gl.getUniformLocation(program, "tex");
+
+        var video = document.getElementById("vid");
+        video.addEventListener(
+            "playing", function() { runTest(video); }, true);
+        video.loop = true;
+        video.play();
+    }
+
+    function runOneIteration(videoElement, useTexSubImage2D, flipY, topColor, bottomColor)
+    {
+        debug('Testing ' + (useTexSubImage2D ? 'texSubImage2D' : 'texImage2D') +
+              ' with flipY=' + flipY);
+        gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
+        // Disable any writes to the alpha channel
+        gl.colorMask(1, 1, 1, 0);
+        var texture = gl.createTexture();
+        // Bind the texture to texture unit 0
+        gl.bindTexture(gl.TEXTURE_2D, texture);
+        // Set up texture parameters
+        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
+        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
+        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);
+        // Set up pixel store parameters
+        gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
+        gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
+        // Upload the videoElement into the texture
+        if (useTexSubImage2D) {
+            // Initialize the texture to black first
+            gl.texImage2D(gl.TEXTURE_2D, 0, gl[pixelFormat],
+                          videoElement.videoWidth, videoElement.videoHeight, 0,
+                          gl[pixelFormat], gl[pixelType], null);
+            gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl[pixelFormat], gl[pixelType], videoElement);
+        } else {
+            gl.texImage2D(gl.TEXTURE_2D, 0, gl[pixelFormat], gl[pixelFormat], gl[pixelType], videoElement);
+        }
+
+        var c = document.createElement("canvas");
+        c.width = 16;
+        c.height = 16;
+        c.style.border = "1px solid black";
+        var ctx = c.getContext("2d");
+        ctx.drawImage(videoElement, 0, 0, 16, 16);
+        document.body.appendChild(c);
+
+        // Point the uniform sampler to texture unit 0
+        gl.uniform1i(textureLoc, 0);
+        // Draw the triangles
+        wtu.drawQuad(gl, [0, 0, 0, 255]);
+        // Check a few pixels near the top and bottom and make sure they have
+        // the right color.
+        debug("Checking lower left corner");
+        wtu.checkCanvasRect(gl, 4, 4, 2, 2, bottomColor,
+                            "shouldBe " + bottomColor);
+        debug("Checking upper left corner");
+        wtu.checkCanvasRect(gl, 4, gl.canvas.height - 8, 2, 2, topColor,
+                            "shouldBe " + topColor);
+    }
+
+    function runTest(videoElement)
+    {
+        var red = [255, 0, 0];
+        var green = [0, 255, 0];
+        runOneIteration(videoElement, false, true, red, green);
+        runOneIteration(videoElement, false, false, green, red);
+        runOneIteration(videoElement, true, true, red, green);
+        runOneIteration(videoElement, true, false, green, red);
+
+        glErrorShouldBe(gl, gl.NO_ERROR, "should be no errors");
+        finishTest();
+    }
+
+    return init;
+}

Modified: trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt (118564 => 118565)


--- trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt	2012-05-25 21:36:00 UTC (rev 118564)
+++ trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt	2012-05-25 21:38:07 UTC (rev 118565)
@@ -1,4 +1,4 @@
-Verify texImage2D and texSubImage2D code paths taking Video Elements
+Verify texImage2D and texSubImage2D code paths taking video elements (RGBA/UNSIGNED_BYTE)
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
@@ -22,6 +22,7 @@
 PASS shouldBe 255,0,0
 Checking upper left corner
 PASS shouldBe 0,255,0
+PASS getError was expected value: NO_ERROR : should be no errors
 PASS successfullyParsed is true
 
 TEST COMPLETE

Copied: trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgb565-expected.txt (from rev 118564, trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt) (0 => 118565)


--- trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgb565-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgb565-expected.txt	2012-05-25 21:38:07 UTC (rev 118565)
@@ -0,0 +1,29 @@
+Verify texImage2D and texSubImage2D code paths taking video elements (RGB/UNSIGNED_SHORT_5_6_5)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+Testing texImage2D with flipY=true
+Checking lower left corner
+PASS shouldBe 0,255,0
+Checking upper left corner
+PASS shouldBe 255,0,0
+Testing texImage2D with flipY=false
+Checking lower left corner
+PASS shouldBe 255,0,0
+Checking upper left corner
+PASS shouldBe 0,255,0
+Testing texSubImage2D with flipY=true
+Checking lower left corner
+PASS shouldBe 0,255,0
+Checking upper left corner
+PASS shouldBe 255,0,0
+Testing texSubImage2D with flipY=false
+Checking lower left corner
+PASS shouldBe 255,0,0
+Checking upper left corner
+PASS shouldBe 0,255,0
+PASS getError was expected value: NO_ERROR : should be no errors
+PASS successfullyParsed is true
+
+TEST COMPLETE
+ 

Added: trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgb565.html (0 => 118565)


--- trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgb565.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgb565.html	2012-05-25 21:38:07 UTC (rev 118565)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+function testPrologue(gl) {
+    return true;
+}
+</script>
+</head>
+<body _onload_='generateTest("RGB", "UNSIGNED_SHORT_5_6_5", testPrologue)()'>
+<canvas id="example" width="32px" height="32px"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<video width="640" height="228" id="vid" controls>
+  <source src=""  type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
+  <source src="" type='video/webm; codecs="vp8, vorbis"' />
+  <source src=""  type='video/ogg; codecs="theora, vorbis"' />
+</video>
+</body>
+</html>

Copied: trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba4444-expected.txt (from rev 118564, trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt) (0 => 118565)


--- trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba4444-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba4444-expected.txt	2012-05-25 21:38:07 UTC (rev 118565)
@@ -0,0 +1,29 @@
+Verify texImage2D and texSubImage2D code paths taking video elements (RGBA/UNSIGNED_SHORT_4_4_4_4)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+Testing texImage2D with flipY=true
+Checking lower left corner
+PASS shouldBe 0,255,0
+Checking upper left corner
+PASS shouldBe 255,0,0
+Testing texImage2D with flipY=false
+Checking lower left corner
+PASS shouldBe 255,0,0
+Checking upper left corner
+PASS shouldBe 0,255,0
+Testing texSubImage2D with flipY=true
+Checking lower left corner
+PASS shouldBe 0,255,0
+Checking upper left corner
+PASS shouldBe 255,0,0
+Testing texSubImage2D with flipY=false
+Checking lower left corner
+PASS shouldBe 255,0,0
+Checking upper left corner
+PASS shouldBe 0,255,0
+PASS getError was expected value: NO_ERROR : should be no errors
+PASS successfullyParsed is true
+
+TEST COMPLETE
+ 

Added: trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba4444.html (0 => 118565)


--- trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba4444.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba4444.html	2012-05-25 21:38:07 UTC (rev 118565)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+function testPrologue(gl) {
+    return true;
+}
+</script>
+</head>
+<body _onload_='generateTest("RGBA", "UNSIGNED_SHORT_4_4_4_4", testPrologue)()'>
+<canvas id="example" width="32px" height="32px"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<video width="640" height="228" id="vid" controls>
+  <source src=""  type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
+  <source src="" type='video/webm; codecs="vp8, vorbis"' />
+  <source src=""  type='video/ogg; codecs="theora, vorbis"' />
+</video>
+</body>
+</html>

Copied: trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba5551-expected.txt (from rev 118564, trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt) (0 => 118565)


--- trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba5551-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba5551-expected.txt	2012-05-25 21:38:07 UTC (rev 118565)
@@ -0,0 +1,29 @@
+Verify texImage2D and texSubImage2D code paths taking video elements (RGBA/UNSIGNED_SHORT_5_5_5_1)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+Testing texImage2D with flipY=true
+Checking lower left corner
+PASS shouldBe 0,255,0
+Checking upper left corner
+PASS shouldBe 255,0,0
+Testing texImage2D with flipY=false
+Checking lower left corner
+PASS shouldBe 255,0,0
+Checking upper left corner
+PASS shouldBe 0,255,0
+Testing texSubImage2D with flipY=true
+Checking lower left corner
+PASS shouldBe 0,255,0
+Checking upper left corner
+PASS shouldBe 255,0,0
+Testing texSubImage2D with flipY=false
+Checking lower left corner
+PASS shouldBe 255,0,0
+Checking upper left corner
+PASS shouldBe 0,255,0
+PASS getError was expected value: NO_ERROR : should be no errors
+PASS successfullyParsed is true
+
+TEST COMPLETE
+ 

Added: trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba5551.html (0 => 118565)


--- trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba5551.html	                        (rev 0)
+++ trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-rgba5551.html	2012-05-25 21:38:07 UTC (rev 118565)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+function testPrologue(gl) {
+    return true;
+}
+</script>
+</head>
+<body _onload_='generateTest("RGBA", "UNSIGNED_SHORT_5_5_5_1", testPrologue)()'>
+<canvas id="example" width="32px" height="32px"></canvas>
+<div id="description"></div>
+<div id="console"></div>
+<video width="640" height="228" id="vid" controls>
+  <source src=""  type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
+  <source src="" type='video/webm; codecs="vp8, vorbis"' />
+  <source src=""  type='video/ogg; codecs="theora, vorbis"' />
+</video>
+</body>
+</html>

Modified: trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html (118564 => 118565)


--- trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html	2012-05-25 21:36:00 UTC (rev 118564)
+++ trunk/LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html	2012-05-25 21:38:07 UTC (rev 118565)
@@ -1,107 +1,19 @@
+<!DOCTYPE html>
 <html>
 <head>
+<meta charset="utf-8">
+<link rel="stylesheet" href=""
 <script src=""
 <script src=""
 <script src=""
+<script src=""
 <script>
-var wtu = WebGLTestUtils;
-var gl = null;
-var textureLoc = null;
-
-if (window.initNonKhronosFramework) {
-    window.initNonKhronosFramework(true);
+function testPrologue(gl) {
+    return true;
 }
-
-function init()
-{
-    description('Verify texImage2D and texSubImage2D code paths taking Video Elements');
-
-    var canvas = document.getElementById("example");
-    gl = wtu.create3DContext(canvas);
-    var program = wtu.setupTexturedQuad(gl);
-
-    gl.clearColor(0,0,0,1);
-    gl.clearDepth(1);
-
-    textureLoc = gl.getUniformLocation(gl.program, "tex");
-
-    var video = document.getElementById("vid");
-    video.addEventListener(
-        "playing", function() { runTest(video); }, true);
-    video.play();
-}
-
-// These two declarations need to be global for "shouldBe" to see them
-var buf = null;
-var idx = 0;
-var pixel = [0, 0, 0];
-var correctColor = null;
-
-function runOneIteration(videoElement, useTexSubImage2D, flipY, topColor, bottomColor)
-{
-    debug('Testing ' + (useTexSubImage2D ? 'texSubImage2D' : 'texImage2D') +
-          ' with flipY=' + flipY);
-    gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
-    // Disable any writes to the alpha channel
-    gl.colorMask(1, 1, 1, 0);
-    var texture = gl.createTexture();
-    // Bind the texture to texture unit 0
-    gl.bindTexture(gl.TEXTURE_2D, texture);
-    // Set up texture parameters
-    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
-    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
-    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);
-    // Set up pixel store parameters
-    gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
-    gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
-    // Upload the videoElement into the texture
-    if (useTexSubImage2D) {
-        // Initialize the texture to black first
-        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA,
-                      videoElement.videoWidth, videoElement.videoHeight, 0,
-                      gl.RGBA, gl.UNSIGNED_BYTE, null);
-        gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, videoElement);
-    } else {
-        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, videoElement);
-    }
-
-    var c = document.createElement("canvas");
-    c.width = 16;
-    c.height = 16;
-    c.style.border = "1px solid black";
-    var ctx = c.getContext("2d");
-    ctx.drawImage(videoElement, 0, 0, 16, 16);
-    document.body.appendChild(c);
-
-    // Point the uniform sampler to texture unit 0
-    gl.uniform1i(textureLoc, 0);
-    // Draw the triangles
-    wtu.drawQuad(gl, [0, 0, 0, 255]);
-    // Check a few pixels near the top and bottom and make sure they have
-    // the right color.
-    debug("Checking lower left corner");
-    wtu.checkCanvasRect(gl, 4, 4, 2, 2, bottomColor,
-                        "shouldBe " + bottomColor);
-    debug("Checking upper left corner");
-    wtu.checkCanvasRect(gl, 4, gl.canvas.height - 8, 2, 2, topColor,
-                        "shouldBe " + topColor);
-}
-
-function runTest(videoElement)
-{
-    var red = [255, 0, 0];
-    var green = [0, 255, 0];
-    runOneIteration(videoElement, false, true, red, green);
-    runOneIteration(videoElement, false, false, green, red);
-    runOneIteration(videoElement, true, true, red, green);
-    runOneIteration(videoElement, true, false, green, red);
-
-    finishTest();
-}
 </script>
 </head>
-<body _onload_="init()">
+<body _onload_='generateTest("RGBA", "UNSIGNED_BYTE", testPrologue)()'>
 <canvas id="example" width="32px" height="32px"></canvas>
 <div id="description"></div>
 <div id="console"></div>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to