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 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 SkASSERT(ValidPoint(pt)); | 40 SkASSERT(ValidPoint(pt)); |
41 double result = line.isLeft(pt); | 41 double result = line.isLeft(pt); |
42 if ((result <= 0 && index >= 1) || (result < 0 && index == 0)) { | 42 if ((result <= 0 && index >= 1) || (result < 0 && index == 0)) { |
43 SkDebugf("%s [%d] expected left\n", __FUNCTION__, index); | 43 SkDebugf("%s [%d] expected left\n", __FUNCTION__, index); |
44 REPORTER_ASSERT(reporter, 0); | 44 REPORTER_ASSERT(reporter, 0); |
45 } | 45 } |
46 line2 = line.subDivide(1, 0); | 46 line2 = line.subDivide(1, 0); |
47 REPORTER_ASSERT(reporter, line[0] == line2[1] && line[1] == line2[0]); | 47 REPORTER_ASSERT(reporter, line[0] == line2[1] && line[1] == line2[0]); |
48 line2 = SkDLine::SubDivide(pts, 1, 0); | 48 line2 = SkDLine::SubDivide(pts, 1, 0); |
49 REPORTER_ASSERT(reporter, line[0] == line2[1] && line[1] == line2[0]); | 49 REPORTER_ASSERT(reporter, line[0] == line2[1] && line[1] == line2[0]); |
50 SkDPoint mid = line.xyAtT(.5); | 50 SkDPoint mid = line.ptAtT(.5); |
51 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)); |
52 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)); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 #include "TestClassDef.h" | 56 #include "TestClassDef.h" |
57 DEFINE_TESTCLASS_SHORT(PathOpsLineUtilitiesTest) | 57 DEFINE_TESTCLASS_SHORT(PathOpsLineUtilitiesTest) |
OLD | NEW |