[Non-ACR][Multimedia] Improve tc coverage 58/297758/1
authorHaesu Gwon <haesu.gwon@samsung.com>
Thu, 24 Aug 2023 01:47:58 +0000 (10:47 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Thu, 24 Aug 2023 01:47:58 +0000 (10:47 +0900)
Change-Id: I8b9e6e920294e2fa7afc0a67775a34d09a9b1fed

tct-suite-vs/Tizen.Multimedia.Tests/testcase/MediaTool/TSTextMediaFormat.cs
tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSCropTransform.cs
tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSFlipTransform.cs
tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSImageTransformer.cs
tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSRotateTransform.cs

index 5b97a74..a2ddee8 100644 (file)
@@ -105,6 +105,25 @@ namespace Tizen.Multimedia.Tests
 
             Assert.That(textFormat.Equals(textFormat2), Is.True);
             Assert.That(textFormat.Equals(textFormat3), Is.False);
+            Assert.That(textFormat.Equals(null), Is.False);
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check whether ToString returns expected value or not.")]
+        [Property("SPEC", "Tizen.Multimedia.TextMediaFormat.ToString M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MR")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void ToString_CHECK()
+        {
+            const MediaFormatTextMimeType mimeType = MediaFormatTextMimeType.MP4;
+            const MediaFormatTextType textType = MediaFormatTextType.MP4;
+
+            var textFormat = new TextMediaFormat(mimeType, textType);
+
+            Assert.AreEqual(textFormat.ToString(), $"MimeType={ mimeType.ToString() }, TextType={ textType.ToString() }",
+                "Should be same string");
         }
     }
 }
index 409f023..38b6de0 100755 (executable)
@@ -49,18 +49,24 @@ namespace Tizen.Multimedia.Util.Tests
 
         [Test]
         [Category("P2")]
-        [Description("Check if it throws out of range exception for region property for arguments less than zero")]
+        [Description("Check if it throws out of range exception for region property for invalid arguments")]
         [Property("SPEC", "Tizen.Multimedia.Util.CropTransform.Region A")]
         [Property("SPEC_URL", "-")]
         [Property("CRITERIA", "PEX")]
         [Property("AUTHOR", "Gaurang Khanwalkar, g.khanwalkar@samsung.com")]
         public void Region_PROPERTY_CHECK_EXCEPTION()
         {
-            Assert.Throws<ArgumentOutOfRangeException>(delegate
-            {
-                _cropTransform.Region = new Rectangle(-1, -1, 50, 50);
-                Assert.AreEqual(_cropTransform.Region.X, 5, "Failed to retrieve region location");
-            });
+            Assert.That(() => _cropTransform.Region = new Rectangle(-1, 0, 50, 50), Throws.TypeOf<ArgumentOutOfRangeException>(),
+                "Should throw proper exception");
+
+            Assert.That(() => _cropTransform.Region = new Rectangle(0, -1, 50, 50), Throws.TypeOf<ArgumentOutOfRangeException>(),
+                "Should throw proper exception");
+
+            Assert.That(() => _cropTransform.Region = new Rectangle(0, 0, 0, 50), Throws.TypeOf<ArgumentOutOfRangeException>(),
+                "Should throw proper exception");
+
+            Assert.That(() => _cropTransform.Region = new Rectangle(0, 0, 50, -1), Throws.TypeOf<ArgumentOutOfRangeException>(),
+                "Should throw proper exception");
         }
 
         [Test]
index 6ee46a1..54c2fbd 100755 (executable)
@@ -54,6 +54,21 @@ namespace Tizen.Multimedia.Util.Tests
         }
 
         [Test]
+        [Category("P2")]
+        [Description("Throws if the value is invalid")]
+        [Property("SPEC", "Tizen.Multimedia.Util.FlipTransform.Flip A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Flip_THROWS_ARGUMENT_OUT_OF_RANAGE_EXCEPTION()
+        {
+            var flipTransform = new FlipTransform(Flips.Horizontal);
+
+            Assert.That(() => flipTransform.Flip = Flips.None, Throws.TypeOf<ArgumentOutOfRangeException>(),
+                "Should throw proper exception");
+        }
+
+        [Test]
         [Category("P1")]
         [Description("Read write")]
         [Property("SPEC", "Tizen.Multimedia.Util.FlipTransform.Flip A")]
index bd7366b..75e4825 100755 (executable)
@@ -79,10 +79,22 @@ namespace Tizen.Multimedia.Util.Tests
             CreatePacket();
 
             using (var newPacket = await _imageTransformer.TransformAsync(_packet,
+                new RotateTransform(Rotation.Rotate90)))
+            {
+                Assert.Greater(newPacket.VideoPlanes[0].Buffer.Length, 0);
+            }
+
+            using (var newPacket = await _imageTransformer.TransformAsync(_packet,
                 new RotateTransform(Rotation.Rotate180)))
             {
                 Assert.Greater(newPacket.VideoPlanes[0].Buffer.Length, 0);
             }
+
+            using (var newPacket = await _imageTransformer.TransformAsync(_packet,
+                new RotateTransform(Rotation.Rotate270)))
+            {
+                Assert.Greater(newPacket.VideoPlanes[0].Buffer.Length, 0);
+            }
         }
 
         [Test]
index fefcce0..817efe1 100755 (executable)
@@ -61,6 +61,18 @@ namespace Tizen.Multimedia.Util.Tests
         }
 
         [Test]
+        [Category("P2")]
+        [Description("Check if it throws argument out of range exception for setting rotation with 0 degree")]
+        [Property("SPEC", "Tizen.Multimedia.Util.RotateTransform.Rotation A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Rotation_PROPERTY_CHECK_ARGUMENT_OUT_OF_RANAGE_EXCEPTION()
+        {
+            Assert.Throws<ArgumentOutOfRangeException>(() => _rotateTransform.Rotation = Rotation.Rotate0);
+        }
+
+        [Test]
         [Category("P1")]
         [Description("Read write")]
         [Property("SPEC", "Tizen.Multimedia.Util.RotateTransform.Rotation A")]