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

Unified Diff: tests/html/canvasrenderingcontext2d_test.dart

Issue 11705002: Marking canvas test as pass so I can figure out what tolerances need to be adjusted. (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 | tests/html/html.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/canvasrenderingcontext2d_test.dart
diff --git a/tests/html/canvasrenderingcontext2d_test.dart b/tests/html/canvasrenderingcontext2d_test.dart
index 4a95b0535ff020e2e412e7a104a7f89f861a6f63..1e77f6c7a850c58e3c4e721de3b63cb0136a7b2b 100644
--- a/tests/html/canvasrenderingcontext2d_test.dart
+++ b/tests/html/canvasrenderingcontext2d_test.dart
@@ -7,6 +7,14 @@ import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
import 'dart:html';
+// Some rounding errors in the browsers.
+checkPixel(Uint8ClampedArray pixel, List<int> expected) {
+ expect(pixel[0], closeTo(expected[0], 1));
+ expect(pixel[1], closeTo(expected[1], 1));
+ expect(pixel[2], closeTo(expected[2], 1));
+ expect(pixel[3], closeTo(expected[3], 1));
+}
+
main() {
useHtmlConfiguration();
var canvas = new CanvasElement();
@@ -41,12 +49,7 @@ main() {
test('setFillColorHsl sat', () {
context.setFillColorHsl(0, 0, 50);
context.fillRect(0, 0, canvas.width, canvas.height);
- var pixel = readPixel();
- // Some rounding errors in the browsers.
- expect(pixel[0], closeTo(127, 1));
- expect(pixel[1], closeTo(127, 1));
- expect(pixel[2], closeTo(127, 1));
- expect(pixel[3], 255);
+ checkPixel(readPixel(), [127, 127, 127, 255]);
});
test('setStrokeColorRgb', () {
@@ -74,12 +77,7 @@ main() {
context.setStrokeColorHsl(0, 0, 50);
context.lineWidth = 10;
context.strokeRect(0, 0, canvas.width, canvas.height);
- var pixel = readPixel();
- // Some rounding errors in the browsers.
- expect(pixel[0], closeTo(127, 1));
- expect(pixel[1], closeTo(127, 1));
- expect(pixel[2], closeTo(127, 1));
- expect(pixel[3], 255);
+ checkPixel(readPixel(), [127, 127, 127, 255]);
});
test('fillStyle', () {
« no previous file with comments | « no previous file | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698