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 
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
TEST(AllocationSizeTest, CanCreateTypedAllocations)
float Scalar
Definition: scalar.h:19
Scalar ComputeQuadradicSubdivisions(Scalar scale_factor, Point p0, Point p1, Point p2)
Scalar ComputeCubicSubdivisions(Scalar scale_factor, Point p0, Point p1, Point p2, Point p3)