Welcome to mirror list, hosted at ThFree Co, Russian Federation.

deg_builder_rna_test.cc « builder « intern « depsgraph « blender « source - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c548777ec7318f7ffb70d6ac7f9edc4bbf36490c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* SPDX-License-Identifier: GPL-2.0-or-later
 * Copyright 2020 Blender Foundation. All rights reserved. */

/** \file
 * \ingroup depsgraph
 */

#include "intern/builder/deg_builder_rna.h"

#include "testing/testing.h"

namespace blender::deg::tests {

class TestableRNANodeQuery : public RNANodeQuery {
 public:
  static bool contains(const char *prop_identifier, const char *rna_path_component)
  {
    return RNANodeQuery::contains(prop_identifier, rna_path_component);
  }
};

TEST(deg_builder_rna, contains)
{
  EXPECT_TRUE(TestableRNANodeQuery::contains("location", "location"));
  EXPECT_TRUE(TestableRNANodeQuery::contains("location.x", "location"));
  EXPECT_TRUE(TestableRNANodeQuery::contains("pose.bone[\"blork\"].location", "location"));
  EXPECT_TRUE(TestableRNANodeQuery::contains("pose.bone[\"blork\"].location.x", "location"));
  EXPECT_TRUE(TestableRNANodeQuery::contains("pose.bone[\"blork\"].location[0]", "location"));

  EXPECT_FALSE(TestableRNANodeQuery::contains("", "location"));
  EXPECT_FALSE(TestableRNANodeQuery::contains("locatio", "location"));
  EXPECT_FALSE(TestableRNANodeQuery::contains("locationnn", "location"));
  EXPECT_FALSE(TestableRNANodeQuery::contains("test_location", "location"));
  EXPECT_FALSE(TestableRNANodeQuery::contains("location_test", "location"));
  EXPECT_FALSE(TestableRNANodeQuery::contains("test_location_test", "location"));
  EXPECT_FALSE(TestableRNANodeQuery::contains("pose.bone[\"location\"].scale", "location"));
  EXPECT_FALSE(TestableRNANodeQuery::contains("pose.bone[\"location\"].scale[0]", "location"));
}

}  // namespace blender::deg::tests