3 <script src=
"../../../resources/js-test.js"></script>
4 <script src=
"resources/webgl-test.js"></script>
5 <script src=
"resources/webgl-test-utils.js"> </script>
8 <div id=
"description"></div>
9 <div id=
"console"></div>
11 description("Checks that painting WebGL contents doesn't pollute the context's viewport state.");
13 var wtu
= WebGLTestUtils
;
15 if (window
.testRunner
) {
16 testRunner
.dumpAsText();
17 testRunner
.waitUntilDone();
24 var viewport
= context
.getParameter(context
.VIEWPORT
);
26 if (!areArraysEqual(viewport
, [20, 20, 10, 10])) {
27 testFailed(viewport
+ " should be [20, 20, 10, 10]. Was " + viewport
);
29 testPassed("Viewport not corrupted.");
32 if (window
.testRunner
)
33 testRunner
.notifyDone();
36 window
.onload = function()
38 if (window
.initNonKhronosFramework
) {
39 window
.initNonKhronosFramework(false);
42 canvas
= document
.getElementById("webgl-canvas");
43 canvas
.width
= 50; canvas
.height
= 50;
44 context
= create3DContext(canvas
);
46 context
.viewport(20, 20, 10, 10);
48 context
.clearColor(255, 0, 0, 255);
49 context
.clear(context
.COLOR_BUFFER_BIT
| context
.DEPTH_BUFFER_BIT
);
51 // We need to ensure that the compositor has run before the drawing
52 // takes place. Setting a timeout of zero causes the compositor to run before
53 // the draw call. Using requestAnimationFrame caused the test to time-out.
57 <canvas id=
"webgl-canvas" width=
"32px" height=
"32px"></canvas>