| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 expectedData.data[2 * 4 + 3] = 255; | 226 expectedData.data[2 * 4 + 3] = 255; |
| 227 | 227 |
| 228 // Make sure that our data is all green. | 228 // Make sure that our data is all green. |
| 229 var resultingData = context.getImageData(0, 0, 10, 10); | 229 var resultingData = context.getImageData(0, 0, 10, 10); |
| 230 expect(resultingData.data, expectedData.data); | 230 expect(resultingData.data, expectedData.data); |
| 231 }); | 231 }); |
| 232 | 232 |
| 233 test('putImageData throws with wrong number of arguments', () { | 233 test('putImageData throws with wrong number of arguments', () { |
| 234 ImageData expectedData = context.getImageData(0, 0, 10, 10); | 234 ImageData expectedData = context.getImageData(0, 0, 10, 10); |
| 235 | 235 |
| 236 // TODO(antonm): in Dartium ArgumentError should be thrown too. |
| 236 expect(() => context.putImageData(expectedData, 0, 0, 1), | 237 expect(() => context.putImageData(expectedData, 0, 0, 1), |
| 237 throwsArgumentError); | 238 throws); |
| 238 expect(() => context.putImageData(expectedData, 0, 0, 1, 1), | 239 expect(() => context.putImageData(expectedData, 0, 0, 1, 1), |
| 239 throwsArgumentError); | 240 throws); |
| 240 expect(() => context.putImageData(expectedData, 0, 0, 1, 1, 5), | 241 expect(() => context.putImageData(expectedData, 0, 0, 1, 1, 5), |
| 241 throwsArgumentError); | 242 throws); |
| 242 }); | 243 }); |
| 243 }); | 244 }); |
| 244 | 245 |
| 245 group('arc', () { | 246 group('arc', () { |
| 246 setUp(setupFunc); | 247 setUp(setupFunc); |
| 247 tearDown(tearDownFunc); | 248 tearDown(tearDownFunc); |
| 248 | 249 |
| 249 test('default arc should be clockwise', () { | 250 test('default arc should be clockwise', () { |
| 250 context.beginPath(); | 251 context.beginPath(); |
| 251 final r = 10; | 252 final r = 10; |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 var imageData = context.createImageData(15, 15); | 663 var imageData = context.createImageData(15, 15); |
| 663 expect(imageData.width, 15); | 664 expect(imageData.width, 15); |
| 664 expect(imageData.height, 15); | 665 expect(imageData.height, 15); |
| 665 | 666 |
| 666 var other = context.createImageDataFromImageData(imageData); | 667 var other = context.createImageDataFromImageData(imageData); |
| 667 expect(other.width, 15); | 668 expect(other.width, 15); |
| 668 expect(other.height, 15); | 669 expect(other.height, 15); |
| 669 }); | 670 }); |
| 670 }); | 671 }); |
| 671 } | 672 } |
| OLD | NEW |