| Index: tests/html/canvasrenderingcontext2d_test.dart
|
| diff --git a/tests/html/canvasrenderingcontext2d_test.dart b/tests/html/canvasrenderingcontext2d_test.dart
|
| index 32beb1e6ae8781458db435d68a43f60ea8659320..9cafb0d8c9f5296b077b44dadae515133c010ea5 100644
|
| --- a/tests/html/canvasrenderingcontext2d_test.dart
|
| +++ b/tests/html/canvasrenderingcontext2d_test.dart
|
| @@ -679,25 +679,28 @@ main() {
|
| setUp(setupFunc);
|
| tearDown(tearDownFunc);
|
|
|
| + final x = 20;
|
| + final y = 20;
|
| +
|
| test('without maxWidth', () {
|
| context.font = '40pt Garamond';
|
| context.fillStyle = 'blue';
|
|
|
| // Draw a blue box.
|
| - context.fillText('█', 50, 50);
|
| + context.fillText('█', x, y);
|
|
|
| var width = context.measureText('█').width;
|
|
|
| - checkPixel(readPixel(50, 50), [0, 0, 255, 255]);
|
| - checkPixel(readPixel(60, 50), [0, 0, 255, 255]);
|
| + checkPixel(readPixel(x, y), [0, 0, 255, 255]);
|
| + checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
|
|
|
| - expectPixelUnfilled(40, 50);
|
| - expectPixelFilled(50, 50);
|
| - expectPixelFilled(60, 50);
|
| + expectPixelUnfilled(x - 10, y);
|
| + expectPixelFilled(x, y);
|
| + expectPixelFilled(x + 10, y);
|
|
|
| // The box does not draw after `width` pixels.
|
| - expectPixelFilled(50 + width, 50);
|
| - expectPixelUnfilled(50 + width + 1, 50);
|
| + expectPixelFilled(x + width - 1, y);
|
| + expectPixelUnfilled(x + width + 1, y);
|
| });
|
|
|
| test('with maxWidth null', () {
|
| @@ -705,38 +708,40 @@ main() {
|
| context.fillStyle = 'blue';
|
|
|
| // Draw a blue box with null maxWidth.
|
| - context.fillText('█', 50, 50, null);
|
| + context.fillText('█', x, y, null);
|
|
|
| var width = context.measureText('█').width;
|
|
|
| - checkPixel(readPixel(50, 50), [0, 0, 255, 255]);
|
| - checkPixel(readPixel(60, 50), [0, 0, 255, 255]);
|
| + checkPixel(readPixel(x, y), [0, 0, 255, 255]);
|
| + checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
|
|
|
| - expectPixelUnfilled(40, 50);
|
| - expectPixelFilled(50, 50);
|
| - expectPixelFilled(60, 50);
|
| + expectPixelUnfilled(x - 10, y);
|
| + expectPixelFilled(x, y);
|
| + expectPixelFilled(x + 10, y);
|
|
|
| // The box does not draw after `width` pixels.
|
| - expectPixelFilled(50 + width, 50);
|
| - expectPixelUnfilled(50 + width + 1, 50);
|
| + expectPixelFilled(x + width - 1, y);
|
| + expectPixelUnfilled(x + width + 1, y);
|
| });
|
|
|
| test('with maxWidth defined', () {
|
| context.font = '40pt Garamond';
|
| context.fillStyle = 'blue';
|
|
|
| + final maxWidth = 20;
|
| +
|
| // Draw a blue box that's at most 20 pixels wide.
|
| - context.fillText('█', 50, 50, 20);
|
| + context.fillText('█', x, y, maxWidth);
|
|
|
| - checkPixel(readPixel(50, 50), [0, 0, 255, 255]);
|
| - checkPixel(readPixel(60, 50), [0, 0, 255, 255]);
|
| + checkPixel(readPixel(x, y), [0, 0, 255, 255]);
|
| + checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
|
|
|
| // The box does not draw after 20 pixels.
|
| - expectPixelUnfilled(40, 50);
|
| - expectPixelUnfilled(71, 50);
|
| - expectPixelUnfilled(90, 50);
|
| - expectPixelFilled(50, 50);
|
| - expectPixelFilled(60, 50);
|
| + expectPixelUnfilled(x - 10, y);
|
| + expectPixelUnfilled(x + maxWidth + 1, y);
|
| + expectPixelUnfilled(x + maxWidth + 20, y);
|
| + expectPixelFilled(x, y);
|
| + expectPixelFilled(x + 10, y);
|
| });
|
| });
|
| }
|
|
|