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

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

Issue 1802343003: Experiment with canvasrenderingcontext2d test failure (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library canvas_rendering_context_2d_test; 5 library canvas_rendering_context_2d_test;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'dart:math'; 8 import 'dart:math';
9 9
10 import 'package:unittest/html_individual_config.dart'; 10 import 'package:unittest/html_individual_config.dart';
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 var width = context.measureText('█').width.ceil(); 681 var width = context.measureText('█').width.ceil();
682 682
683 checkPixel(readPixel(x, y), [0, 0, 255, 255]); 683 checkPixel(readPixel(x, y), [0, 0, 255, 255]);
684 checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]); 684 checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
685 685
686 expectPixelUnfilled(x - 10, y); 686 expectPixelUnfilled(x - 10, y);
687 expectPixelFilled(x, y); 687 expectPixelFilled(x, y);
688 expectPixelFilled(x + 10, y); 688 expectPixelFilled(x + 10, y);
689 689
690 // The box does not draw after `width` pixels. 690 // The box does not draw after `width` pixels.
691 expectPixelFilled(x + width - 1, y); 691 // Check -2 rather than -1 because this seems
692 // to run into a rounding error on Mac bots.
693 expectPixelFilled(x + width - 2, y);
692 expectPixelUnfilled(x + width + 1, y); 694 expectPixelUnfilled(x + width + 1, y);
693 }); 695 });
694 696
695 test('with maxWidth null', () { 697 test('with maxWidth null', () {
696 context.font = '40pt Garamond'; 698 context.font = '40pt Garamond';
697 context.fillStyle = 'blue'; 699 context.fillStyle = 'blue';
698 700
699 // Draw a blue box with null maxWidth. 701 // Draw a blue box with null maxWidth.
700 context.fillText('█', x, y, null); 702 context.fillText('█', x, y, null);
701 703
702 var width = context.measureText('█').width.ceil(); 704 var width = context.measureText('█').width.ceil();
703 705
704 checkPixel(readPixel(x, y), [0, 0, 255, 255]); 706 checkPixel(readPixel(x, y), [0, 0, 255, 255]);
705 checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]); 707 checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
706 708
707 expectPixelUnfilled(x - 10, y); 709 expectPixelUnfilled(x - 10, y);
708 expectPixelFilled(x, y); 710 expectPixelFilled(x, y);
709 expectPixelFilled(x + 10, y); 711 expectPixelFilled(x + 10, y);
710 712
711 // The box does not draw after `width` pixels. 713 // The box does not draw after `width` pixels.
712 expectPixelFilled(x + width - 1, y); 714 // Check -2 rather than -1 because this seems
715 // to run into a rounding error on Mac bots.
716 expectPixelFilled(x + width - 2, y);
713 expectPixelUnfilled(x + width + 1, y); 717 expectPixelUnfilled(x + width + 1, y);
714 }); 718 });
715 719
716 test('with maxWidth defined', () { 720 test('with maxWidth defined', () {
717 context.font = '40pt Garamond'; 721 context.font = '40pt Garamond';
718 context.fillStyle = 'blue'; 722 context.fillStyle = 'blue';
719 723
720 final maxWidth = 20; 724 final maxWidth = 20;
721 725
722 // Draw a blue box that's at most 20 pixels wide. 726 // Draw a blue box that's at most 20 pixels wide.
723 context.fillText('█', x, y, maxWidth); 727 context.fillText('█', x, y, maxWidth);
724 728
725 checkPixel(readPixel(x, y), [0, 0, 255, 255]); 729 checkPixel(readPixel(x, y), [0, 0, 255, 255]);
726 checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]); 730 checkPixel(readPixel(x + 10, y), [0, 0, 255, 255]);
727 731
728 // The box does not draw after 20 pixels. 732 // The box does not draw after 20 pixels.
729 expectPixelUnfilled(x - 10, y); 733 expectPixelUnfilled(x - 10, y);
730 expectPixelUnfilled(x + maxWidth + 1, y); 734 expectPixelUnfilled(x + maxWidth + 1, y);
731 expectPixelUnfilled(x + maxWidth + 20, y); 735 expectPixelUnfilled(x + maxWidth + 20, y);
732 expectPixelFilled(x, y); 736 expectPixelFilled(x, y);
733 expectPixelFilled(x + 10, y); 737 expectPixelFilled(x + 10, y);
734 }); 738 });
735 }); 739 });
736 } 740 }
OLDNEW
« 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