blob: 70fa75c2d89ef2865d53e9ee5d98a4e31d47c90d [file] [log] [blame]
PASS successfullyParsed is true
TEST COMPLETE
Check for drawing webgl to canvas 2d on the same frame.
1) when drawingBuffer is preserved.
PASS imgdata[0] is 255
PASS imgdata[1] is 0
PASS imgdata[2] is 0
PASS imgdata[0] is 0
PASS imgdata[1] is 255
PASS imgdata[2] is 0
2) when drawingBuffer is not preserved.
PASS imgdata[0] is 255
PASS imgdata[1] is 0
PASS imgdata[2] is 0
PASS imgdata[0] is 0
PASS imgdata[1] is 255
PASS imgdata[2] is 0
Check for drawing webgl to canvas 2d several frames after drawing webgl contents.
1) when drawingBuffer is preserved.
PASS imgdata[0] is 255
PASS imgdata[1] is 0
PASS imgdata[2] is 0
PASS imgdata[0] is 0
PASS imgdata[1] is 255
PASS imgdata[2] is 0
2) when drawingBuffer is not preserved. It leads to undefined behavior.
PASS imgdata[0] is 255
PASS imgdata[1] is 0
PASS imgdata[2] is 0
PASS imgdata[0] is 255
PASS imgdata[1] is 0
PASS imgdata[2] is 0
This test checks for drawing webgl to canvas 2d. The test process is as follows: 1. draw a green rect on a webgl context. 2. draw a red rect on a canvas 2d context, and check a pixel (should be red). 3. draw the webgl contents on the canvas 2d context, and check a pixel (should be green). 4. wait for few frames. 5. draw a red rect on the canvas 2d context, and check a pixel (should be red). 6. draw the webgl contents on the canvas 2d context, and check a pixel (see below explanation). Above test is executed for both preserve and non-preserve webgl contexts. For the preserve webgl context, the pixel on #6 is green. For the non-preserve webgl context, the pixel on #6 is undefined.[1] [1] http://www.khronos.org/registry/webgl/specs/latest/1.0/. "This default behavior can be changed by setting the preserveDrawingBuffer attribute of the WebGLContextAttributes object. If this flag is true, the contents of the drawing buffer shall be preserved until the author either clears or overwrites them. If this flag is false, attempting to perform operations using this context as a source image after the rendering function has returned can lead to undefined behavior.".