Skip to content

Commit

Permalink
Merge pull request godotengine#95517 from aaronfranke/fix-vec4-classdb
Browse files Browse the repository at this point in the history
Fix Vector4, Vector4i, and Projection missing from ClassDB tests
  • Loading branch information
akien-mga authored Aug 14, 2024
2 parents 06fbc83 + 5ced75a commit 0e355d7
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/core/object/test_class_db.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ struct NamesCache {
StringName vector2_type = StaticCString::create("Vector2");
StringName rect2_type = StaticCString::create("Rect2");
StringName vector3_type = StaticCString::create("Vector3");
StringName vector4_type = StaticCString::create("Vector4");

// Object not included as it must be checked for all derived classes
static constexpr int nullable_types_count = 18;
Expand Down Expand Up @@ -247,6 +248,8 @@ bool arg_default_value_is_assignable_to_type(const Context &p_context, const Var
case Variant::VECTOR2:
case Variant::RECT2:
case Variant::VECTOR3:
case Variant::VECTOR4:
case Variant::PROJECTION:
case Variant::RID:
case Variant::ARRAY:
case Variant::DICTIONARY:
Expand Down Expand Up @@ -274,13 +277,15 @@ bool arg_default_value_is_assignable_to_type(const Context &p_context, const Var
case Variant::VECTOR3I:
return p_arg_type.name == p_context.names_cache.vector3_type ||
p_arg_type.name == Variant::get_type_name(p_val.get_type());
default:
if (r_err_msg) {
*r_err_msg = "Unexpected Variant type: " + itos(p_val.get_type());
}
case Variant::VECTOR4I:
return p_arg_type.name == p_context.names_cache.vector4_type ||
p_arg_type.name == Variant::get_type_name(p_val.get_type());
case Variant::VARIANT_MAX:
break;
}

if (r_err_msg) {
*r_err_msg = "Unexpected Variant type: " + itos(p_val.get_type());
}
return false;
}

Expand Down

0 comments on commit 0e355d7

Please sign in to comment.