[MediaVision][TCSACR-534] Add new APIs for Design QR 78/291178/3
authorHaesu Gwon <haesu.gwon@samsung.com>
Tue, 11 Apr 2023 06:35:51 +0000 (15:35 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Tue, 18 Apr 2023 01:48:38 +0000 (01:48 +0000)
- Add Design QR TCs
- Add missing MetadataFilePath TCs

Change-Id: I830e077e9487bf63b98437aaae3a9397edab9f9b

tct-suite-vs/Tizen.MediaVision.Tests/testcase/TSInferenceModelConfiguration.cs
tct-suite-vs/Tizen.MediaVision.Tests/testcase/TSQrConfiguration.cs

index df744da..3fa06e0 100644 (file)
@@ -228,6 +228,34 @@ namespace Tizen.Multimedia.Vision.Tests
 
         [Test]
         [Category("P1")]
+        [Description("Check whether MetadataFilePath returns correct value.")]
+        [Property("SPEC", "Tizen.Multimedia.Vision.InferenceModelConfiguration.MetadataFilePath A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void MetadataFilePath_READ_WRITE()
+        {
+            var path = TestHelper.TFLitePath + "face_detector/fd_tflite_meta_model.json";
+            _config.MetadataFilePath = path;
+
+            Assert.IsInstanceOf<string>(_config.MetadataFilePath);
+            Assert.AreEqual(path, _config.MetadataFilePath, "Should be got same value.");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether MetadataFilePath throws exception if parameter is null")]
+        [Property("SPEC", "Tizen.Multimedia.Vision.InferenceModelConfiguration.MetadataFilePath A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void MetadataFilePath_THROWS_IF_PARAM_IS_NULL()
+        {
+            Assert.Throws<ArgumentNullException>(() => _config.MetadataFilePath = null);
+        }
+
+        [Test]
+        [Category("P1")]
         [Description("Check whether MeanValue returns correct value.")]
         [Property("SPEC", "Tizen.Multimedia.Vision.InferenceModelConfiguration.MeanValue A")]
         [Property("SPEC_URL", "-")]
index 713bb83..4c81f01 100755 (executable)
@@ -15,6 +15,8 @@ namespace Tizen.Multimedia.Vision.Tests
     [Description("Tizen.Multimedia.Vision.QrConfiguration test class")]
     public class QrConfigurationTests
     {
+        private const string _mediaPath = "/opt/usr/test-barcode-generate-new";
+
         [Test]
         [Category("P1")]
         [Description("Tests instantiating a QrConfiguration instance")]
@@ -180,5 +182,122 @@ namespace Tizen.Multimedia.Vision.Tests
             var obj = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
             Assert.AreEqual(obj.Version, 30, "Version is incorrect");
         }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check whether EmbedImagePath returns expected value or not.")]
+        [Property("SPEC", "Tizen.Multimedia.Vision.QrConfiguration.EmbedImagePath A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void EmbedImagePath_READ_WRITE()
+        {
+            var obj = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
+
+            obj.EmbedImagePath = _mediaPath;
+            Assert.AreEqual(obj.EmbedImagePath, _mediaPath, "EmbedImagePath should be the same");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether EmbedImagePath throws ArgumentNullException if parameter is null.")]
+        [Property("SPEC", "Tizen.Multimedia.Vision.QrConfiguration.EmbedImagePath A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void EmbedImagePath_THROWS_IF_NULL_PARAM()
+        {
+            var obj = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
+
+            Assert.Throws<ArgumentNullException>(() => obj.EmbedImagePath = null, "Should throw ArgumentNullException");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether EmbedImagePath throws ArgumentException if parameter is invalid string.")]
+        [Property("SPEC", "Tizen.Multimedia.Vision.QrConfiguration.EmbedImagePath A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void EmbedImagePath_THROWS_IF_INVALID_STRING()
+        {
+            var obj = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
+
+            Assert.Throws<ArgumentException>(() => obj.EmbedImagePath = "", "Should throw ArgumentException");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check whether DataShape returns expected value or not.")]
+        [Property("SPEC", "Tizen.Multimedia.Vision.QrConfiguration.DataShape A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void DataShape_READ_WRITE()
+        {
+            var obj = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
+
+            foreach (QrShape dataShape in Enum.GetValues(typeof(QrShape)))
+            {
+                obj.DataShape = dataShape;
+
+                Assert.AreEqual(obj.DataShape, dataShape, "DataShape should be the same");
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether DataShape throws ArgumentException if parameter is invalid enum type.")]
+        [Property("SPEC", "Tizen.Multimedia.Vision.QrConfiguration.DataShape A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void DataShape_THROWS_IF_NULL_PARAM()
+        {
+            var obj = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
+
+            Assert.Throws<ArgumentException>(() => obj.DataShape = QrShape.Rectangular - 1,
+                "Should throw ArgumentException");
+
+            Assert.Throws<ArgumentException>(() => obj.DataShape = QrShape.Circle + 1,
+                "Should throw ArgumentException");
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check whether FinderShape returns expected value or not.")]
+        [Property("SPEC", "Tizen.Multimedia.Vision.QrConfiguration.FinderShape A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void FinderShape_READ_WRITE()
+        {
+            var obj = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
+
+            foreach (QrShape finderShape in Enum.GetValues(typeof(QrShape)))
+            {
+                obj.FinderShape = finderShape;
+
+                Assert.AreEqual(obj.FinderShape, finderShape, "FinderShape should be the same");
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether FinderShape throws ArgumentException if parameter is invalid enum type.")]
+        [Property("SPEC", "Tizen.Multimedia.Vision.QrConfiguration.FinderShape A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void FinderShape_THROWS_IF_NULL_PARAM()
+        {
+            var obj = new QrConfiguration(QrMode.Numeric, ErrorCorrectionLevel.Medium, 30);
+
+            Assert.Throws<ArgumentException>(() => obj.FinderShape = QrShape.Rectangular - 1,
+                "Should throw ArgumentException");
+
+            Assert.Throws<ArgumentException>(() => obj.FinderShape = QrShape.Circle + 1,
+                "Should throw ArgumentException");
+        }
     }
 }