summaryrefslogtreecommitdiffstats
path: root/test/src/example.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/example.cpp')
-rw-r--r--test/src/example.cpp11
1 files changed, 11 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);