summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorreduz <reduzio@gmail.com>2022-03-23 21:08:54 +0100
committerreduz <reduzio@gmail.com>2022-03-24 14:21:52 +0100
commit09b951b99b1a8e799b00adaa896c788949c18017 (patch)
tree4a81fb9584b90063c651758ba53b16462083fe66 /tests
parentd7d528c15f0e858b52bb0f510ff47e65c2341de1 (diff)
Refactor Object metadata
* API kept the same (Although functions could be renamed to set_metadata/get_metadata in a later PR), so not much should change. * Metadata now exposed as individual properties. * Properties are editable in inspector (unless metadata name begins with _) under the metadata/ namespace. * Added the ability to Add/Remove metadata properties to the inspector. This is a functionality that was requested very often, that makes metadata work a bit more similar to custom properties in Blender.
Diffstat (limited to 'tests')
-rw-r--r--tests/core/io/test_resource.h6
-rw-r--r--tests/core/object/test_object.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/core/io/test_resource.h b/tests/core/io/test_resource.h
index b3983bb06d..84d651b63f 100644
--- a/tests/core/io/test_resource.h
+++ b/tests/core/io/test_resource.h
@@ -69,7 +69,7 @@ TEST_CASE("[Resource] Duplication") {
TEST_CASE("[Resource] Saving and loading") {
Ref<Resource> resource = memnew(Resource);
resource->set_name("Hello world");
- resource->set_meta(" ExampleMetadata ", Vector2i(40, 80));
+ resource->set_meta("ExampleMetadata", Vector2i(40, 80));
resource->set_meta("string", "The\nstring\nwith\nunnecessary\nline\n\t\\\nbreaks");
Ref<Resource> child_resource = memnew(Resource);
child_resource->set_name("I'm a child resource");
@@ -84,7 +84,7 @@ TEST_CASE("[Resource] Saving and loading") {
loaded_resource_binary->get_name() == "Hello world",
"The loaded resource name should be equal to the expected value.");
CHECK_MESSAGE(
- loaded_resource_binary->get_meta(" ExampleMetadata ") == Vector2i(40, 80),
+ loaded_resource_binary->get_meta("ExampleMetadata") == Vector2i(40, 80),
"The loaded resource metadata should be equal to the expected value.");
CHECK_MESSAGE(
loaded_resource_binary->get_meta("string") == "The\nstring\nwith\nunnecessary\nline\n\t\\\nbreaks",
@@ -99,7 +99,7 @@ TEST_CASE("[Resource] Saving and loading") {
loaded_resource_text->get_name() == "Hello world",
"The loaded resource name should be equal to the expected value.");
CHECK_MESSAGE(
- loaded_resource_text->get_meta(" ExampleMetadata ") == Vector2i(40, 80),
+ loaded_resource_text->get_meta("ExampleMetadata") == Vector2i(40, 80),
"The loaded resource metadata should be equal to the expected value.");
CHECK_MESSAGE(
loaded_resource_text->get_meta("string") == "The\nstring\nwith\nunnecessary\nline\n\t\\\nbreaks",
diff --git a/tests/core/object/test_object.h b/tests/core/object/test_object.h
index e44b93bb66..5b9d9cab53 100644
--- a/tests/core/object/test_object.h
+++ b/tests/core/object/test_object.h
@@ -133,7 +133,7 @@ TEST_CASE("[Object] Core getters") {
}
TEST_CASE("[Object] Metadata") {
- const String meta_path = "hello/world complex métadata\n\n\t\tpath";
+ const String meta_path = "complex_metadata_path";
Object object;
object.set_meta(meta_path, Color(0, 1, 0));