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

Side by Side Diff: tests/PathOpsConicQuadIntersectionTest.cpp

Issue 2356363003: fix tiger b (Closed)
Patch Set: reset debug flags 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
« no previous file with comments | « src/pathops/SkPathOpsTSect.h ('k') | tests/PathOpsCubicIntersectionTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7 #include "PathOpsTestCommon.h"
8 #include "SkIntersections.h"
9 #include "SkPathOpsConic.h"
10 #include "SkPathOpsQuad.h"
11 #include "SkReduceOrder.h"
12 #include "Test.h"
13
14 static struct conicQuad {
15 SkDConic conic;
16 SkDQuad quad;
17 } conicQuadTests[] = {
18 {{{{{494.348663,224.583771}, {494.365143,224.633194}, {494.376404,224.684067} }}, 0.998645842f},
19 {{{494.30481,224.474213}, {494.334961,224.538284}, {494.355774,224.605927}}} },
20
21 {{{{{494.348663,224.583771}, {494.365143,224.633194}, {494.376404,224.684067} }}, 0.998645842f},
22 {{{494.355774f, 224.605927f}, {494.363708f, 224.631714f}, {494.370148f, 224. 657471f}}}},
23 };
24
25 static const int conicQuadTests_count = (int) SK_ARRAY_COUNT(conicQuadTests);
26
27 static void conicQuadIntersection(skiatest::Reporter* reporter, int index) {
28 const SkDConic& conic = conicQuadTests[index].conic;
29 SkASSERT(ValidConic(conic));
30 const SkDQuad& quad = conicQuadTests[index].quad;
31 SkASSERT(ValidQuad(quad));
32 SkReduceOrder reduce1;
33 SkReduceOrder reduce2;
34 int order1 = reduce2.reduce(conic.fPts);
35 int order2 = reduce1.reduce(quad);
36 if (order2 != 3) {
37 SkDebugf("[%d] conic order=%d\n", index, order1);
38 REPORTER_ASSERT(reporter, 0);
39 }
40 if (order1 != 3) {
41 SkDebugf("[%d] quad order=%d\n", index, order2);
42 REPORTER_ASSERT(reporter, 0);
43 }
44 SkIntersections i;
45 int roots = i.intersect(conic, quad);
46 for (int pt = 0; pt < roots; ++pt) {
47 double tt1 = i[0][pt];
48 SkDPoint xy1 = conic.ptAtT(tt1);
49 double tt2 = i[1][pt];
50 SkDPoint xy2 = quad.ptAtT(tt2);
51 if (!xy1.approximatelyEqual(xy2)) {
52 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n",
53 __FUNCTION__, index, pt, tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.f Y);
54 }
55 REPORTER_ASSERT(reporter, xy1.approximatelyEqual(xy2));
56 }
57 reporter->bumpTestCount();
58 }
59
60 DEF_TEST(PathOpsConicQuadIntersection, reporter) {
61 for (int index = 0; index < conicQuadTests_count; ++index) {
62 conicQuadIntersection(reporter, index);
63 reporter->bumpTestCount();
64 }
65 }
66
67 DEF_TEST(PathOpsConicQuadIntersectionOneOff, reporter) {
68 conicQuadIntersection(reporter, 1);
69 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsTSect.h ('k') | tests/PathOpsCubicIntersectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698