| Flutter Impeller |

wangs_formula_unittests.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "gtest/gtest.h"
6
7 #include "flutter/impeller/geometry/wangs_formula.h"
8
9 namespace impeller {
10 namespace testing {
11
12 TEST(WangsFormulaTest, Cubic) {
13 Point p0{300, 0};
14 Point p1{0, 0};
15 Point p2{0, 0};
16 Point p3{0, 300};
17 Scalar result = ComputeCubicSubdivisions(1.0, p0, p1, p2, p3);
18 EXPECT_FLOAT_EQ(result, 30.f);
19 }
20
21 TEST(WangsFormulaTest, Quadratic) {
22 Point p0{15, 0};
23 Point p1{0, 0};
24 Point p2{0, 20};
25 Scalar result = ComputeQuadradicSubdivisions(1.0, p0, p1, p2);
26 EXPECT_FLOAT_EQ(result, 5.f);
27 }
28
29 } // namespace testing
30 } // namespace impeller
impeller::testing::TEST
TEST(AllocationSizeTest, CanCreateTypedAllocations)
Definition: allocation_size_unittests.cc:10
impeller
Definition: allocation.cc:12
impeller::Scalar
float Scalar
Definition: scalar.h:19
impeller::ComputeQuadradicSubdivisions
Scalar ComputeQuadradicSubdivisions(Scalar scale_factor, Point p0, Point p1, Point p2)
Definition: wangs_formula.cc:31
impeller::ComputeCubicSubdivisions
Scalar ComputeCubicSubdivisions(Scalar scale_factor, Point p0, Point p1, Point p2, Point p3)
Definition: wangs_formula.cc:18
impeller::TPoint< Scalar >
wangs_formula.h