2011-01-11 Adrienne Walker <enne@google.com>
authorenne@google.com <enne@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jan 2011 00:39:20 +0000 (00:39 +0000)
committerenne@google.com <enne@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 12 Jan 2011 00:39:20 +0000 (00:39 +0000)
        Reviewed by Kenneth Russell.

        Sync WebGL texImage2D video test from Khronos and re-enable it.
        https://bugs.webkit.org/show_bug.cgi?id=44459

        * fast/canvas/webgl/resources/quadrants.mp4: Removed.
        * fast/canvas/webgl/resources/quadrants.ogv: Removed.
        * fast/canvas/webgl/resources/red-green.mp4: Added.
        * fast/canvas/webgl/resources/red-green.theora.ogv: Added.
        * fast/canvas/webgl/resources/red-green.webmvp8.webm: Added.
        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt:
        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html:
        * platform/chromium-gpu/test_expectations.txt:
        * platform/chromium/test_expectations.txt:
        * platform/mac-snowleopard/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@75570 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/canvas/webgl/resources/quadrants.mp4 [deleted file]
LayoutTests/fast/canvas/webgl/resources/quadrants.ogv [deleted file]
LayoutTests/fast/canvas/webgl/resources/red-green.mp4 [new file with mode: 0644]
LayoutTests/fast/canvas/webgl/resources/red-green.theora.ogv [new file with mode: 0644]
LayoutTests/fast/canvas/webgl/resources/red-green.webmvp8.webm [new file with mode: 0644]
LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt
LayoutTests/fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html
LayoutTests/platform/chromium-gpu/test_expectations.txt
LayoutTests/platform/chromium/test_expectations.txt
LayoutTests/platform/mac-snowleopard/Skipped

index 96e35e37378ece467438f5daed2635b213a5e99a..3eab91382e369ec525922b1cbef809e8912dfc27 100644 (file)
@@ -1,3 +1,21 @@
+2011-01-11  Adrienne Walker  <enne@google.com>
+
+        Reviewed by Kenneth Russell.
+
+        Sync WebGL texImage2D video test from Khronos and re-enable it.
+        https://bugs.webkit.org/show_bug.cgi?id=44459
+
+        * fast/canvas/webgl/resources/quadrants.mp4: Removed.
+        * fast/canvas/webgl/resources/quadrants.ogv: Removed.
+        * fast/canvas/webgl/resources/red-green.mp4: Added.
+        * fast/canvas/webgl/resources/red-green.theora.ogv: Added.
+        * fast/canvas/webgl/resources/red-green.webmvp8.webm: Added.
+        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video-expected.txt:
+        * fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html:
+        * platform/chromium-gpu/test_expectations.txt:
+        * platform/chromium/test_expectations.txt:
+        * platform/mac-snowleopard/Skipped:
+
 2011-01-11  Mihai Parparita  <mihaip@chromium.org>
 
         Unreviewed, new chromium-mac baselines.
diff --git a/LayoutTests/fast/canvas/webgl/resources/quadrants.mp4 b/LayoutTests/fast/canvas/webgl/resources/quadrants.mp4
deleted file mode 100644 (file)
index bab4f8d..0000000
Binary files a/LayoutTests/fast/canvas/webgl/resources/quadrants.mp4 and /dev/null differ
diff --git a/LayoutTests/fast/canvas/webgl/resources/quadrants.ogv b/LayoutTests/fast/canvas/webgl/resources/quadrants.ogv
deleted file mode 100644 (file)
index 13f5568..0000000
Binary files a/LayoutTests/fast/canvas/webgl/resources/quadrants.ogv and /dev/null differ
diff --git a/LayoutTests/fast/canvas/webgl/resources/red-green.mp4 b/LayoutTests/fast/canvas/webgl/resources/red-green.mp4
new file mode 100644 (file)
index 0000000..4bd6d59
Binary files /dev/null and b/LayoutTests/fast/canvas/webgl/resources/red-green.mp4 differ
diff --git a/LayoutTests/fast/canvas/webgl/resources/red-green.theora.ogv b/LayoutTests/fast/canvas/webgl/resources/red-green.theora.ogv
new file mode 100644 (file)
index 0000000..1543915
Binary files /dev/null and b/LayoutTests/fast/canvas/webgl/resources/red-green.theora.ogv differ
diff --git a/LayoutTests/fast/canvas/webgl/resources/red-green.webmvp8.webm b/LayoutTests/fast/canvas/webgl/resources/red-green.webmvp8.webm
new file mode 100644 (file)
index 0000000..fde59a1
Binary files /dev/null and b/LayoutTests/fast/canvas/webgl/resources/red-green.webmvp8.webm differ
index 9bc08acc23996f85e7e01044add3070d17f29f04..ae3e24a5331b120ac7f45de8419adf8a902a9916 100644 (file)
@@ -1,39 +1,28 @@
-Verify texImage2D and texSubImage2D code paths taking Videos
+Verify texImage2D and texSubImage2D code paths taking Video Elements
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
-Testing texImage2D with flipY=false
-PASS pixelAt(0, 0) is red
-PASS pixelAt(bufWidth-1, 0) is green
-PASS pixelAt(0, bufHeight-1) is yellow
-PASS pixelAt(bufWidth-1, bufHeight-1) is blue
 Testing texImage2D with flipY=true
-PASS pixelAt(0, 0) is yellow
-PASS pixelAt(bufWidth-1, 0) is blue
-PASS pixelAt(0, bufHeight-1) is red
-PASS pixelAt(bufWidth-1, bufHeight-1) is green
-Testing TexSubImage2D with flipY=false, scale=2, ox=0, oy=0
-PASS pixelAt(0, 0) is red
-PASS pixelAt(bufWidth-1, 0) is black
-PASS pixelAt(0, bufHeight-1) is black
-PASS pixelAt(bufWidth-1, bufHeight-1) is black
-Testing TexSubImage2D with flipY=true, scale=2, ox=0, oy=0
-PASS pixelAt(0, 0) is yellow
-PASS pixelAt(bufWidth-1, 0) is black
-PASS pixelAt(0, bufHeight-1) is black
-PASS pixelAt(bufWidth-1, bufHeight-1) is black
-Testing TexSubImage2D with flipY=false, scale=2, ox=0.5, oy=0.5
-PASS pixelAt(0, 0) is black
-PASS pixelAt(bufWidth-1, 0) is black
-PASS pixelAt(0, bufHeight-1) is black
-PASS pixelAt(bufWidth-1, bufHeight-1) is blue
-Testing TexSubImage2D with flipY=true, scale=2, ox=0.5, oy=0.5
-PASS pixelAt(0, 0) is black
-PASS pixelAt(bufWidth-1, 0) is black
-PASS pixelAt(0, bufHeight-1) is black
-PASS pixelAt(bufWidth-1, bufHeight-1) is green
+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 successfullyParsed is true
 
 TEST COMPLETE
-
index 1eae5d4042bdf777ed3329671ca7c140dfa7ca9a..0189c635c19756803c682a3eba60052f26cc5cb2 100644 (file)
@@ -4,20 +4,19 @@
 <script src="../../js/resources/js-test-pre.js"></script>
 <script src="resources/webgl-test.js"></script>
 <script src="resources/webgl-test-utils.js"></script>
-<script src="../../../media/media-file.js"></script>
 <script>
 var wtu = WebGLTestUtils;
 var gl = null;
 var textureLoc = null;
 var successfullyParsed = false;
 
+if (window.initNonKhronosFramework) {
+    window.initNonKhronosFramework(true);
+}
+
 function init()
 {
-    if (window.initNonKhronosFramework) {
-        window.initNonKhronosFramework(true);
-    }
-
-    description('Verify texImage2D and texSubImage2D code paths taking Videos');
+    description('Verify texImage2D and texSubImage2D code paths taking Video Elements');
 
     var canvas = document.getElementById("example");
     gl = wtu.create3DContext(canvas);
@@ -28,127 +27,90 @@ function init()
 
     textureLoc = gl.getUniformLocation(gl.program, "tex");
 
-    var mediaFile = findMediaFile("video", "resources/quadrants");
-    loadVideo(mediaFile);
+    var video = document.getElementById("vid");
+    video.addEventListener(
+        "playing", function() { runTest(video); }, true);
+    video.play();
 }
 
-function loadVideo(src) {
-    var video = document.getElementsByTagName('video')[0];
-
-    function startVideo() {
-        // Resize canvas to fit video.
-        var canvas = document.getElementsByTagName('canvas')[0];
-        canvas.width = video.videoWidth;
-        canvas.height = video.videoHeight;
-
-        runTest(video);
-    };
-    video.addEventListener("canplay", startVideo);
-    video.src = src;
-}
-
-// These declarations need to be global for "shouldBe" to see them
+// These two declarations need to be global for "shouldBe" to see them
 var buf = null;
-var bufWidth;
-var bufHeight;
-var red = [255, 0, 0, 255];
-var green = [0, 255, 0, 255];
-var blue = [0, 0, 255, 255];
-var yellow = [255, 255, 0, 255];
-var black = [0, 0, 0, 255];
-var clear = [127, 127, 127, 255];
-function pixelAt(x, y) {
-    var index = y * bufWidth * 4 + x * 4;
-    return [buf[index], buf[index+1], buf[index+2], buf[index+3]];
-}
-
-function runOneIteration(video, flipY, useTexSubImage2D, ulColor, urColor, blColor, brColor, ox, oy, scale) {
-    var canvas = document.getElementsByTagName('canvas')[0];
-    gl.viewport(0, 0, canvas.width, canvas.height);
+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 image into the texture
+    // Upload the videoElement into the texture
     if (useTexSubImage2D) {
-        // Fill initial texture with black.
-        var texWidth = scale * canvas.width;
-        var texHeight = scale * canvas.height;
-        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, texWidth, texHeight, 0,
+        // 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, ox * texWidth, oy * texHeight, gl.RGBA, gl.UNSIGNED_BYTE, video);
-        debug('Testing TexSubImage2D with flipY=' + flipY +', scale=' + scale + ', ox=' + ox + ', oy=' + oy);
+        gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, gl.RGBA, gl.UNSIGNED_BYTE, videoElement);
     } else {
-        debug('Testing texImage2D with flipY=' + flipY);
-        gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, video);
+        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, clear);
-    // Read back the rendering results
-    bufWidth = canvas.width;
-    bufHeight = canvas.height;
-    buf = new Uint8Array(bufWidth * bufHeight * 4);
-    gl.readPixels(0, 0, bufWidth, bufHeight, gl.RGBA, gl.UNSIGNED_BYTE, buf);
-
-    shouldBe("pixelAt(0, 0)", ulColor);
-    shouldBe("pixelAt(bufWidth-1, 0)", urColor);
-    shouldBe("pixelAt(0, bufHeight-1)", blColor);
-    shouldBe("pixelAt(bufWidth-1, bufHeight-1)", brColor);
+    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(video)
+function runTest(videoElement)
 {
-    // Original square should have red, green, yellow, blue quadrants,
-    // with a cross in the middle:
-    //
-    // R|G
-    // -+-
-    // Y|B
-
-    // texImage2D the whole texture
-    runOneIteration(video, false, false, "red", "green", "yellow", "blue");
-    runOneIteration(video, true, false, "yellow", "blue", "red", "green");
-
-    // texSubImage2D upper left
-    runOneIteration(video, false, true, "red", "black", "black", "black", 0, 0, 2);
-    runOneIteration(video, true, true, "yellow", "black", "black", "black", 0, 0, 2);
-
-    // texSubImage2D lower right
-    runOneIteration(video, false, true, "black", "black", "black", "blue", 0.5, 0.5, 2);
-    runOneIteration(video, true, true, "black", "black", "black", "green", 0.5, 0.5, 2);
-
-    successfullyParsed = true;
-    var epilogue = document.createElement("script");
-    epilogue.onload = finish;
-    epilogue.src = "../../js/resources/js-test-post.js";
-    document.body.appendChild(epilogue);
-}
-
-function finish() {
-    if (window.nonKhronosFrameworkNotifyDone) {
-        window.nonKhronosFrameworkNotifyDone();
-    }
+    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()">
-<video id="sourcevideo"></video>
-<canvas id="example"></canvas>
+<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="resources/red-green.mp4"  type='video/mp4; codecs="avc1.42E01E, mp4a.40.2"' />
+  <source src="resources/red-green.webmvp8.webm" type='video/webm; codecs="vp8, vorbis"' />
+  <source src="resources/red-green.theora.ogv"  type='video/ogg; codecs="theora, vorbis"' />
+</video>
 </body>
 </html>
index a2caf79deb1bc07c1201f203db688e1b2bd38fae..e54c2e1705003ff64d633877807fe108a31c03b0 100644 (file)
@@ -200,7 +200,6 @@ BUGWK45991 WIN : canvas/philip/tests/2d.gradient.radial.touch2.html = TEXT
 BUGWK43086 : fast/canvas/canvas-ImageData-behaviour.html = TEXT
 BUGWEBGL : fast/canvas/webgl/css-webkit-canvas-repaint.html = IMAGE
 BUGWEBGL : fast/canvas/webgl/css-webkit-canvas.html = IMAGE
-BUGWEBGL WIN MAC : fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html = TEXT PASS
 BUGWEBGL WIN : fast/canvas/webgl/tex-image-and-sub-image-2d-with-array-buffer-view.html = CRASH PASS
 BUGWEBGL : fast/canvas/webgl/gl-uniform-arrays.html = TEXT
 BUGWEBGL : fast/canvas/webgl/point-size.html = TEXT
index b944c15a6bc1bf6f9bff207250a42f8edc50890f..cd383d6d8958ccb18643232e0ce77943cb95ce1d 100644 (file)
@@ -2543,7 +2543,6 @@ BUGDPRANKE BUGCR60845 WIN LINUX : media/video-poster.html = PASS TEXT
 
 BUGWEBGL : fast/canvas/webgl/css-webkit-canvas-repaint.html = IMAGE
 BUGWEBGL : fast/canvas/webgl/css-webkit-canvas.html = IMAGE
-BUGWEBGL WIN MAC : fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html = TEXT PASS
 BUGWEBGL WIN : fast/canvas/webgl/tex-image-and-sub-image-2d-with-array-buffer-view.html = CRASH PASS
 BUGWEBGL WIN DEBUG : fast/canvas/webgl/texture-complete.html = PASS TEXT
 BUGWEBGL : fast/canvas/webgl/read-pixels-test.html = TIMEOUT
index 9bdc2de85dd3291a8afd37cd55bd801794ef1b14..01b1ded547dbdbc61a2ce9722068d596b3670a22 100644 (file)
@@ -109,9 +109,6 @@ platform/mac/fonts/color-bitmap.html
 # Snow Leopard bot does not support EXT_packed_depth_stencil, which is required by WebGL.
 # https://bugs.webkit.org/show_bug.cgi?id=36925
 fast/canvas/webgl/framebuffer-object-attachment.html
-# The video upload test is failing on the bots for some currently unknown reason.
-# https://bugs.webkit.org/show_bug.cgi?id=44459
-fast/canvas/webgl/tex-image-and-sub-image-2d-with-video.html
 
 # https://bugs.webkit.org/show_bug.cgi?id=52237
 fast/canvas/webgl/read-pixels-test.html