[MediaCodec][Non-ACR] Add negative TCs 79/241979/2
authorHaesu Gwon <haesu.gwon@samsung.com>
Fri, 21 Aug 2020 07:50:06 +0000 (16:50 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Mon, 24 Aug 2020 03:21:02 +0000 (03:21 +0000)
Change-Id: Ifbae4df3d0cbb915a5ee0fa7b651f84a4458484e

tct-suite-vs/Tizen.MediaCodec.Tests/testcase/TSMediaCodec.cs

index 23decf96e48fe3181ad5278ef461ef4b0b14ea0a..96a1a4cfddd51b7d9e13d9000ebf30a271c9aa3e 100644 (file)
@@ -137,6 +137,22 @@ namespace Tizen.Multimedia.MediaCodec.Tests
                 () => _codec.Configure(format, true, MediaCodecTypes.Software));
         }
 
+        [Test]
+        [Category("P2")]
+        [Description("Throws if codec object is already disposed")]
+        [Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodec.Configure M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Configure_THROWS_IF_DISPOSED()
+        {
+            _codec.Dispose();
+
+            Assert.Throws<ObjectDisposedException>(() =>
+                _codec.Configure(VideoDecoderParser.Format, false, MediaCodecTypes.Software),
+                "Should throws proper exception");
+        }
+
         [Test]
         [Category("P2")]
         [Description("ProcessInput throws if the specified packet is null")]
@@ -149,6 +165,26 @@ namespace Tizen.Multimedia.MediaCodec.Tests
             Assert.Throws<ArgumentNullException>(() => _codec.ProcessInput(null));
         }
 
+        [Test]
+        [Category("P2")]
+        [Description("Throws if codec object is already disposed")]
+        [Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodec.ProcessInput M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void ProcessInput_THROWS_IF_DISPOSED()
+        {
+            var mediaFormat = new VideoMediaFormat(MediaFormatVideoMimeType.H263, new Size(352, 288));
+
+            _codec.Configure(VideoDecoderParser.Format, false, MediaCodecTypes.Software);
+            _codec.Prepare();
+
+            _codec.Dispose();
+
+            Assert.Throws<ObjectDisposedException>(() => _codec.ProcessInput(MediaPacket.Create(mediaFormat)),
+                "Should throws proper exception");
+        }
+
         [Test]
         [Category("P2")]
         [Description("Prepare throws if not configured")]
@@ -161,6 +197,23 @@ namespace Tizen.Multimedia.MediaCodec.Tests
             Assert.Throws<InvalidOperationException>(() => _codec.Prepare());
         }
 
+        [Test]
+        [Category("P2")]
+        [Description("Throws if codec object is already disposed")]
+        [Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodec.Prepare M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Prepare_THROWS_IF_DISPOSED()
+        {
+            _codec.Configure(VideoDecoderParser.Format, false, MediaCodecTypes.Software);
+
+            _codec.Dispose();
+
+            Assert.Throws<ObjectDisposedException>(() => _codec.Prepare(),
+                "Should throws proper exception");
+        }
+
         [Test]
         [Category("P1")]
         [Description("Unprepare throws if all resources are not unloaded")]
@@ -173,6 +226,21 @@ namespace Tizen.Multimedia.MediaCodec.Tests
             Assert.DoesNotThrow(() => _codec.Unprepare());
         }
 
+        [Test]
+        [Category("P2")]
+        [Description("Throws if codec object is already disposed")]
+        [Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodec.Unprepare M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void Unprepare_THROWS_IF_DISPOSED()
+        {
+            _codec.Dispose();
+
+            Assert.Throws<ObjectDisposedException>(() => _codec.Unprepare(),
+                "Should throws proper exception");
+        }
+
         [Test]
         [Category("P1")]
         [Description("GetCodecType returns zero if the specified type is not supported")]
@@ -186,6 +254,22 @@ namespace Tizen.Multimedia.MediaCodec.Tests
             Assert.AreEqual(0, (int)_codec.GetCodecType(true, MediaFormatVideoMimeType.Argb));
         }
 
+        [Test]
+        [Category("P2")]
+        [Description("Throws if codec object is already disposed")]
+        [Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodec.GetCodecType M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("COVPARAM", "bool, MediaFormatVideoMimeType")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void GetCodecType_THROWS_IF_DISPOSED()
+        {
+            _codec.Dispose();
+
+            Assert.Throws<ObjectDisposedException>(() => _codec.GetCodecType(true, MediaFormatVideoMimeType.Argb),
+                "Should throws proper exception");
+        }
+
         [Test]
         [Category("P1")]
         [Description("SupportedAudioCodecs has elements")]
@@ -407,6 +491,21 @@ namespace Tizen.Multimedia.MediaCodec.Tests
             Assert.DoesNotThrow(() => _codec.FlushBuffers());
         }
 
+        [Test]
+        [Category("P2")]
+        [Description("Throws if codec object is already disposed")]
+        [Property("SPEC", "Tizen.Multimedia.MediaCodec.MediaCodec.FlushBuffers M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void FlushBuffers_THROWS_IF_DISPOSED()
+        {
+            _codec.Dispose();
+
+            Assert.Throws<ObjectDisposedException>(() => _codec.FlushBuffers(),
+                "Should throws proper exception");
+        }
+
         [Test]
         [Category("P1")]
         [Description("Check if the codec is not supported in MediaCodec")]