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

Unified Diff: tests/html/canvas_test.dart

Issue 11571038: Adding test for toDataUrl. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/canvas_test.dart
diff --git a/tests/html/canvas_test.dart b/tests/html/canvas_test.dart
index 3f6e700a1a9243b41217ce6621ef75ea22d5c662..56994f0ee5045b243f775f53ffe58d9b34d1d014 100644
--- a/tests/html/canvas_test.dart
+++ b/tests/html/canvas_test.dart
@@ -27,6 +27,26 @@ main() {
data[100] = 200;
expect(data[100], equals(200));
});
+
+ test('toDataUrl', () {
+ var canvas = new CanvasElement(width: 100, height: 100);
+ var context = canvas.context2d;
+ context.fillStyle = 'red';
+ context.fill();
+
+ var url = canvas.toDataUrl('image/png');
+
+ var img = new ImageElement();
+ img.on.load.add(expectAsync1((_) {
+ expect(img.complete, true);
+ }));
+ img.on.error.add((_) {
+ guardAsync(() {
+ expect(true, isFalse, reason: 'URL failed to load.');
+ });
+ });
+ img.src = url;
+ });
}
void checkPixel(Uint8ClampedArray data, int offset, List<int> rgba)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698