Revert of remove obsolete tests (patchset #1 id:1 of https://codereview.chromium.org/1030883002/)

Reason for revert:
working on asan fix

Original issue's description:
> remove obsolete tests
>
> remove tests that are breaking the build -- uninitialized memory
>
> TBR=reed
>
> Committed: https://skia.googlesource.com/skia/+/e02c944e97ad6a3b8befb1f4f784919767941ba6

TBR=reed@android.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1036633002
This commit is contained in:
caryclark 2015-03-24 13:52:49 -07:00 committed by Commit bot
parent 74c464a6af
commit 82dec0e16a

View File

@ -683,3 +683,72 @@ DEF_TEST(PathOpsCubicIntersection, reporter) {
if (false) CubicIntersection_IntersectionFinder();
if (false) CubicIntersection_RandTest(reporter);
}
static void binaryTest(const SkDCubic& cubic1, const SkDCubic& cubic2,
skiatest::Reporter* reporter) {
SkASSERT(ValidCubic(cubic1));
SkASSERT(ValidCubic(cubic2));
SkIntersections intersections;
SkReduceOrder reduce1, reduce2;
int order1 = reduce1.reduce(cubic1, SkReduceOrder::kNo_Quadratics);
int order2 = reduce2.reduce(cubic2, SkReduceOrder::kNo_Quadratics);
if (order1 == 4 && order2 == 4) {
intersections.intersect(cubic1, cubic2);
} else {
intersections.reset();
}
SkIntersections intersections2;
(void) intersections2.intersect(cubic1, cubic2);
REPORTER_ASSERT(reporter, intersections.used() <= intersections2.used()
|| intersections[0][0] + 0.01 > intersections[0][1]);
for (int index = 0; index < intersections2.used(); ++index) {
// SkASSERT(intersections.pt(index).approximatelyEqual(intersections2.pt(index)));
double tt1 = intersections2[0][index];
SkDPoint xy1 = cubic1.ptAtT(tt1);
double tt2 = intersections2[1][index];
SkDPoint xy2 = cubic2.ptAtT(tt2);
REPORTER_ASSERT(reporter, xy1.approximatelyEqual(xy2));
}
}
DEF_TEST(PathOpsCubicBinaryTest, reporter) {
int outer = 0;
int inner = outer + 1;
do {
const SkDCubic& cubic1 = testSet[outer];
const SkDCubic& cubic2 = testSet[inner];
binaryTest(cubic1, cubic2, reporter);
inner += 2;
outer += 2;
} while (outer < (int) testSetCount);
}
DEF_TEST(PathOpsCubicBinaryNew, reporter) {
int outer = 62;
int inner = outer + 1;
do {
const SkDCubic& cubic1 = newTestSet[outer];
const SkDCubic& cubic2 = newTestSet[inner];
binaryTest(cubic1, cubic2, reporter);
inner += 2;
outer += 2;
} while (outer < (int) newTestSetCount);
}
DEF_TEST(PathOpsCubicBinaryStd, reporter) {
const int firstTest = 0;
for (size_t index = firstTest; index < tests_count; ++index) {
const SkDCubic& cubic1 = tests[index][0];
const SkDCubic& cubic2 = tests[index][1];
binaryTest(cubic1, cubic2, reporter);
}
}
DEF_TEST(PathOpsCubicBinaryCoin, reporter) {
int firstFail = 0;
for (int index = firstFail; index < coinSetCount; index += 2) {
const SkDCubic& cubic1 = coinSet[index];
const SkDCubic& cubic2 = coinSet[index + 1];
binaryTest(cubic1, cubic2, reporter);
}
}