11304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com/*
21304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com * Copyright 2012 Google Inc.
31304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com *
41304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com * Use of this source code is governed by a BSD-style license that can be
51304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com * found in the LICENSE file.
61304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com */
71304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com#include "Intersection_Tests.h"
81304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com#include "CubicUtilities.h"
91304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com
101304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.comconst Cubic tests[] = {
111304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com    {{2, 0}, {3, 1}, {2, 2}, {1, 1}},
121304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com    {{3, 1}, {2, 2}, {1, 1}, {2, 0}},
131304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com    {{3, 0}, {2, 1}, {3, 2}, {1, 1}},
141304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com};
151304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com
161304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.comconst size_t tests_count = sizeof(tests) / sizeof(tests[0]);
171304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.comstatic size_t firstLineParameterTest = 0;
181304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com
191304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.comvoid CubicUtilities_Test() {
201304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com    for (size_t index = firstLineParameterTest; index < tests_count; ++index) {
211304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com        const Cubic& cubic = tests[index];
221304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com        bool result = clockwise(cubic);
231304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com        if (!result) {
241304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com            SkDebugf("%s [%d] expected clockwise\n", __FUNCTION__, index);
251304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com            SkASSERT(0);
261304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com        }
271304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com    }
281304bb25aa3b0baa61fc2e2900fabcef88801b59caryclark@google.com}
29