summaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
Diffstat (limited to 'test/src')
-rw-r--r--test/src/example.cpp11
-rw-r--r--test/src/example.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/test/src/example.cpp b/test/src/example.cpp
index fb47dd8..af3837a 100644
--- a/test/src/example.cpp
+++ b/test/src/example.cpp
@@ -139,6 +139,7 @@ void Example::_bind_methods() {
ClassDB::bind_method(D_METHOD("test_string_ops"), &Example::test_string_ops);
ClassDB::bind_method(D_METHOD("test_str_utility"), &Example::test_str_utility);
ClassDB::bind_method(D_METHOD("test_string_is_fourty_two"), &Example::test_string_is_fourty_two);
+ ClassDB::bind_method(D_METHOD("test_string_resize"), &Example::test_string_resize);
ClassDB::bind_method(D_METHOD("test_vector_ops"), &Example::test_vector_ops);
ClassDB::bind_method(D_METHOD("test_bitfield", "flags"), &Example::test_bitfield);
@@ -304,6 +305,16 @@ bool Example::test_string_is_fourty_two(const String &p_string) const {
return strcmp(p_string.utf8().ptr(), "fourty two") == 0;
}
+String Example::test_string_resize(String p_string) const {
+ int orig_len = p_string.length();
+ p_string.resize(orig_len + 3);
+ char32_t *data = p_string.ptrw();
+ data[orig_len + 0] = '!';
+ data[orig_len + 1] = '?';
+ data[orig_len + 2] = '\0';
+ return p_string;
+}
+
int Example::test_vector_ops() const {
PackedInt32Array arr;
arr.push_back(10);
diff --git a/test/src/example.h b/test/src/example.h
index a84efed..ce64c31 100644
--- a/test/src/example.h
+++ b/test/src/example.h
@@ -118,6 +118,7 @@ public:
String test_string_ops() const;
String test_str_utility() const;
bool test_string_is_fourty_two(const String &p_str) const;
+ String test_string_resize(String p_original) const;
int test_vector_ops() const;
BitField<Flags> test_bitfield(BitField<Flags> flags);