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

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

Issue 14883008: use .append instead of .nodes.add (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: revert node_test and element_test Created 7 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 | « tests/html/canvas_pixel_array_type_alias_test.dart ('k') | tests/html/client_rect_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 CanvasTest; 1 library CanvasTest;
2 import '../../pkg/unittest/lib/unittest.dart'; 2 import '../../pkg/unittest/lib/unittest.dart';
3 import '../../pkg/unittest/lib/html_config.dart'; 3 import '../../pkg/unittest/lib/html_config.dart';
4 import 'dart:html'; 4 import 'dart:html';
5 5
6 main() { 6 main() {
7 CanvasElement canvas; 7 CanvasElement canvas;
8 CanvasRenderingContext2D context; 8 CanvasRenderingContext2D context;
9 int width = 100; 9 int width = 100;
10 int height = 100; 10 int height = 100;
11 11
12 canvas = new CanvasElement(width:width, height:height); 12 canvas = new CanvasElement(width:width, height:height);
13 document.body.nodes.add(canvas); 13 document.body.append(canvas);
14 14
15 context = canvas.context2D; 15 context = canvas.context2D;
16 16
17 useHtmlConfiguration(); 17 useHtmlConfiguration();
18 test('CreateImageData', () { 18 test('CreateImageData', () {
19 ImageData image = context.createImageData(canvas.width, 19 ImageData image = context.createImageData(canvas.width,
20 canvas.height); 20 canvas.height);
21 List<int> data = image.data; 21 List<int> data = image.data;
22 22
23 expect(data, hasLength(40000)); 23 expect(data, hasLength(40000));
(...skipping 25 matching lines...) Expand all
49 }); 49 });
50 } 50 }
51 51
52 void checkPixel(List<int> data, int offset, List<int> rgba) 52 void checkPixel(List<int> data, int offset, List<int> rgba)
53 { 53 {
54 offset *= 4; 54 offset *= 4;
55 for (var i = 0; i < 4; ++i) { 55 for (var i = 0; i < 4; ++i) {
56 expect(data[offset + i], equals(rgba[i])); 56 expect(data[offset + i], equals(rgba[i]));
57 } 57 }
58 } 58 }
OLDNEW
« no previous file with comments | « tests/html/canvas_pixel_array_type_alias_test.dart ('k') | tests/html/client_rect_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698