Update WebGL tests

https://github.com/KhronosGroup/WebGL/pull/2702
This commit is contained in:
Anthony Ramine 2018-09-01 02:27:23 +02:00
parent 577830de90
commit 7024c99a86
36 changed files with 457 additions and 194 deletions

View file

@ -15796,6 +15796,12 @@
{} {}
] ]
], ],
"conformance2/context/context-mode.html": [
[
"/_webgl/conformance2/context/context-mode.html",
{}
]
],
"conformance2/context/context-resize-changes-buffer-binding-bug.html": [ "conformance2/context/context-resize-changes-buffer-binding-bug.html": [
[ [
"/_webgl/conformance2/context/context-resize-changes-buffer-binding-bug.html", "/_webgl/conformance2/context/context-resize-changes-buffer-binding-bug.html",
@ -27482,7 +27488,7 @@
"testharness" "testharness"
], ],
"conformance/buffers/buffer-data-array-buffer-delete.html": [ "conformance/buffers/buffer-data-array-buffer-delete.html": [
"c2a8d35e1a965eff1ea8d7117cf030a7471d6231", "579aa2037882da16836eb1e5183afcc3b153d1f6",
"testharness" "testharness"
], ],
"conformance/buffers/buffer-data-dynamic-delay.html": [ "conformance/buffers/buffer-data-dynamic-delay.html": [
@ -27534,7 +27540,7 @@
"testharness" "testharness"
], ],
"conformance/canvas/canvas-test.html": [ "conformance/canvas/canvas-test.html": [
"e1a900a31b53eca74de2e6692fcd28533fe26f41", "072f144888a7dad5ea71ddb941d49bf1c85a4131",
"testharness" "testharness"
], ],
"conformance/canvas/canvas-zero-size.html": [ "conformance/canvas/canvas-zero-size.html": [
@ -27542,11 +27548,11 @@
"testharness" "testharness"
], ],
"conformance/canvas/draw-static-webgl-to-multiple-canvas-test.html": [ "conformance/canvas/draw-static-webgl-to-multiple-canvas-test.html": [
"0770cb5ffc303d66b92b9a9715190afb11485e6b", "35bead3cc5eb245b055bdf312adb187329c4629b",
"testharness" "testharness"
], ],
"conformance/canvas/draw-webgl-to-canvas-test.html": [ "conformance/canvas/draw-webgl-to-canvas-test.html": [
"45b79bbde40f316699aae227160de34c14028092", "27f01d41dfe211fbdafa44ead612daa820746a1e",
"testharness" "testharness"
], ],
"conformance/canvas/drawingbuffer-hd-dpi-test.html": [ "conformance/canvas/drawingbuffer-hd-dpi-test.html": [
@ -27562,7 +27568,7 @@
"testharness" "testharness"
], ],
"conformance/canvas/framebuffer-bindings-affected-by-to-data-url.html": [ "conformance/canvas/framebuffer-bindings-affected-by-to-data-url.html": [
"9cb944a3392de4b14c728a067d01908d1e0e9c96", "b09b00bfde56521dc1cf2bd269e3465fc01133e5",
"testharness" "testharness"
], ],
"conformance/canvas/framebuffer-bindings-unaffected-on-resize.html": [ "conformance/canvas/framebuffer-bindings-unaffected-on-resize.html": [
@ -27570,7 +27576,7 @@
"testharness" "testharness"
], ],
"conformance/canvas/rapid-resizing.html": [ "conformance/canvas/rapid-resizing.html": [
"f423e17f563da0751d96604adc64bbc0537a52bc", "cd3dbb8e9575036c33b12264e9c46b339336db7e",
"testharness" "testharness"
], ],
"conformance/canvas/render-after-resize-test.html": [ "conformance/canvas/render-after-resize-test.html": [
@ -27582,7 +27588,7 @@
"testharness" "testharness"
], ],
"conformance/canvas/to-data-url-test.html": [ "conformance/canvas/to-data-url-test.html": [
"67e26a408ea461faa66394dad11d3efca1c712d9", "d7e77c869899a9d8dfa15a2eb7068c95f66b1c0a",
"testharness" "testharness"
], ],
"conformance/canvas/viewport-unchanged-upon-resize.html": [ "conformance/canvas/viewport-unchanged-upon-resize.html": [
@ -27598,7 +27604,7 @@
"testharness" "testharness"
], ],
"conformance/context/context-attribute-preserve-drawing-buffer.html": [ "conformance/context/context-attribute-preserve-drawing-buffer.html": [
"2726815a7c4ebf3d6a19c29a3e301830ef0ff11d", "64b9e5bf377e131f9d10ef0a68282a485a63dd52",
"testharness" "testharness"
], ],
"conformance/context/context-attributes-alpha-depth-stencil-antialias.html": [ "conformance/context/context-attributes-alpha-depth-stencil-antialias.html": [
@ -27658,7 +27664,7 @@
"testharness" "testharness"
], ],
"conformance/context/premultiplyalpha-test.html": [ "conformance/context/premultiplyalpha-test.html": [
"4f63c2ef232a2e17a83d90d72ba2098c02bbb6a5", "6bf9503c359d71f841fdd9724c3d12bafb006d28",
"testharness" "testharness"
], ],
"conformance/context/resources/context-release-child-with-worker.html": [ "conformance/context/resources/context-release-child-with-worker.html": [
@ -36310,7 +36316,7 @@
"testharness" "testharness"
], ],
"conformance/renderbuffers/framebuffer-state-restoration.html": [ "conformance/renderbuffers/framebuffer-state-restoration.html": [
"4028029e468238e6506bef01797e6ad04b4fb784", "dbef36b66f50a2715395c9773b48246b8b7d586f",
"testharness" "testharness"
], ],
"conformance/renderbuffers/framebuffer-test.html": [ "conformance/renderbuffers/framebuffer-test.html": [
@ -36414,7 +36420,7 @@
"testharness" "testharness"
], ],
"conformance/rendering/multisample-corruption.html": [ "conformance/rendering/multisample-corruption.html": [
"d3d25e0a876973ea397097823ed9132dc892ddcc", "7de9b47f229ac935cdb76b14e6237243ae14ce04",
"testharness" "testharness"
], ],
"conformance/rendering/negative-one-index.html": [ "conformance/rendering/negative-one-index.html": [
@ -36446,7 +36452,7 @@
"testharness" "testharness"
], ],
"conformance/rendering/preservedrawingbuffer-leak.html": [ "conformance/rendering/preservedrawingbuffer-leak.html": [
"bd1dccbdeea10de6d62f31ce9e6c46048134b276", "3df53551ef062f8c5a9b52003f2a564db14d990f",
"testharness" "testharness"
], ],
"conformance/rendering/rendering-stencil-large-viewport.html": [ "conformance/rendering/rendering-stencil-large-viewport.html": [
@ -36970,7 +36976,7 @@
"testharness" "testharness"
], ],
"conformance/textures/misc/tex-video-using-tex-unit-non-zero.html": [ "conformance/textures/misc/tex-video-using-tex-unit-non-zero.html": [
"8db7d43610e820a46b9662103cffe9c86f819edc", "9abe3bd71772133857507f18a5a6fcfc95b080da",
"testharness" "testharness"
], ],
"conformance/textures/misc/texparameter-test.html": [ "conformance/textures/misc/texparameter-test.html": [
@ -37062,7 +37068,7 @@
"testharness" "testharness"
], ],
"conformance/textures/misc/texture-upload-size.html": [ "conformance/textures/misc/texture-upload-size.html": [
"59934e4ede1ab612ad2c7342bac79ddbe4db4d68", "8832033dd705cc6ccea02c58eff879a8f2f59e3e",
"testharness" "testharness"
], ],
"conformance/textures/misc/texture-with-flip-y-and-premultiply-alpha.html": [ "conformance/textures/misc/texture-with-flip-y-and-premultiply-alpha.html": [
@ -37426,7 +37432,7 @@
"testharness" "testharness"
], ],
"conformance2/context/00_test_list.txt": [ "conformance2/context/00_test_list.txt": [
"c2d13238b2991ae4e3d0ea802f6a63c2c40dd455", "fc4f8b8c07fcbe15156d55a4a58ddb2727567dc9",
"support" "support"
], ],
"conformance2/context/constants-and-properties-2.html": [ "conformance2/context/constants-and-properties-2.html": [
@ -37437,6 +37443,10 @@
"5476f4e3a68be618c89380128f77d0b97b333457", "5476f4e3a68be618c89380128f77d0b97b333457",
"testharness" "testharness"
], ],
"conformance2/context/context-mode.html": [
"fa44ce4c877adf82bf6245776b9b1237ad557d89",
"testharness"
],
"conformance2/context/context-resize-changes-buffer-binding-bug.html": [ "conformance2/context/context-resize-changes-buffer-binding-bug.html": [
"c169eed8a573eed8ec12efea9093e55d477e8b44", "c169eed8a573eed8ec12efea9093e55d477e8b44",
"testharness" "testharness"
@ -37934,7 +37944,7 @@
"testharness" "testharness"
], ],
"conformance2/rendering/canvas-resizing-with-pbo-bound.html": [ "conformance2/rendering/canvas-resizing-with-pbo-bound.html": [
"bb303081fc8e012d03d2056f6c1028026eb91236", "78f7f9da22268d73fddb2e33c9c08e929efe65ab",
"testharness" "testharness"
], ],
"conformance2/rendering/clear-func-buffer-type-match.html": [ "conformance2/rendering/clear-func-buffer-type-match.html": [
@ -46534,7 +46544,7 @@
"support" "support"
], ],
"js/tests/tex-image-and-sub-image-2d-with-webgl-canvas.js": [ "js/tests/tex-image-and-sub-image-2d-with-webgl-canvas.js": [
"61578ab040f12208119f9afbbf156a8aea47a9d4", "8ade197c61c116a25bbb6dc380334b9cca1010de",
"support" "support"
], ],
"js/tests/tex-image-and-sub-image-3d-with-canvas-sub-rectangle.js": [ "js/tests/tex-image-and-sub-image-3d-with-canvas-sub-rectangle.js": [

View file

@ -1,9 +1,8 @@
[buffer-data-array-buffer-delete.html] [buffer-data-array-buffer-delete.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: gl should be non-null. Was null] [WebGL test #1: context does not exist]
expected: FAIL expected: FAIL

View file

@ -1,8 +1,7 @@
[framebuffer-bindings-affected-by-to-data-url.html] [framebuffer-bindings-affected-by-to-data-url.html]
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] [WebGL test #1: context does not exist]
expected: FAIL expected: FAIL

View file

@ -1,12 +1,74 @@
[premultiplyalpha-test.html] [premultiplyalpha-test.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: gl.getContextAttributes().premultipliedAlpha should be true. Threw exception TypeError: gl is null] [WebGL test #5: context does not exist]
expected: FAIL expected: FAIL
[WebGL test #2: gl.getContextAttributes().preserveDrawingBuffer should be true. Threw exception TypeError: gl is null] [WebGL test #3: context does not exist]
expected: FAIL
[WebGL test #6: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #11: context does not exist]
expected: FAIL
[WebGL test #13: context does not exist]
expected: FAIL
[WebGL test #18: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #14: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #20: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #4: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #15: context does not exist]
expected: FAIL
[WebGL test #23: context does not exist]
expected: FAIL
[WebGL test #17: context does not exist]
expected: FAIL
[WebGL test #8: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #22: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #10: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #21: context does not exist]
expected: FAIL
[WebGL test #2: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL
[WebGL test #19: context does not exist]
expected: FAIL
[WebGL test #7: context does not exist]
expected: FAIL
[WebGL test #9: context does not exist]
expected: FAIL
[WebGL test #16: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL
[WebGL test #12: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL

View file

@ -1,5 +1,7 @@
[framebuffer-state-restoration.html] [framebuffer-state-restoration.html]
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -1,6 +1,8 @@
[multisample-corruption.html] [multisample-corruption.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -1,6 +1,8 @@
[preservedrawingbuffer-leak.html] [preservedrawingbuffer-leak.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -1,6 +1,8 @@
[tex-video-using-tex-unit-non-zero.html] [tex-video-using-tex-unit-non-zero.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -3,3 +3,6 @@
[Overall test] [Overall test]
expected: NOTRUN expected: NOTRUN
[WebGL test #20: could not create image (SVG)]
expected: FAIL

View file

@ -1,6 +1,8 @@
[tex-2d-alpha-alpha-unsigned_byte.html] [tex-2d-alpha-alpha-unsigned_byte.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -1,6 +1,8 @@
[tex-2d-luminance-luminance-unsigned_byte.html] [tex-2d-luminance-luminance-unsigned_byte.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -1,6 +1,8 @@
[tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html] [tex-2d-luminance_alpha-luminance_alpha-unsigned_byte.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -1,6 +1,8 @@
[tex-2d-rgb-rgb-unsigned_byte.html] [tex-2d-rgb-rgb-unsigned_byte.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -1,6 +1,8 @@
[tex-2d-rgb-rgb-unsigned_short_5_6_5.html] [tex-2d-rgb-rgb-unsigned_short_5_6_5.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -1,6 +1,8 @@
[tex-2d-rgba-rgba-unsigned_byte.html] [tex-2d-rgba-rgba-unsigned_byte.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -1,6 +1,8 @@
[tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html] [tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -1,6 +1,8 @@
[tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html] [tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html]
bug: https://github.com/servo/servo/issues/21132 bug: https://github.com/servo/servo/issues/21132
expected: ERROR
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist]
expected: FAIL

View file

@ -1,11 +1,31 @@
[canvas-resizing-with-pbo-bound.html] [canvas-resizing-with-pbo-bound.html]
expected: TIMEOUT
[Overall test]
expected: NOTRUN
[WebGL test #0: Unable to fetch WebGL rendering context for Canvas] [WebGL test #0: Unable to fetch WebGL rendering context for Canvas]
expected: FAIL expected: FAIL
[WebGL test #1: context does not exist] [WebGL test #1: context does not exist]
expected: FAIL expected: FAIL
[WebGL test #13: getError expected: NO_ERROR. Was INVALID_ENUM : No GL error]
expected: FAIL
[WebGL test #26: Pixel unpack buffer binding was lost]
expected: FAIL
[WebGL test #20: Pixel unpack buffer binding was lost]
expected: FAIL
[WebGL test #19: getError expected: NO_ERROR. Was INVALID_ENUM : No GL error]
expected: FAIL
[WebGL test #25: getError expected: NO_ERROR. Was INVALID_ENUM : No GL error]
expected: FAIL
[WebGL test #7: getError expected: NO_ERROR. Was INVALID_ENUM : No GL error]
expected: FAIL
[WebGL test #8: Pixel unpack buffer binding was lost]
expected: FAIL
[WebGL test #14: Pixel unpack buffer binding was lost]
expected: FAIL

View file

@ -56,24 +56,28 @@ canvas.addEventListener(
var wtu = WebGLTestUtils; var wtu = WebGLTestUtils;
var gl = wtu.create3DContext(canvas, {preserveDrawingBuffer: true}); var gl = wtu.create3DContext(canvas, {preserveDrawingBuffer: true});
shouldBeNonNull("gl");
var array = new Float32Array([0]); if (!gl) {
var buf = gl.createBuffer(); testFailed("context does not exist");
gl.bindBuffer(gl.ARRAY_BUFFER, buf);
gl.bufferData(gl.ARRAY_BUFFER, array, gl.STATIC_DRAW);
wtu.glErrorShouldBe(gl, gl.NO_ERROR);
var attribLocation = 1;
gl.enableVertexAttribArray(attribLocation);
gl.vertexAttribPointer(attribLocation, 1, gl.FLOAT, false, 0, 0);
gl.deleteBuffer(buf);
setTimeout(function() {
// Wait for possible context loss
finishTest(); finishTest();
}, 2000); } else {
var array = new Float32Array([0]);
var buf = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buf);
gl.bufferData(gl.ARRAY_BUFFER, array, gl.STATIC_DRAW);
wtu.glErrorShouldBe(gl, gl.NO_ERROR);
var attribLocation = 1;
gl.enableVertexAttribArray(attribLocation);
gl.vertexAttribPointer(attribLocation, 1, gl.FLOAT, false, 0, 0);
gl.deleteBuffer(buf);
setTimeout(function() {
// Wait for possible context loss
finishTest();
}, 2000);
}
var successfullyParsed = true; var successfullyParsed = true;
</script> </script>

View file

@ -57,6 +57,7 @@ var ctx2d = canvas2d.getContext("2d");
var gl = wtu.create3DContext(canvas); var gl = wtu.create3DContext(canvas);
if (!gl) { if (!gl) {
testFailed("context does not exist"); testFailed("context does not exist");
finishTest();
} else { } else {
testPassed("context exists"); testPassed("context exists");

View file

@ -90,8 +90,8 @@ if (!gl) {
err = gl.getError(); err = gl.getError();
debug(""); debug("");
finishTest();
} }
finishTest();
</script> </script>
</body> </body>

View file

@ -93,8 +93,8 @@ if (!gl) {
err = gl.getError(); err = gl.getError();
debug(""); debug("");
finishTest();
} }
finishTest();
</script> </script>
</body> </body>

View file

@ -47,6 +47,11 @@ function test() {
var glCanvas = document.getElementById("example"); var glCanvas = document.getElementById("example");
var gl = wtu.create3DContext(glCanvas, {preserveDrawingBuffer: true, premultipliedAlpha: true}); var gl = wtu.create3DContext(glCanvas, {preserveDrawingBuffer: true, premultipliedAlpha: true});
if (!gl) {
testFailed("context does not exist");
return;
}
var program = wtu.setupColorQuad(gl); var program = wtu.setupColorQuad(gl);
// Clear backbuffer in red. // Clear backbuffer in red.

View file

@ -93,6 +93,8 @@ function nextTest() {
if (!gl) { if (!gl) {
testFailed("context does not exist"); testFailed("context does not exist");
wtu.requestAnimFrame(nextTest);
} else { } else {
testPassed("context exists"); testPassed("context exists");

View file

@ -53,6 +53,7 @@ var main = function() {
if (!gl) { if (!gl) {
testFailed("can't create 3d context"); testFailed("can't create 3d context");
finishTest();
return; return;
} }

View file

@ -84,6 +84,15 @@ function runTest(preserve) {
var ctx1 = c1.getContext('2d'); var ctx1 = c1.getContext('2d');
var ctx2 = c2.getContext('2d'); var ctx2 = c2.getContext('2d');
var gl = wtu.create3DContext(c3, { alpha:false, preserveDrawingBuffer:preserve }); var gl = wtu.create3DContext(c3, { alpha:false, preserveDrawingBuffer:preserve });
if (!gl) {
testFailed("context does not exist");
if (preserve) {
finishTest()
} else {
runTest(true);
}
return;
}
gl.clearColor(1, 0, 0, 1); gl.clearColor(1, 0, 0, 1);
gl.clear(gl.COLOR_BUFFER_BIT); gl.clear(gl.COLOR_BUFFER_BIT);
ctx1.drawImage(c3, 0, 0); ctx1.drawImage(c3, 0, 0);

View file

@ -175,6 +175,12 @@ function doNextTest() {
+ ", antialias: " + antialias + ", antialias: " + antialias
+ ", imageFormat: " + test.imageFormat); + ", imageFormat: " + test.imageFormat);
if (!gl) {
testFailed("context does not exist");
doNextTest();
return;
}
shouldBe('gl.getContextAttributes().premultipliedAlpha', premultipliedAlpha.toString()); shouldBe('gl.getContextAttributes().premultipliedAlpha', premultipliedAlpha.toString());
shouldBeTrue('gl.getContextAttributes().preserveDrawingBuffer'); shouldBeTrue('gl.getContextAttributes().preserveDrawingBuffer');

View file

@ -48,6 +48,11 @@ description();
function test() { function test() {
var gl = wtu.create3DContext("example", {preserveDrawingBuffer: true}); var gl = wtu.create3DContext("example", {preserveDrawingBuffer: true});
if (!gl) {
testFailed("context does not exist");
finishTest();
return;
}
var program = wtu.setupColorQuad(gl); var program = wtu.setupColorQuad(gl);
var colorLoc = gl.getUniformLocation(program, "u_color"); var colorLoc = gl.getUniformLocation(program, "u_color");
gl.enable(gl.DEPTH_TEST); gl.enable(gl.DEPTH_TEST);

View file

@ -51,9 +51,14 @@ debug('Regression test for <a href="https://code.google.com/p/chromium/issues/de
var wtu = WebGLTestUtils; var wtu = WebGLTestUtils;
var gl = wtu.create3DContext("example", {antialias: true, preserveDrawingBuffer: true}); var gl = wtu.create3DContext("example", {antialias: true, preserveDrawingBuffer: true});
var test = IterableTest.createMultisampleCorruptionTest(gl); if (!gl) {
var iterations = parseInt(wtu.getUrlOptions().iterations, 10) || 25; testFailed("context does not exist");
IterableTest.run(test, iterations); finishTest();
} else {
var test = IterableTest.createMultisampleCorruptionTest(gl);
var iterations = parseInt(wtu.getUrlOptions().iterations, 10) || 25;
IterableTest.run(test, iterations);
}
var successfullyParsed = true; var successfullyParsed = true;
</script> </script>

View file

@ -51,9 +51,14 @@ debug('Regression test for <a href="https://code.google.com/p/chromium/issues/de
var wtu = WebGLTestUtils; var wtu = WebGLTestUtils;
var gl = wtu.create3DContext("example", {preserveDrawingBuffer: true}); var gl = wtu.create3DContext("example", {preserveDrawingBuffer: true});
var test = IterableTest.createPreserveDrawingBufferLeakTest(gl); if (!gl) {
var iterations = parseInt(wtu.getUrlOptions().iterations, 10) || 50; testFailed("context does not exist");
IterableTest.run(test, iterations); finishTest();
} else {
var test = IterableTest.createPreserveDrawingBufferLeakTest(gl);
var iterations = parseInt(wtu.getUrlOptions().iterations, 10) || 50;
IterableTest.run(test, iterations);
}
var successfullyParsed = true; var successfullyParsed = true;
</script> </script>

File diff suppressed because one or more lines are too long

View file

@ -137,6 +137,9 @@ var runNextTest = function() {
var img = wtu.makeImage(test.src, function() { var img = wtu.makeImage(test.src, function() {
testImage(test, img); testImage(test, img);
setTimeout(runNextTest, 0); setTimeout(runNextTest, 0);
}, function () {
testFailed("could not create image" + (test.isSVG ? " (SVG)" : ""));
setTimeout(runNextTest, 0);
}); });
} else if (test.type == "video") { } else if (test.type == "video") {
debug("HTMLVideoElement (" + test.videoType + ")"); debug("HTMLVideoElement (" + test.videoType + ")");

View file

@ -1,5 +1,6 @@
constants-and-properties-2.html constants-and-properties-2.html
context-attributes-depth-stencil-antialias-obeyed.html context-attributes-depth-stencil-antialias-obeyed.html
--min-version 2.0.1 context-mode.html
--min-version 2.0.1 context-sharing-texture2darray-texture3d-data-bug.html --min-version 2.0.1 context-sharing-texture2darray-texture3d-data-bug.html
context-type-test-2.html context-type-test-2.html
--min-version 2.0.1 context-resize-changes-buffer-binding-bug.html --min-version 2.0.1 context-resize-changes-buffer-binding-bug.html

View file

@ -0,0 +1,79 @@
<!--
/*
** Copyright (c) 2018 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL2 Canvas Context Mode Conformance Tests</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="../../js/js-test-pre.js"></script>
<script src="../../js/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
"use strict";
description("This test ensures WebGL 2.0 implementations respect the canvas's context mode.");
debug("");
assertMsg(window.WebGLRenderingContext,
"WebGL2RenderingContext should be a member of window");
assertMsg('WebGL2RenderingContext' in window,
"WebGL2RenderingContext should be 'in' window");
function testContextMode(mode, altMode) {
debug("Testing " + mode + " context type");
let c = document.createElement('canvas');
c.width = 2;
c.height = 2;
let gl = c.getContext(mode);
assertMsg(c.getContext(mode) == gl,
"Canvas.getContext('" + mode + "') should return the same value every time");
try {
assertMsg(c.getContext(altMode) == null,
"Canvas.getContext('" + altMode + "') after getContext('" + mode + "') should return null");
} catch (e) {
testFailed("Canvas.getContext('" + altMode + "') after getContext('" + mode + "') should not throw an exception");
}
}
testContextMode('webgl2', 'webgl');
testContextMode('webgl', 'webgl2');
debug("");
var successfullyParsed = true;
</script>
<script src="../../js/js-test-post.js"></script>
</body>
</html>

View file

@ -78,6 +78,8 @@ function nextTest() {
if (!gl) { if (!gl) {
testFailed("context does not exist"); testFailed("context does not exist");
wtu.requestAnimFrame(nextTest);
} else { } else {
testPassed("context exists"); testPassed("context exists");

View file

@ -225,6 +225,11 @@ function generateTest(internalFormat, pixelFormat, pixelType, prologue, resource
// Note: We use preserveDrawingBuffer:true to prevent canvas // Note: We use preserveDrawingBuffer:true to prevent canvas
// visibility from interfering with the tests. // visibility from interfering with the tests.
var visibleCtx = wtu.create3DContext(null, { preserveDrawingBuffer:true }); var visibleCtx = wtu.create3DContext(null, { preserveDrawingBuffer:true });
if (!visibleCtx) {
testFailed("context does not exist");
finishTest();
return;
}
var visibleCanvas = visibleCtx.canvas; var visibleCanvas = visibleCtx.canvas;
var descriptionNode = document.getElementById("description"); var descriptionNode = document.getElementById("description");
document.body.insertBefore(visibleCanvas, descriptionNode); document.body.insertBefore(visibleCanvas, descriptionNode);