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

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

Issue 218273002: Upgrading tests with unittest deprecations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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;
(...skipping 19 matching lines...) Expand all
30 30
31 test('toDataUrl', () { 31 test('toDataUrl', () {
32 var canvas = new CanvasElement(width: 100, height: 100); 32 var canvas = new CanvasElement(width: 100, height: 100);
33 var context = canvas.context2D; 33 var context = canvas.context2D;
34 context.fillStyle = 'red'; 34 context.fillStyle = 'red';
35 context.fill(); 35 context.fill();
36 36
37 var url = canvas.toDataUrl(); 37 var url = canvas.toDataUrl();
38 38
39 var img = new ImageElement(); 39 var img = new ImageElement();
40 img.onLoad.listen(expectAsync1((_) { 40 img.onLoad.listen(expectAsync((_) {
41 expect(img.complete, true); 41 expect(img.complete, true);
42 })); 42 }));
43 img.onError.listen((_) { 43 img.onError.listen((_) {
44 guardAsync(() { 44 guardAsync(() {
45 expect(true, isFalse, reason: 'URL failed to load.'); 45 expect(true, isFalse, reason: 'URL failed to load.');
46 }); 46 });
47 }); 47 });
48 img.src = url; 48 img.src = url;
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

Powered by Google App Engine
This is Rietveld 408576698