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

Side by Side Diff: pkg/dev_compiler/tool/input_sdk/lib/math/rectangle.dart

Issue 2407913002: Stop using unittest in point_test and rectangle_test. (Closed)
Patch Set: Fix cast in the input_sdk. Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.math; 4 part of dart.math;
5 5
6 /** 6 /**
7 * A base class for representing two-dimensional axis-aligned rectangles. 7 * A base class for representing two-dimensional axis-aligned rectangles.
8 * 8 *
9 * This rectangle uses a left-handed Cartesian coordinate system, with x 9 * This rectangle uses a left-handed Cartesian coordinate system, with x
10 * directed to the right and y directed down, as per the convention in 2D 10 * directed to the right and y directed down, as per the convention in 2D
(...skipping 22 matching lines...) Expand all
33 T get right => left + width; 33 T get right => left + width;
34 /** The y-coordinate of the bottom edge. */ 34 /** The y-coordinate of the bottom edge. */
35 T get bottom => top + height; 35 T get bottom => top + height;
36 36
37 String toString() { 37 String toString() {
38 return 'Rectangle ($left, $top) $width x $height'; 38 return 'Rectangle ($left, $top) $width x $height';
39 } 39 }
40 40
41 bool operator ==(other) { 41 bool operator ==(other) {
42 if (other is !Rectangle) return false; 42 if (other is !Rectangle) return false;
43 return left == other.left && top == other.top && right == other.right && 43 // TODO(rnystrom): Type promotion doesn't currently promote the [other]
44 bottom == other.bottom; 44 // to Rectangle from the above line, so do it explicitly here to avoid a
45 // dynamic send and work around:
46 // https://github.com/dart-lang/sdk/issues/27551
47 var otherRect = other as Rectangle;
48 return left == otherRect.left &&
49 top == otherRect.top &&
50 right == otherRect.right &&
51 bottom == otherRect.bottom;
45 } 52 }
46 53
47 int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode, 54 int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode,
48 right.hashCode, bottom.hashCode); 55 right.hashCode, bottom.hashCode);
49 56
50 /** 57 /**
51 * Computes the intersection of `this` and [other]. 58 * Computes the intersection of `this` and [other].
52 * 59 *
53 * The intersection of two axis-aligned rectangles, if any, is always another 60 * The intersection of two axis-aligned rectangles, if any, is always another
54 * axis-aligned rectangle. 61 * axis-aligned rectangle.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 274
268 /** 275 /**
269 * Converts a negative [int] or [double] to a zero-value of the same type. 276 * Converts a negative [int] or [double] to a zero-value of the same type.
270 * 277 *
271 * Returns `0` if value is int, `0.0` if value is double. 278 * Returns `0` if value is int, `0.0` if value is double.
272 */ 279 */
273 num/*=T*/ _clampToZero/*<T extends num>*/(num/*=T*/ value) { 280 num/*=T*/ _clampToZero/*<T extends num>*/(num/*=T*/ value) {
274 assert(value < 0); 281 assert(value < 0);
275 return -value * 0; 282 return -value * 0;
276 } 283 }
OLDNEW
« no previous file with comments | « pkg/dev_compiler/test/not_yet_strong_tests.dart ('k') | pkg/dev_compiler/tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698