OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "PathOpsTestCommon.h" | 7 #include "PathOpsTestCommon.h" |
8 #include "SkPathOpsPoint.h" | 8 #include "SkPathOpsPoint.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 #include "TestClassDef.h" | |
11 | 10 |
12 static const SkDPoint tests[] = { | 11 static const SkDPoint tests[] = { |
13 {0, 0}, | 12 {0, 0}, |
14 {1, 0}, | 13 {1, 0}, |
15 {0, 1}, | 14 {0, 1}, |
16 {2, 1}, | 15 {2, 1}, |
17 {1, 2}, | 16 {1, 2}, |
18 {1, 1}, | 17 {1, 1}, |
19 {2, 2} | 18 {2, 2} |
20 }; | 19 }; |
(...skipping 21 matching lines...) Expand all Loading... |
42 REPORTER_ASSERT(reporter, sv.fX == 0 && sv.fY == 0); | 41 REPORTER_ASSERT(reporter, sv.fX == 0 && sv.fY == 0); |
43 v1 = tests[index + 1] - tests[index]; | 42 v1 = tests[index + 1] - tests[index]; |
44 double lenSq = v1.lengthSquared(); | 43 double lenSq = v1.lengthSquared(); |
45 double v1Dot = v1.dot(v1); | 44 double v1Dot = v1.dot(v1); |
46 REPORTER_ASSERT(reporter, lenSq == v1Dot); | 45 REPORTER_ASSERT(reporter, lenSq == v1Dot); |
47 REPORTER_ASSERT(reporter, approximately_equal(sqrt(lenSq), v1.length()))
; | 46 REPORTER_ASSERT(reporter, approximately_equal(sqrt(lenSq), v1.length()))
; |
48 double v1Cross = v1.cross(v1); | 47 double v1Cross = v1.cross(v1); |
49 REPORTER_ASSERT(reporter, v1Cross == 0); | 48 REPORTER_ASSERT(reporter, v1Cross == 0); |
50 } | 49 } |
51 } | 50 } |
OLD | NEW |