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 "SkPathOpsLine.h" | 8 #include "SkPathOpsLine.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 #include "TestClassDef.h" | |
11 | 10 |
12 static const SkDLine tests[] = { | 11 static const SkDLine tests[] = { |
13 {{{2, 1}, {2, 1}}}, | 12 {{{2, 1}, {2, 1}}}, |
14 {{{2, 1}, {1, 1}}}, | 13 {{{2, 1}, {1, 1}}}, |
15 {{{2, 1}, {2, 2}}}, | 14 {{{2, 1}, {2, 2}}}, |
16 {{{1, 1}, {2, 2}}}, | 15 {{{1, 1}, {2, 2}}}, |
17 {{{3, 0}, {2, 1}}}, | 16 {{{3, 0}, {2, 1}}}, |
18 {{{3, 2}, {1, 1}}}, | 17 {{{3, 2}, {1, 1}}}, |
19 }; | 18 }; |
20 | 19 |
(...skipping 25 matching lines...) Expand all Loading... |
46 } | 45 } |
47 line2 = line.subDivide(1, 0); | 46 line2 = line.subDivide(1, 0); |
48 REPORTER_ASSERT(reporter, line[0] == line2[1] && line[1] == line2[0]); | 47 REPORTER_ASSERT(reporter, line[0] == line2[1] && line[1] == line2[0]); |
49 line2 = SkDLine::SubDivide(pts, 1, 0); | 48 line2 = SkDLine::SubDivide(pts, 1, 0); |
50 REPORTER_ASSERT(reporter, line[0] == line2[1] && line[1] == line2[0]); | 49 REPORTER_ASSERT(reporter, line[0] == line2[1] && line[1] == line2[0]); |
51 SkDPoint mid = line.ptAtT(.5); | 50 SkDPoint mid = line.ptAtT(.5); |
52 REPORTER_ASSERT(reporter, approximately_equal((line[0].fX + line[1].fX)
/ 2, mid.fX)); | 51 REPORTER_ASSERT(reporter, approximately_equal((line[0].fX + line[1].fX)
/ 2, mid.fX)); |
53 REPORTER_ASSERT(reporter, approximately_equal((line[0].fY + line[1].fY)
/ 2, mid.fY)); | 52 REPORTER_ASSERT(reporter, approximately_equal((line[0].fY + line[1].fY)
/ 2, mid.fY)); |
54 } | 53 } |
55 } | 54 } |
OLD | NEW |