[NUI] update testcase for text vector2
authorBowon Ryu <bowon.ryu@samsung.com>
Wed, 29 Dec 2021 12:31:04 +0000 (21:31 +0900)
committerSeoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com>
Wed, 12 Jan 2022 08:40:18 +0000 (17:40 +0900)
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/BaseComponents/TSTextMapHelper.cs
test/Tizen.NUI.Tests/Tizen.NUI.Devel.Tests/testcase/public/BaseComponents/TSTextUtils.cs

index 7e6871dafe01ba270b384b2b043017b3a2035b45..6babee3ea0c63ecc42b9219caba1262f7f9626ac 100644 (file)
@@ -24,6 +24,14 @@ namespace Tizen.NUI.Devel.Tests
             return false;
         }
 
+        public bool CheckVector2(Vector2 vectorSrc, Vector2 vectorDst)
+        {
+            if (vectorSrc.X == vectorDst.X && vectorSrc.Y == vectorDst.Y)
+                return true;
+
+            return false;
+        }
+
         [SetUp]
         public void Init()
         {
@@ -345,8 +353,7 @@ namespace Tizen.NUI.Devel.Tests
             map.Find(0, "blurRadius").Get(out float blurRadius);
 
             Assert.AreEqual(blurRadius, shadow.BlurRadius, "Should be equal!");
-            Assert.AreEqual(offset.X, shadow.Offset.X, "Should be equal!");
-            Assert.AreEqual(offset.Y, shadow.Offset.Y, "Should be equal!");
+            Assert.AreEqual(true, CheckVector2(offset, shadow.Offset), "Should be true!");
             Assert.AreEqual(true, CheckColor(color, shadow.Color), "Should be true!");
 
             tlog.Debug(tag, $"TextMapHelperGetShadowMap END (OK)");
@@ -375,8 +382,7 @@ namespace Tizen.NUI.Devel.Tests
             var shadow = TextMapHelper.GetShadowStruct(map);
 
             Assert.AreEqual(blurRadius, shadow.BlurRadius, "Should be equal!");
-            Assert.AreEqual(offset.X, shadow.Offset.X, "Should be equal!");
-            Assert.AreEqual(offset.Y, shadow.Offset.Y, "Should be equal!");
+            Assert.AreEqual(true, CheckVector2(offset, shadow.Offset), "Should be true!");
             Assert.AreEqual(true, CheckColor(color, shadow.Color), "Should be true!");
 
             tlog.Debug(tag, $"TextMapHelperGetShadowStruct END (OK)");
@@ -972,8 +978,7 @@ namespace Tizen.NUI.Devel.Tests
             map.Add(stringKey, new PropertyValue(value));
 
             var result = TextMapHelper.GetVector2FromMap(map, stringKey);
-            Assert.AreEqual(value.X, result.X, "Should be equal!");
-            Assert.AreEqual(value.Y, result.Y, "Should be equal!");
+            Assert.AreEqual(true, CheckVector2(value, result), "Should be true!");
 
             tlog.Debug(tag, $"TextMapHelperGetVector2FromMap END (OK)");
         }
index 5e0ca58a373901cb8a7ea9125a875ce5a44ed74b..f207012e337d73e6a820a81d10da3cbebef85efa 100755 (executable)
@@ -24,6 +24,14 @@ namespace Tizen.NUI.Devel.Tests
             return false;
         }
 
+        public bool CheckVector2(Vector2 vectorSrc, Vector2 vectorDst)
+        {
+            if (vectorSrc.X == vectorDst.X && vectorSrc.Y == vectorDst.Y)
+                return true;
+
+            return false;
+        }
+
         [SetUp]
         public void Init()
         {
@@ -632,9 +640,10 @@ namespace Tizen.NUI.Devel.Tests
             Assert.IsInstanceOf<EmbeddedItemInfo>(testingTarget, "Should be an instance of EmbeddedItemInfo type.");
 
             testingTarget.Position = new Vector2(100.0f, 200.0f);
-            Assert.AreEqual(100.0f, testingTarget.Position.X, "Should be equal!");
-            Assert.AreEqual(200.0f, testingTarget.Position.Y, "Should be equal!");
+            var position = new Vector2(100.0f, 200.0f); 
+            Assert.AreEqual(true, CheckVector2(position, testingTarget.Position), "Should be true!");
 
+            position.Dispose();
             testingTarget.Dispose();
             tlog.Debug(tag, $"TextUtilsEmbeddedItemInfoPosition END (OK)");
         }
@@ -841,9 +850,10 @@ namespace Tizen.NUI.Devel.Tests
             Assert.IsInstanceOf<ShadowParameters>(testingTarget, "Should be an instance of ShadowParameters type.");
 
             testingTarget.Offset = new Vector2(0.3f, 0.8f);
-            Assert.AreEqual(0.3f, testingTarget.Offset.X, "Should be equal!");
-            Assert.AreEqual(0.8f, testingTarget.Offset.Y, "Should be equal!");
+            var offset = new Vector2(0.3f, 0.8f);
+            Assert.AreEqual(true, CheckVector2(offset, testingTarget.Offset), "Should be true!");
 
+            offset.Dispose();
             testingTarget.Dispose();
             tlog.Debug(tag, $"TextUtilsShadowParametersOffset END (OK)");
         }