diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/demo/main.gd | 9 | ||||
-rw-r--r-- | test/src/example.cpp | 24 | ||||
-rw-r--r-- | test/src/example.h | 2 |
3 files changed, 35 insertions, 0 deletions
diff --git a/test/demo/main.gd b/test/demo/main.gd index 671a879..7ef3ace 100644 --- a/test/demo/main.gd +++ b/test/demo/main.gd @@ -54,6 +54,15 @@ func _ready(): var array: Array[int] = [1, 2, 3] $Example.test_tarray_arg(array) + prints("String += operator") + prints(" test string +=", $Example.test_string_ops()) + + prints("WorkerThreadPool") + prints(" test worker_thread_pool", $Example.test_workpool_ops()) + + prints("PackedArray iterators") + prints(" test packed array iterators", $Example.test_vector_ops()) + prints("Properties") prints(" custom position is", $Example.group_subgroup_custom_position) $Example.group_subgroup_custom_position = Vector2(50, 50) diff --git a/test/src/example.cpp b/test/src/example.cpp index 6da1f52..dec8f57 100644 --- a/test/src/example.cpp +++ b/test/src/example.cpp @@ -123,6 +123,8 @@ void Example::_bind_methods() { ClassDB::bind_method(D_METHOD("test_tarray"), &Example::test_tarray); ClassDB::bind_method(D_METHOD("test_dictionary"), &Example::test_dictionary); ClassDB::bind_method(D_METHOD("test_node_argument"), &Example::test_node_argument); + ClassDB::bind_method(D_METHOD("test_string_ops"), &Example::test_string_ops); + ClassDB::bind_method(D_METHOD("test_vector_ops"), &Example::test_vector_ops); ClassDB::bind_method(D_METHOD("def_args", "a", "b"), &Example::def_args, DEFVAL(100), DEFVAL(200)); @@ -255,6 +257,28 @@ Array Example::test_array() const { return arr; } +String Example::test_string_ops() const { + String s = String("A"); + s += "B"; + s += "C"; + s += char32_t(0x010E); + s = s + "E"; + return s; +} + +int Example::test_vector_ops() const { + PackedInt32Array arr; + arr.push_back(10); + arr.push_back(20); + arr.push_back(30); + arr.push_back(45); + int ret = 0; + for (const int32_t &E : arr) { + ret += E; + } + return ret; +} + void Example::test_tarray_arg(const TypedArray<int64_t> &p_array) { for (int i = 0; i < p_array.size(); i++) { UtilityFunctions::print(p_array[i]); diff --git a/test/src/example.h b/test/src/example.h index 6857be2..2d4a6b0 100644 --- a/test/src/example.h +++ b/test/src/example.h @@ -101,6 +101,8 @@ public: TypedArray<Vector2> test_tarray() const; Dictionary test_dictionary() const; Example *test_node_argument(Example *p_node) const; + String test_string_ops() const; + int test_vector_ops() const; // Property. void set_custom_position(const Vector2 &pos); |