Blender  V2.93
deg_builder_rna_test.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2020 Blender Foundation.
17  * All rights reserved.
18  */
19 
25 
26 #include "testing/testing.h"
27 
29 
31  public:
32  static bool contains(const char *prop_identifier, const char *rna_path_component)
33  {
34  return RNANodeQuery::contains(prop_identifier, rna_path_component);
35  }
36 };
37 
38 TEST(deg_builder_rna, contains)
39 {
40  EXPECT_TRUE(TestableRNANodeQuery::contains("location", "location"));
41  EXPECT_TRUE(TestableRNANodeQuery::contains("location.x", "location"));
42  EXPECT_TRUE(TestableRNANodeQuery::contains("pose.bone[\"blork\"].location", "location"));
43  EXPECT_TRUE(TestableRNANodeQuery::contains("pose.bone[\"blork\"].location.x", "location"));
44  EXPECT_TRUE(TestableRNANodeQuery::contains("pose.bone[\"blork\"].location[0]", "location"));
45 
46  EXPECT_FALSE(TestableRNANodeQuery::contains("", "location"));
47  EXPECT_FALSE(TestableRNANodeQuery::contains("locatio", "location"));
48  EXPECT_FALSE(TestableRNANodeQuery::contains("locationnn", "location"));
49  EXPECT_FALSE(TestableRNANodeQuery::contains("test_location", "location"));
50  EXPECT_FALSE(TestableRNANodeQuery::contains("location_test", "location"));
51  EXPECT_FALSE(TestableRNANodeQuery::contains("test_location_test", "location"));
52  EXPECT_FALSE(TestableRNANodeQuery::contains("pose.bone[\"location\"].scale", "location"));
53  EXPECT_FALSE(TestableRNANodeQuery::contains("pose.bone[\"location\"].scale[0]", "location"));
54 }
55 
56 } // namespace blender::deg::tests
static bool contains(const char *prop_identifier, const char *rna_path_component)
static bool contains(const char *prop_identifier, const char *rna_path_component)
TEST(deg_builder_rna, contains)