From bc1fe63ee1684aff0bf4ae146c55ca3f633f7c20 Mon Sep 17 00:00:00 2001 From: Matt Kelly Date: Mon, 9 Apr 2012 17:05:05 -0700 Subject: [PATCH] Adding canvas-3d test. --- tests/canvas-3d/config.yml | 4 ++++ tests/canvas-3d/fixture.html | 1 + tests/canvas-3d/iframe.html | 2 ++ tests/canvas-3d/test.js | 28 ++++++++++++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 tests/canvas-3d/config.yml create mode 100644 tests/canvas-3d/fixture.html create mode 100644 tests/canvas-3d/iframe.html create mode 100644 tests/canvas-3d/test.js diff --git a/tests/canvas-3d/config.yml b/tests/canvas-3d/config.yml new file mode 100644 index 0000000..abb2f76 --- /dev/null +++ b/tests/canvas-3d/config.yml @@ -0,0 +1,4 @@ +--- + r: 2 + spec: "https://www.khronos.org/registry/webgl/specs/latest/" + title: "Canvas 3D" diff --git a/tests/canvas-3d/fixture.html b/tests/canvas-3d/fixture.html new file mode 100644 index 0000000..8f435bb --- /dev/null +++ b/tests/canvas-3d/fixture.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tests/canvas-3d/iframe.html b/tests/canvas-3d/iframe.html new file mode 100644 index 0000000..08b362a --- /dev/null +++ b/tests/canvas-3d/iframe.html @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/tests/canvas-3d/test.js b/tests/canvas-3d/test.js new file mode 100644 index 0000000..f7346c6 --- /dev/null +++ b/tests/canvas-3d/test.js @@ -0,0 +1,28 @@ +test("Canvas 3D", function() { + var WebGLRenderingContext = window.WebGLRenderingContext; + + assert( !!WebGLRenderingContext, "WebGLRenderingContext supported" ); +}); + + +test("Canvas 3D Context", function() { + var WebGLRenderingContext = window.WebGLRenderingContext, + canvas = document.createElement("canvas"), + contexts = [ + "3d", "webgl", "experimental-webgl", + "moz-webgl", "webkit-3d", "opera-3d", "ms-webgl", "ms-3d" + ], + which, + context; + + while ( contexts.length ) { + which = contexts.pop(); + context = canvas.getContext( which ); + + if ( context ) { + break; + } + } + + assert( !!WebGLRenderingContext, "WebGLRenderingContext supported (" + which + ")" ); +});