Browse Source

Merge pull request #83959 from SilicDev/variant-assignment-test-fix

Fix Variant assignment to Vec2 tests
Rémi Verschelde 1 year ago
parent
commit
8d3820d2fa
1 changed files with 30 additions and 30 deletions
  1. 30 30
      tests/core/variant/test_variant.h

+ 30 - 30
tests/core/variant/test_variant.h

@@ -980,45 +980,45 @@ TEST_CASE("[Variant] Assignment To Vec2 from Bool,Int,Float,String,Vec2i,Vec3,Ve
 	CHECK(basis_v.get_type() == Variant::VECTOR2);
 
 	Variant aabb_v = AABB();
-	string_v = "Hello";
-	aabb_v = string_v;
-	CHECK(aabb_v == Variant("Hello"));
-	string_v = "Hello there";
-	aabb_v = string_v;
-	CHECK(aabb_v.get_type() == Variant::STRING);
+	vec2_v = Vector2(2.2f, 3.5f);
+	aabb_v = vec2_v;
+	CHECK(aabb_v == Variant(Vector2(2.2f, 3.5f)));
+	vec2_v = Vector2(-5.4f, -7.9f);
+	aabb_v = vec2_v;
+	CHECK(aabb_v.get_type() == Variant::VECTOR2);
 
 	Variant quaternion_v = Quaternion();
-	string_v = "Hello";
-	quaternion_v = string_v;
-	CHECK(quaternion_v == Variant("Hello"));
-	string_v = "Hello there";
-	quaternion_v = string_v;
-	CHECK(quaternion_v.get_type() == Variant::STRING);
+	vec2_v = Vector2(2.2f, 3.5f);
+	quaternion_v = vec2_v;
+	CHECK(quaternion_v == Variant(Vector2(2.2f, 3.5f)));
+	vec2_v = Vector2(-5.4f, -7.9f);
+	quaternion_v = vec2_v;
+	CHECK(quaternion_v.get_type() == Variant::VECTOR2);
 
 	Variant projection_v = Projection();
-	string_v = "Hello";
-	projection_v = string_v;
-	CHECK(projection_v == Variant("Hello"));
-	string_v = "Hello there";
-	projection_v = string_v;
-	CHECK(projection_v.get_type() == Variant::STRING);
+	vec2_v = Vector2(2.2f, 3.5f);
+	projection_v = vec2_v;
+	CHECK(projection_v == Variant(Vector2(2.2f, 3.5f)));
+	vec2_v = Vector2(-5.4f, -7.9f);
+	projection_v = vec2_v;
+	CHECK(projection_v.get_type() == Variant::VECTOR2);
 
 	Variant rid_v = RID();
-	string_v = "Hello";
-	rid_v = string_v;
-	CHECK(rid_v == Variant("Hello"));
-	string_v = "Hello there";
-	rid_v = string_v;
-	CHECK(rid_v.get_type() == Variant::STRING);
+	vec2_v = Vector2(2.2f, 3.5f);
+	rid_v = vec2_v;
+	CHECK(rid_v == Variant(Vector2(2.2f, 3.5f)));
+	vec2_v = Vector2(-5.4f, -7.9f);
+	rid_v = vec2_v;
+	CHECK(rid_v.get_type() == Variant::VECTOR2);
 
 	Object obj_one = Object();
 	Variant object_v = &obj_one;
-	string_v = "Hello";
-	object_v = string_v;
-	CHECK(object_v == Variant("Hello"));
-	string_v = "Hello there";
-	object_v = string_v;
-	CHECK(object_v.get_type() == Variant::STRING);
+	vec2_v = Vector2(2.2f, 3.5f);
+	object_v = vec2_v;
+	CHECK(object_v == Variant(Vector2(2.2f, 3.5f)));
+	vec2_v = Vector2(-5.4f, -7.9f);
+	object_v = vec2_v;
+	CHECK(object_v.get_type() == Variant::VECTOR2);
 }
 
 TEST_CASE("[Variant] Assignment To Vec2i from Bool,Int,Float,String,Vec2,Vec3,Vec3i,Vec4,Vec4i,Rect2,Rect2i,Trans2d,Trans3d,Color,Call,Plane,Basis,AABB,Quant,Proj,RID,and Object") {