Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: LayoutTests/canvas/philip/tests/2d.gradient.object.invalidoffset.html

Issue 268443003: Make CanvasGradient.addColorStop throw TypeError for non-finite offsets (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/canvas/philip/tests/2d.gradient.object.invalidoffset-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/canvas/philip/tests/2d.gradient.object.invalidoffset-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698