| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <title>Canvas test: 2d.gradient.object.invalidoffset</title> | |
| 3 <script src="../tests.js"></script> | |
| 4 <link rel="stylesheet" href="../tests.css"> | |
| 5 <body> | |
| 6 <p id="passtext">Pass</p> | |
| 7 <p id="failtext">Fail</p> | |
| 8 <p class="output">These images should be identical:</p> | |
| 9 <canvas id="c" class="output" width="100" height="50"><p class="fallback">FAIL (
fallback content)</p></canvas> | |
| 10 | |
| 11 <ul id="d"></ul> | |
| 12 <script> | |
| 13 _addTest(function(canvas, ctx) { | |
| 14 | |
| 15 var g = ctx.createLinearGradient(0, 0, 100, 0); | |
| 16 try { var _thrown = false; | |
| 17 g.addColorStop(-1, '#000'); | |
| 18 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) _fail("Failed assertion
: expected exception of type INDEX_SIZE_ERR, got: "+e.message); _thrown = true;
} finally { _assert(_thrown, "should throw exception of type INDEX_SIZE_ERR: g.a
ddColorStop(-1, '#000')"); } | |
| 19 try { var _thrown = false; | |
| 20 g.addColorStop(2, '#000'); | |
| 21 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) _fail("Failed assertion
: expected exception of type INDEX_SIZE_ERR, got: "+e.message); _thrown = true;
} finally { _assert(_thrown, "should throw exception of type INDEX_SIZE_ERR: g.a
ddColorStop(2, '#000')"); } | |
| 22 try { var _thrown = false; | |
| 23 g.addColorStop(Infinity, '#000'); | |
| 24 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) _fail("Failed assertion
: expected exception of type INDEX_SIZE_ERR, got: "+e.message); _thrown = true;
} finally { _assert(_thrown, "should throw exception of type INDEX_SIZE_ERR: g.a
ddColorStop(Infinity, '#000')"); } | |
| 25 try { var _thrown = false; | |
| 26 g.addColorStop(-Infinity, '#000'); | |
| 27 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) _fail("Failed assertion
: expected exception of type INDEX_SIZE_ERR, got: "+e.message); _thrown = true;
} finally { _assert(_thrown, "should throw exception of type INDEX_SIZE_ERR: g.a
ddColorStop(-Infinity, '#000')"); } | |
| 28 try { var _thrown = false; | |
| 29 g.addColorStop(NaN, '#000'); | |
| 30 } catch (e) { if (e.code != DOMException.INDEX_SIZE_ERR) _fail("Failed assertion
: expected exception of type INDEX_SIZE_ERR, got: "+e.message); _thrown = true;
} finally { _assert(_thrown, "should throw exception of type INDEX_SIZE_ERR: g.a
ddColorStop(NaN, '#000')"); } | |
| 31 | |
| 32 | |
| 33 }); | |
| 34 </script> | |
| 35 | |
| OLD | NEW |