Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/tests/BKE_fcurve_test.cc
- This file was moved from tests/gtests/blenkernel/BKE_fcurve_test.cc.
| Show All 21 Lines | |||||
| extern "C" { | extern "C" { | ||||
| #include "BKE_fcurve.h" | #include "BKE_fcurve.h" | ||||
| #include "ED_keyframing.h" | #include "ED_keyframing.h" | ||||
| #include "DNA_anim_types.h" | #include "DNA_anim_types.h" | ||||
| } | } | ||||
| namespace BKE { | |||||
| namespace Tests { | |||||
| // Epsilon for floating point comparisons. | // Epsilon for floating point comparisons. | ||||
| static const float EPSILON = 1e-7f; | static const float EPSILON = 1e-7f; | ||||
| TEST(evaluate_fcurve, EmptyFCurve) | TEST(evaluate_fcurve, EmptyFCurve) | ||||
| { | { | ||||
| FCurve *fcu = static_cast<FCurve *>(MEM_callocN(sizeof(FCurve), "FCurve")); | FCurve *fcu = static_cast<FCurve *>(MEM_callocN(sizeof(FCurve), "FCurve")); | ||||
| EXPECT_EQ(evaluate_fcurve(fcu, 47.0f), 0.0f); | EXPECT_EQ(evaluate_fcurve(fcu, 47.0f), 0.0f); | ||||
| free_fcurve(fcu); | free_fcurve(fcu); | ||||
| ▲ Show 20 Lines • Show All 166 Lines • ▼ Show 20 Lines | TEST(evaluate_fcurve, ExtrapolationBezierKeys) | ||||
| EXPECT_NEAR(evaluate_fcurve(fcu, 0.75f), 7.0f, EPSILON); | EXPECT_NEAR(evaluate_fcurve(fcu, 0.75f), 7.0f, EPSILON); | ||||
| EXPECT_NEAR(evaluate_fcurve(fcu, -1.50f), 7.0f, EPSILON); | EXPECT_NEAR(evaluate_fcurve(fcu, -1.50f), 7.0f, EPSILON); | ||||
| // After last keyframe. | // After last keyframe. | ||||
| EXPECT_NEAR(evaluate_fcurve(fcu, 2.75f), 13.0f, EPSILON); | EXPECT_NEAR(evaluate_fcurve(fcu, 2.75f), 13.0f, EPSILON); | ||||
| EXPECT_NEAR(evaluate_fcurve(fcu, 3.50f), 13.0f, EPSILON); | EXPECT_NEAR(evaluate_fcurve(fcu, 3.50f), 13.0f, EPSILON); | ||||
| free_fcurve(fcu); | free_fcurve(fcu); | ||||
| } | } | ||||
| } // namespace Tests | |||||
| } // namespace BKE | |||||