Index: LayoutTests/fast/canvas/webgl/canvas-test.html |
diff --git a/LayoutTests/fast/canvas/webgl/canvas-test.html b/LayoutTests/fast/canvas/webgl/canvas-test.html |
index 99ec31b5b7d6328597902c18df0ce3cc1b42acc0..64ec616afaa42a35548352e2f444adeb5125d88f 100644 |
--- a/LayoutTests/fast/canvas/webgl/canvas-test.html |
+++ b/LayoutTests/fast/canvas/webgl/canvas-test.html |
@@ -6,6 +6,7 @@ |
<title>WebGL Canvas Conformance Tests</title> |
<script src="resources/desktop-gl-constants.js" type="text/javascript"></script> |
<script src="../../../resources/js-test.js"></script> |
+<script src="../../../resources/run-after-display.js"></script> |
<script src="resources/webgl-test.js"></script> |
</head> |
<body> |
@@ -133,50 +134,45 @@ if (!gl) { |
debug("change display size of canvas and see that viewport does not change"); |
canvas.style.width = "100px"; |
canvas.style.height = "25px"; |
- var intervalId; |
- intervalId = window.setInterval(function() { |
- if (window.testRunner) |
- testRunner.display(); |
- if (canvas.clientWidth == 100 && |
- canvas.clientHeight == 25) { |
- window.clearInterval(intervalId); |
- shouldBe('getViewport()', '"0,0,300,150"'); |
- shouldBe('canvas.width', '300'); |
- shouldBe('canvas.height', '150'); |
- |
- // Change the actual size of the canvas |
- // Check that the viewport does not change. |
- // Check that the clear color does not change. |
- // Check that the color mask does not change. |
- debug(""); |
- debug("change the actual size of the canvas and see that the viewport does not change"); |
- gl.clearColor(0.25, 0.5, 0.75, 1); |
- gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); |
- checkCanvasContentIs(64, 128, 192, 255); |
- gl.colorMask(0,0,0,0); |
- canvas.width = 400; |
- canvas.height = 10; |
- |
- var v = gl.getParameter(gl.COLOR_CLEAR_VALUE); |
- assertMsg(isAboutEqual(v[0], 0.25) && |
- isAboutEqual(v[1], 0.5) && |
- isAboutEqual(v[2], 0.75) && |
- isAboutEqual(v[3], 1), |
- "gl.clearColor should not change after canvas resize"); |
- v = gl.getParameter(gl.COLOR_WRITEMASK); |
- assertMsg(isAboutEqual(v[0], 0) && |
- isAboutEqual(v[1], 0) && |
- isAboutEqual(v[2], 0) && |
- isAboutEqual(v[3], 0), |
- "gl.colorMask should not change after canvas resize"); |
- shouldBe('getViewport()', '"0,0,300,150"'); |
- checkCanvasContentIs(0, 0, 0, 0); |
- |
- debug(""); |
- |
- finishJSTest(); |
- } |
- }, 1000/30); |
+ runAfterDisplay(function() { |
+ shouldBe('canvas.clientWidth', '100'); |
+ shouldBe('canvas.clientHeight', '25'); |
+ shouldBe('getViewport()', '"0,0,300,150"'); |
+ shouldBe('canvas.width', '300'); |
+ shouldBe('canvas.height', '150'); |
+ |
+ // Change the actual size of the canvas |
+ // Check that the viewport does not change. |
+ // Check that the clear color does not change. |
+ // Check that the color mask does not change. |
+ debug(""); |
+ debug("change the actual size of the canvas and see that the viewport does not change"); |
+ gl.clearColor(0.25, 0.5, 0.75, 1); |
+ gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); |
+ checkCanvasContentIs(64, 128, 192, 255); |
+ gl.colorMask(0,0,0,0); |
+ canvas.width = 400; |
+ canvas.height = 10; |
+ |
+ var v = gl.getParameter(gl.COLOR_CLEAR_VALUE); |
+ assertMsg(isAboutEqual(v[0], 0.25) && |
+ isAboutEqual(v[1], 0.5) && |
+ isAboutEqual(v[2], 0.75) && |
+ isAboutEqual(v[3], 1), |
+ "gl.clearColor should not change after canvas resize"); |
+ v = gl.getParameter(gl.COLOR_WRITEMASK); |
+ assertMsg(isAboutEqual(v[0], 0) && |
+ isAboutEqual(v[1], 0) && |
+ isAboutEqual(v[2], 0) && |
+ isAboutEqual(v[3], 0), |
+ "gl.colorMask should not change after canvas resize"); |
+ shouldBe('getViewport()', '"0,0,300,150"'); |
+ checkCanvasContentIs(0, 0, 0, 0); |
+ |
+ debug(""); |
+ |
+ finishJSTest(); |
+ }); |
} |
</script> |