Blender
V5.3
source
blender
animrig
intern
anim_rna_test.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2026 Blender Authors
2
*
3
* SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9
#include "
ANIM_rna.hh
"
10
11
#include "
BKE_gtest_base.hh
"
12
13
#include "testing/testing.h"
14
15
namespace
blender::animrig::tests
{
16
17
class
AnimRnaTest
:
public
bke::BlenderGTestBase
{};
18
19
TEST_F
(
AnimRnaTest
,
is_rotation_path
)
20
{
21
EXPECT_TRUE
(
is_rotation_path
(*
ParsedRNAPath<>::from_string
(
"rotation_euler"
)));
22
EXPECT_TRUE
(
23
is_rotation_path
(*
ParsedRNAPath<>::from_string
(
"pose.bones[\"test\"].rotation_euler"
)));
24
25
EXPECT_FALSE
(
is_rotation_path
(*
ParsedRNAPath<>::from_string
(
"xrotation_euler"
)));
26
EXPECT_FALSE
(
is_rotation_path
(*
ParsedRNAPath<>::from_string
(
"rotation_euler2"
)));
27
EXPECT_FALSE
(
is_rotation_path
(*
ParsedRNAPath<>::from_string
(
"[\"rotation_euler\"]"
)));
28
EXPECT_FALSE
(
29
is_rotation_path
(*
ParsedRNAPath<>::from_string
(
"pose.bones[\"test\"][\"rotation_euler\"]"
)));
30
}
31
32
TEST_F
(
AnimRnaTest
, rotation_mode_from_path)
33
{
34
EXPECT_EQ
(
35
ROT_MODE_QUAT
,
36
get_rotation_mode_from_path
(*
ParsedRNAPath<>::from_string
(
"rotation_quaternion"
)).value());
37
EXPECT_EQ
(
ROT_MODE_EUL
,
38
get_rotation_mode_from_path
(*
ParsedRNAPath<>::from_string
(
"rotation_euler"
)).value());
39
EXPECT_EQ
(
ROT_MODE_EUL
,
40
get_rotation_mode_from_path
(
41
*
ParsedRNAPath<>::from_string
(
"pose.bones[\"test\"].rotation_euler"
))
42
.value());
43
EXPECT_EQ
(
44
ROT_MODE_AXISANGLE
,
45
get_rotation_mode_from_path
(*
ParsedRNAPath<>::from_string
(
"rotation_axis_angle"
)).value());
46
47
EXPECT_EQ
(std::nullopt,
get_rotation_mode_from_path
(*
ParsedRNAPath<>::from_string
(
"scale"
)));
48
EXPECT_EQ
(std::nullopt,
49
get_rotation_mode_from_path
(*
ParsedRNAPath<>::from_string
(
"xrotation_euler"
)));
50
EXPECT_EQ
(std::nullopt,
51
get_rotation_mode_from_path
(*
ParsedRNAPath<>::from_string
(
"rotation_euler2"
)));
52
}
53
54
}
// namespace blender::animrig::tests
ANIM_rna.hh
Helper functions for animation to interact with the RNA system.
BKE_gtest_base.hh
blender::ParsedRNAPath::from_string
static std::optional< ParsedRNAPath > from_string(StringRefNull path)
Definition
rna_path.cc:194
blender::animrig::tests::AnimRnaTest
Definition
anim_rna_test.cc:17
blender::bke::BlenderGTestBase
Definition
BKE_gtest_base.hh:17
EXPECT_FALSE
#define EXPECT_FALSE(result)
Definition
gpu_shader_test_lib.bsl.hh:199
EXPECT_TRUE
#define EXPECT_TRUE(result)
Definition
gpu_shader_test_lib.bsl.hh:198
blender::animrig::tests
Definition
action_iterators_test.cc:21
blender::animrig::tests::TEST_F
TEST_F(ActionIteratorsTest, iterate_all_fcurves_of_slot)
Definition
action_iterators_test.cc:39
blender::animrig::get_rotation_mode_from_path
std::optional< eRotationModes > get_rotation_mode_from_path(ParsedRNAPathRef rna_path)
Definition
anim_rna.cc:121
blender::animrig::is_rotation_path
bool is_rotation_path(ParsedRNAPathRef rna_path)
Definition
anim_rna.cc:165
blender::EXPECT_EQ
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
blender::ROT_MODE_EUL
@ ROT_MODE_EUL
Definition
DNA_action_types.h:291
blender::ROT_MODE_AXISANGLE
@ ROT_MODE_AXISANGLE
Definition
DNA_action_types.h:302
blender::ROT_MODE_QUAT
@ ROT_MODE_QUAT
Definition
DNA_action_types.h:288
Generated on
for Blender by
doxygen
1.18.0