| OLD | NEW |
| 1 var gl; | 1 var gl; |
| 2 | 2 |
| 3 function main() | 3 function main() |
| 4 { | 4 { |
| 5 if (!window.testRunner) { | 5 if (!window.testRunner) { |
| 6 testFailed("Requires window.testRunner"); | 6 testFailed("Requires window.testRunner"); |
| 7 } else { | 7 } else { |
| 8 testRunner.waitUntilDone(); | 8 testRunner.waitUntilDone(); |
| 9 testRunner.setPrinting(); | 9 testRunner.setPrinting(); |
| 10 testRunner.dumpAsText(); | 10 testRunner.dumpAsText(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 pixel = [ | 59 pixel = [ |
| 60 data[4 * (width * y + x) + 0], | 60 data[4 * (width * y + x) + 0], |
| 61 data[4 * (width * y + x) + 1], | 61 data[4 * (width * y + x) + 1], |
| 62 data[4 * (width * y + x) + 2], | 62 data[4 * (width * y + x) + 2], |
| 63 data[4 * (width * y + x) + 3] | 63 data[4 * (width * y + x) + 3] |
| 64 ]; | 64 ]; |
| 65 } | 65 } |
| 66 | 66 |
| 67 function completionCallback(width, height, snapshot) { | 67 function completionCallback(width, height, snapshot) { |
| 68 var test = testsAndExpectations[testIndex]; | 68 var test = testsAndExpectations[testIndex]; |
| 69 debug('Snapshot width: ' + width + ' height: ' + height); |
| 69 debug('Test ' + testIndex + ': canvas should be ' + test['description']); | 70 debug('Test ' + testIndex + ': canvas should be ' + test['description']); |
| 70 try { | 71 try { |
| 71 var expectation = test['expected']; | 72 var expectation = test['expected']; |
| 72 fetchPixelAt(50, 50, width, height, snapshot); | 73 fetchPixelAt(50, 50, width, height, snapshot); |
| 73 shouldBeCloseTo('pixel[0]', expectation[0], tolerance); | 74 shouldBeCloseTo('pixel[0]', expectation[0], tolerance); |
| 74 shouldBeCloseTo('pixel[1]', expectation[1], tolerance); | 75 shouldBeCloseTo('pixel[1]', expectation[1], tolerance); |
| 75 shouldBeCloseTo('pixel[2]', expectation[2], tolerance); | 76 shouldBeCloseTo('pixel[2]', expectation[2], tolerance); |
| 76 } catch (e) { | 77 } catch (e) { |
| 77 debug('error in completionCallback'); | 78 debug('error in completionCallback'); |
| 78 debug(e); | 79 debug(e); |
| 79 testRunner.notifyDone(); | 80 testRunner.notifyDone(); |
| 80 return; | 81 return; |
| 81 } | 82 } |
| 82 | 83 |
| 83 ++testIndex; | 84 ++testIndex; |
| 84 window.requestAnimationFrame(nextTest); | 85 window.requestAnimationFrame(nextTest); |
| 85 } | 86 } |
| 86 | 87 |
| 87 function draw(r, g, b, a) | 88 function draw(r, g, b, a) |
| 88 { | 89 { |
| 89 gl.clearColor(r, g, b, a); | 90 gl.clearColor(r, g, b, a); |
| 90 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); | 91 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); |
| 91 } | 92 } |
| 92 | 93 |
| 93 main(); | 94 main(); |
| OLD | NEW |