Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for testing Vector4 arguments #71

Merged
merged 1 commit into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AutomaticBugs/BasicData.gd
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ func check_if_is_allowed(method_data: Dictionary) -> bool:
|| t == TYPE_VECTOR3
|| t == TYPE_VECTOR3I
|| t == TYPE_PACKED_VECTOR3_ARRAY
|| t == TYPE_VECTOR4
|| t == TYPE_VECTOR4I
):
print("----------------------------------------------------------- TODO - MISSING TYPE, ADD SUPPORT IT") # Add assert here to get info which type is missing
return false
Expand Down
24 changes: 24 additions & 0 deletions AutomaticBugs/ParseArgumentType.gd
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ func parse_and_return_objects(method_data: Dictionary, name_of_class: String, de
arguments_array.push_back(PackedVector3Array([]))
elif type == TYPE_CALLABLE:
arguments_array.push_back(Callable(BoxMesh.new(), "Rar"))
elif type == TYPE_VECTOR4:
arguments_array.push_back(ValueCreator.get_vector4())
elif type == TYPE_VECTOR4I:
arguments_array.push_back(ValueCreator.get_vector4i())
else:
assert(false) # Missed some types, add it

Expand Down Expand Up @@ -297,6 +301,26 @@ func return_gdscript_code_which_run_this_object(data) -> String:
return_string += ", "
return_string += return_gdscript_code_which_run_this_object(data.z)
return_string += ")"
elif type == TYPE_VECTOR4:
return_string = "Vector4("
return_string += return_gdscript_code_which_run_this_object(data.x)
return_string += ", "
return_string += return_gdscript_code_which_run_this_object(data.y)
return_string += ", "
return_string += return_gdscript_code_which_run_this_object(data.z)
return_string += ", "
return_string += return_gdscript_code_which_run_this_object(data.w)
return_string += ")"
elif type == TYPE_VECTOR4I:
return_string = "Vector4i("
return_string += return_gdscript_code_which_run_this_object(data.x)
return_string += ", "
return_string += return_gdscript_code_which_run_this_object(data.y)
return_string += ", "
return_string += return_gdscript_code_which_run_this_object(data.z)
return_string += ", "
return_string += return_gdscript_code_which_run_this_object(data.w)
return_string += ")"
elif type == TYPE_STRING_NAME:
return_string = "StringName("
return_string += return_gdscript_code_which_run_this_object(str(data))
Expand Down
6 changes: 6 additions & 0 deletions AutomaticBugs/ValueCreator.gd
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ func get_vector3() -> Vector3:
func get_vector3i() -> Vector3i:
return Vector3i(get_int(), get_int(), get_int())

func get_vector4() -> Vector4:
return Vector4(get_float(), get_float(), get_float(), get_float())


func get_vector4i() -> Vector4i:
return Vector4i(get_int(), get_int(), get_int(), get_int())

func get_aabb() -> AABB:
return AABB(get_vector3(), get_vector3())
Expand Down
2 changes: 1 addition & 1 deletion Start.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
[node name="Start" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
script = ExtResource( "1" )
script = ExtResource("1")
2 changes: 1 addition & 1 deletion project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ config_version=5
[application]

run/main_scene="res://Start.tscn"
config/icon="res://icon.png"
config/features=PackedStringArray("4.0")
config/icon="res://icon.png"

[autoload]

Expand Down