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

Side by Side Diff: LayoutTests/fast/canvas/canvas-fillStyle-strokeStyle-stringification.html

Issue 237743007: Handle the DOMString case of CRC2D.fillStyle/strokeStyle correctly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add tests for objects without (explicit) toString. Created 6 years, 8 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 | Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp » ('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 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script>
5 setup(function() {
6 window.ctx = document.createElement('canvas').getContext('2d');
7 });
8
9 test(function() {
10 ctx.fillStyle = "#800000";
11 ctx.fillStyle = { toString: function() { return "#008000"; } };
12 assert_equals(ctx.fillStyle, "#008000");
13 }, 'Stringifies non-CanvasGradient/Pattern object assigned to fillStyle.');
14
15 test(function() {
16 ctx.fillStyle = "#008000";
17 ctx.fillStyle = {};
18 assert_equals(ctx.fillStyle, "#008000");
19 }, 'Non-CanvasGradient/Pattern object without explicit toString() does not affec t the value of fillStyle.');
20
21 test(function() {
22 ctx.fillStyle = "#008000";
23 ctx.fillStyle = 800000;
24 assert_equals(ctx.fillStyle, "#008000");
25 }, 'Stringified numbers don\'t yield a correct color when assigned to fillStyle. ');
26
27 test(function() {
28 assert_throws(new Error(), function() {
29 ctx.fillStyle = { toString: function() { throw new Error("Exception"); } };
30 });
31 }, 'Rethrows exception thrown from toString() during stringification of non-Canv asGradient/Pattern object assigned to fillStyle.');
32
33 test(function() {
34 ctx.strokeStyle = "#800000";
35 ctx.strokeStyle = { toString: function() { return "#008000"; } };
36 assert_equals(ctx.strokeStyle, "#008000");
37 }, 'Stringifies non-CanvasGradient/Pattern object assigned to strokeStyle.');
38
39 test(function() {
40 ctx.strokeStyle = "#008000";
41 ctx.strokeStyle = {};
42 assert_equals(ctx.strokeStyle, "#008000");
43 }, 'Non-CanvasGradient/Pattern object without explicit toString() does not affec t the value of strokeStyle.');
44
45 test(function() {
46 ctx.strokeStyle = "#008000";
47 ctx.strokeStyle = 800000;
48 assert_equals(ctx.strokeStyle, "#008000");
49 }, 'Stringified numbers don\'t yield a correct color when assigned to strokeStyl e.');
50
51 test(function() {
52 assert_throws(new Error(), function() {
53 ctx.strokeStyle = { toString: function() { throw new Error("Exception"); } } ;
54 });
55 }, 'Rethrows exception thrown from toString() during stringification of non-Canv asGradient/Pattern object assigned to strokeStyle.');
56
57 </script>
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/v8/custom/V8CanvasRenderingContext2DCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698