OLD | NEW |
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; import '../../pkg/unittest/lib/unittes
t.dart'; | 5 library canvas_rendering_context_2d_test; import '../../pkg/unittest/lib/unittes
t.dart'; |
6 import '../../pkg/unittest/lib/html_individual_config.dart'; | 6 import '../../pkg/unittest/lib/html_individual_config.dart'; |
7 import 'dart:html'; | 7 import 'dart:html'; |
8 import 'dart:math'; | 8 import 'dart:math'; |
9 | 9 |
10 // Some rounding errors in the browsers. | 10 // Some rounding errors in the browsers. |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // TODO(antonm): in Dartium ArgumentError should be thrown too. | 236 // TODO(antonm): in Dartium ArgumentError should be thrown too. |
237 expect(() => context.putImageData(expectedData, 0, 0, 1), | 237 expect(() => context.putImageData(expectedData, 0, 0, 1), |
238 throws); | 238 throws); |
239 expect(() => context.putImageData(expectedData, 0, 0, 1, 1), | 239 expect(() => context.putImageData(expectedData, 0, 0, 1, 1), |
240 throws); | 240 throws); |
241 expect(() => context.putImageData(expectedData, 0, 0, 1, 1, 5), | 241 expect(() => context.putImageData(expectedData, 0, 0, 1, 1, 5), |
242 throws); | 242 throws); |
243 }); | 243 }); |
244 }); | 244 }); |
245 | 245 |
246 group('linedash', () { | |
247 setUp(setupFunc); | |
248 tearDown(tearDownFunc); | |
249 | |
250 test('setLineDash', () { | |
251 expect(context.getLineDash(), equals([])); | |
252 var old = context.getLineDash(); | |
253 context.setLineDash(old); | |
254 }); | |
255 }); | |
256 | |
257 group('arc', () { | 246 group('arc', () { |
258 setUp(setupFunc); | 247 setUp(setupFunc); |
259 tearDown(tearDownFunc); | 248 tearDown(tearDownFunc); |
260 | 249 |
261 test('default arc should be clockwise', () { | 250 test('default arc should be clockwise', () { |
262 context.beginPath(); | 251 context.beginPath(); |
263 final r = 10; | 252 final r = 10; |
264 | 253 |
265 // Center of arc. | 254 // Center of arc. |
266 final cx = 20; | 255 final cx = 20; |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 | 738 |
750 // The box does not draw after 20 pixels. | 739 // The box does not draw after 20 pixels. |
751 expectPixelUnfilled(x - 10, y); | 740 expectPixelUnfilled(x - 10, y); |
752 expectPixelUnfilled(x + maxWidth + 1, y); | 741 expectPixelUnfilled(x + maxWidth + 1, y); |
753 expectPixelUnfilled(x + maxWidth + 20, y); | 742 expectPixelUnfilled(x + maxWidth + 20, y); |
754 expectPixelFilled(x, y); | 743 expectPixelFilled(x, y); |
755 expectPixelFilled(x + 10, y); | 744 expectPixelFilled(x + 10, y); |
756 }); | 745 }); |
757 }); | 746 }); |
758 } | 747 } |
OLD | NEW |