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

Side by Side Diff: tests/PathOpsCubicQuadIntersectionTest.cpp

Issue 23542056: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: verbose + mutex around file number access Created 7 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 | Annotate | Revision Log
« no previous file with comments | « tests/PathOpsCubicLineIntersectionTest.cpp ('k') | tests/PathOpsCubicReduceOrderTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkIntersections.h" 8 #include "SkIntersections.h"
9 #include "SkPathOpsCubic.h" 9 #include "SkPathOpsCubic.h"
10 #include "SkPathOpsQuad.h" 10 #include "SkPathOpsQuad.h"
11 #include "SkReduceOrder.h" 11 #include "SkReduceOrder.h"
12 #include "Test.h" 12 #include "Test.h"
13 13
14 static struct lineCubic { 14 static struct lineCubic {
15 SkDCubic cubic; 15 SkDCubic cubic;
16 SkDQuad quad; 16 SkDQuad quad;
17 int answerCount; 17 int answerCount;
18 SkDPoint answers[2]; 18 SkDPoint answers[2];
19 } quadCubicTests[] = { 19 } quadCubicTests[] = {
20 {{{{49, 47}, {49, 74.614250183105469}, {26.614250183105469, 97}, {-1, 97}}},
21 {{{-8.659739592076221e-015, 96.991401672363281}, {20.065492630004883, 96.64 5187377929688},
22 {34.355339050292969, 82.355339050292969}}}, 2,
23 {{34.355339050292969,82.355339050292969}, {34.306797674910243,82.403823585 863449}}},
24
20 {{{{10,234}, {10,229.58172607421875}, {13.581720352172852,226}, {18,226}}}, 25 {{{{10,234}, {10,229.58172607421875}, {13.581720352172852,226}, {18,226}}},
21 {{{18,226}, {14.686291694641113,226}, {12.342399597167969,228.3424072265 625}}}, 1, 26 {{{18,226}, {14.686291694641113,226}, {12.342399597167969,228.3424072265625 }}}, 1,
22 {{18,226}, {0,0}}}, 27 {{18,226}, {0,0}}},
23 {{{{10,234}, {10,229.58172607421875}, {13.581720352172852,226}, {18,226}}}, 28 {{{{10,234}, {10,229.58172607421875}, {13.581720352172852,226}, {18,226}}},
24 {{{12.342399597167969,228.3424072265625}, {10,230.68629455566406}, {10,2 34}}}, 1, 29 {{{12.342399597167969,228.3424072265625}, {10,230.68629455566406}, {10,234} }}, 1,
25 {{10,234}, {0,0}}}, 30 {{10,234}, {0,0}}},
26 }; 31 };
27 32
28 static const size_t quadCubicTests_count = SK_ARRAY_COUNT(quadCubicTests); 33 static const size_t quadCubicTests_count = SK_ARRAY_COUNT(quadCubicTests);
29 34
30 static void PathOpsCubicQuadIntersectionTest(skiatest::Reporter* reporter) { 35 static void PathOpsCubicQuadIntersectionTest(skiatest::Reporter* reporter) {
31 for (size_t index = 0; index < quadCubicTests_count; ++index) { 36 for (size_t index = 0; index < quadCubicTests_count; ++index) {
32 int iIndex = static_cast<int>(index); 37 int iIndex = static_cast<int>(index);
33 const SkDCubic& cubic = quadCubicTests[index].cubic; 38 const SkDCubic& cubic = quadCubicTests[index].cubic;
34 SkASSERT(ValidCubic(cubic)); 39 SkASSERT(ValidCubic(cubic));
35 const SkDQuad& quad = quadCubicTests[index].quad; 40 const SkDQuad& quad = quadCubicTests[index].quad;
(...skipping 29 matching lines...) Expand all
65 found |= quadCubicTests[index].answers[idx2].approximatelyEqual( xy1); 70 found |= quadCubicTests[index].answers[idx2].approximatelyEqual( xy1);
66 } 71 }
67 REPORTER_ASSERT(reporter, found); 72 REPORTER_ASSERT(reporter, found);
68 } 73 }
69 reporter->bumpTestCount(); 74 reporter->bumpTestCount();
70 } 75 }
71 } 76 }
72 77
73 #include "TestClassDef.h" 78 #include "TestClassDef.h"
74 DEFINE_TESTCLASS_SHORT(PathOpsCubicQuadIntersectionTest) 79 DEFINE_TESTCLASS_SHORT(PathOpsCubicQuadIntersectionTest)
OLDNEW
« no previous file with comments | « tests/PathOpsCubicLineIntersectionTest.cpp ('k') | tests/PathOpsCubicReduceOrderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698