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

Side by Side Diff: tests/html/canvas_using_html_test.dart

Issue 10984055: Replacing non-portable CanvasRenderingContext.setFillColor with more portable variants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Syncing to latest. Created 8 years, 2 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 | « tests/html/canvas_test.dart ('k') | tests/html/canvasrenderingcontext2d_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #library('CanvasUsingHtmlTest'); 1 #library('CanvasUsingHtmlTest');
2 #import('../../pkg/unittest/unittest.dart'); 2 #import('../../pkg/unittest/unittest.dart');
3 #import('../../pkg/unittest/html_config.dart'); 3 #import('../../pkg/unittest/html_config.dart');
4 #import('dart:html', prefix: 'html'); 4 #import('dart:html', prefix: 'html');
5 #import('dart:html'); 5 #import('dart:html');
6 6
7 // Version of Canvas test that implicitly uses dart:html library via unittests. 7 // Version of Canvas test that implicitly uses dart:html library via unittests.
8 8
9 main() { 9 main() {
10 CanvasElement canvas; 10 CanvasElement canvas;
11 CanvasRenderingContext2D context; 11 CanvasRenderingContext2D context;
12 12
13 canvas = new Element.tag('canvas'); 13 canvas = new Element.tag('canvas');
14 canvas.attributes['width'] = 100; 14 canvas.attributes['width'] = 100;
15 canvas.attributes['height'] = 100; 15 canvas.attributes['height'] = 100;
16 document.body.nodes.add(canvas); 16 document.body.nodes.add(canvas);
17 context = canvas.getContext('2d'); 17 context = canvas.getContext('2d');
18 18
19 useHtmlConfiguration(); 19 useHtmlConfiguration();
20 test('FillStyle', () { 20 test('FillStyle', () {
21 context.fillStyle = "red"; 21 context.fillStyle = "red";
22 context.fillRect(10, 10, 20, 20); 22 context.fillRect(10, 10, 20, 20);
23 23
24 // TODO(vsm): Verify the result once we have the ability to read pixels. 24 // TODO(vsm): Verify the result once we have the ability to read pixels.
25 }); 25 });
26 test('SetFillColor', () {
27 // With floats.
28 context.setFillColor(10, 10, 10, 10);
29 context.fillRect(10, 10, 20, 20);
30
31 // With rationals.
32 context.setFillColor(10.0, 10.0, 10.0, 10.0);
33 context.fillRect(20, 20, 30, 30);
34
35 // With ints.
36 context.setFillColor(10, 10, 10, 10);
37 context.fillRect(30, 30, 40, 40);
38
39 // TODO(vsm): Verify the result once we have the ability to read pixels.
40 });
41 test('StrokeStyle', () { 26 test('StrokeStyle', () {
42 context.strokeStyle = "blue"; 27 context.strokeStyle = "blue";
43 context.strokeRect(30, 30, 10, 20); 28 context.strokeRect(30, 30, 10, 20);
44 29
45 // TODO(vsm): Verify the result once we have the ability to read pixels. 30 // TODO(vsm): Verify the result once we have the ability to read pixels.
46 }); 31 });
47 test('CreateImageData', () { 32 test('CreateImageData', () {
48 ImageData image = context.createImageData(canvas.width, 33 ImageData image = context.createImageData(canvas.width,
49 canvas.height); 34 canvas.height);
50 Uint8ClampedArray bytes = image.data; 35 Uint8ClampedArray bytes = image.data;
51 36
52 // FIXME: uncomment when numeric index getters are supported. 37 // FIXME: uncomment when numeric index getters are supported.
53 //var byte = bytes[0]; 38 //var byte = bytes[0];
54 39
55 expect(bytes, hasLength(40000)); 40 expect(bytes, hasLength(40000));
56 }); 41 });
57 } 42 }
OLDNEW
« no previous file with comments | « tests/html/canvas_test.dart ('k') | tests/html/canvasrenderingcontext2d_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698