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

Side by Side Diff: LayoutTests/dart/dom/CanvasUsingHtml.dart

Issue 9188009: Things to unfork. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 8 years, 11 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 | « LayoutTests/dart/dom/Canvas-expected.txt ('k') | LayoutTests/dart/dom/CanvasUsingHtml.html » ('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 #import('../../../../../dart/client/testing/unittest/unittest.dart');
2 #import('dart:html', prefix: 'html');
3 #import('dart:dom');
4
5 // Version of Canvas test that implicitly uses dart:html library via unittests.
6
7 main() {
8 HTMLCanvasElement canvas;
9 CanvasRenderingContext2D context;
10
11 // FIXME: once main is run on content loaded, this hack won't be necessary.
12 window.setTimeout(() {
13 canvas = document.createElement('canvas');
14 canvas.setAttribute('width', '100');
15 canvas.setAttribute('height', '100');
16 document.body.appendChild(canvas);
17 context = canvas.getContext('2d');
18 }, 0);
19
20 forLayoutTests();
21 test('FillStyle', () {
22 context.fillStyle = "red";
23 context.fillRect(10, 10, 20, 20);
24
25 // TODO(vsm): Verify the result once we have the ability to read pixels.
26 });
27 test('SetFillColor', () {
28 // With floats.
29 context.setFillColor(10, 10, 10, 10);
30 context.fillRect(10, 10, 20, 20);
31
32 // With rationals.
33 context.setFillColor(10.0, 10.0, 10.0, 10.0);
34 context.fillRect(20, 20, 30, 30);
35
36 // With ints.
37 context.setFillColor(10, 10, 10, 10);
38 context.fillRect(30, 30, 40, 40);
39
40 // TODO(vsm): Verify the result once we have the ability to read pixels.
41 });
42 test('StrokeStyle', () {
43 context.strokeStyle = "blue";
44 context.strokeRect(30, 30, 10, 20);
45
46 // TODO(vsm): Verify the result once we have the ability to read pixels.
47 });
48 test('CreateImageData', () {
49 ImageData image = context.createImageData(canvas.width,
50 canvas.height);
51 CanvasPixelArray bytes = image.data;
52
53 // FIXME: uncomment when numeric index getters are supported.
54 //var byte = bytes[0];
55
56 Expect.equals(40000, bytes.length);
57 });
58 }
OLDNEW
« no previous file with comments | « LayoutTests/dart/dom/Canvas-expected.txt ('k') | LayoutTests/dart/dom/CanvasUsingHtml.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698