From ea2c1a2c561c9bdb218ff1cfed196f5345a4a588 Mon Sep 17 00:00:00 2001 From: Haesu Gwon Date: Thu, 24 Aug 2023 10:47:58 +0900 Subject: [PATCH] [Non-ACR][Multimedia] Improve tc coverage Change-Id: I8b9e6e920294e2fa7afc0a67775a34d09a9b1fed --- .../testcase/MediaTool/TSTextMediaFormat.cs | 19 +++++++++++++++++++ .../testcase/ImageUtil/TSCropTransform.cs | 18 ++++++++++++------ .../testcase/ImageUtil/TSFlipTransform.cs | 15 +++++++++++++++ .../testcase/ImageUtil/TSImageTransformer.cs | 12 ++++++++++++ .../testcase/ImageUtil/TSRotateTransform.cs | 12 ++++++++++++ 5 files changed, 70 insertions(+), 6 deletions(-) diff --git a/tct-suite-vs/Tizen.Multimedia.Tests/testcase/MediaTool/TSTextMediaFormat.cs b/tct-suite-vs/Tizen.Multimedia.Tests/testcase/MediaTool/TSTextMediaFormat.cs index 5b97a74..a2ddee8 100644 --- a/tct-suite-vs/Tizen.Multimedia.Tests/testcase/MediaTool/TSTextMediaFormat.cs +++ b/tct-suite-vs/Tizen.Multimedia.Tests/testcase/MediaTool/TSTextMediaFormat.cs @@ -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"); } } } diff --git a/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSCropTransform.cs b/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSCropTransform.cs index 409f023..38b6de0 100755 --- a/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSCropTransform.cs +++ b/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSCropTransform.cs @@ -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(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(), + "Should throw proper exception"); + + Assert.That(() => _cropTransform.Region = new Rectangle(0, -1, 50, 50), Throws.TypeOf(), + "Should throw proper exception"); + + Assert.That(() => _cropTransform.Region = new Rectangle(0, 0, 0, 50), Throws.TypeOf(), + "Should throw proper exception"); + + Assert.That(() => _cropTransform.Region = new Rectangle(0, 0, 50, -1), Throws.TypeOf(), + "Should throw proper exception"); } [Test] diff --git a/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSFlipTransform.cs b/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSFlipTransform.cs index 6ee46a1..54c2fbd 100755 --- a/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSFlipTransform.cs +++ b/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSFlipTransform.cs @@ -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(), + "Should throw proper exception"); + } + + [Test] [Category("P1")] [Description("Read write")] [Property("SPEC", "Tizen.Multimedia.Util.FlipTransform.Flip A")] diff --git a/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSImageTransformer.cs b/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSImageTransformer.cs index bd7366b..75e4825 100755 --- a/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSImageTransformer.cs +++ b/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSImageTransformer.cs @@ -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] diff --git a/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSRotateTransform.cs b/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSRotateTransform.cs index fefcce0..817efe1 100755 --- a/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSRotateTransform.cs +++ b/tct-suite-vs/Tizen.MultimediaUtil.Tests/testcase/ImageUtil/TSRotateTransform.cs @@ -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(() => _rotateTransform.Rotation = Rotation.Rotate0); + } + + [Test] [Category("P1")] [Description("Read write")] [Property("SPEC", "Tizen.Multimedia.Util.RotateTransform.Rotation A")] -- 2.7.4