[TCSACR-488][WebRTC] Add new MediaFileSource IsLooping API 02/277402/2
authorHaesu Gwon <haesu.gwon@samsung.com>
Wed, 6 Jul 2022 08:23:45 +0000 (17:23 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Tue, 12 Jul 2022 03:57:12 +0000 (03:57 +0000)
Change-Id: I69ab71c6445b30d68553f671ba7b6196fd0c37f7

tct-suite-vs/Tizen.WebRTC.Tests/testcase/TSMediaFileSource.cs

index 33a2d5d..bf6360b 100755 (executable)
@@ -15,6 +15,7 @@
  */
 
 using NUnit.Framework;
+using System;
 
 namespace Tizen.Multimedia.Remoting.Tests {
 
@@ -75,5 +76,91 @@ namespace Tizen.Multimedia.Remoting.Tests {
             Assert.That(() => new MediaFileSource(MediaType.Video, null), Throws.ArgumentNullException,
                 "Should throw ArgumentNullException");
         }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check whether IsLooping returns expected value or not.")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaFileSource.IsLooping A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void IsLooping_READ_WRITE()
+        {
+            using (var webRtc = new WebRTC())
+            {
+                var source = new MediaFileSource(MediaType.Video, VideoFilePath);
+                webRtc.AddSource(source);
+
+                source.IsLooping = true;
+                Assert.That(source.IsLooping, Is.EqualTo(true),
+                    "Should return same value");
+
+                source.IsLooping = false;
+                Assert.That(source.IsLooping, Is.EqualTo(false),
+                    "Should return same value");
+            }
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check whether IsLooping returns expected default value or not.")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaFileSource.IsLooping A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PDV")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void IsLooping_CHECK_DEFAULT_VALUE()
+        {
+            using (var webRtc = new WebRTC())
+            {
+                var source = new MediaFileSource(MediaType.Video, VideoFilePath);
+                webRtc.AddSource(source);
+
+                Assert.That(source.IsLooping, Is.EqualTo(false),
+                    "Should return proper default value - false");
+            }
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether IsLooping throws exception(setter) or return false(getter) when it's not attached.")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaFileSource.IsLooping A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void IsLooping_THROWS_IF_NOT_ATTACHED()
+        {
+            var source = new MediaFileSource(MediaType.Video, VideoFilePath);
+
+            Assert.That(() => source.IsLooping = true, Throws.InvalidOperationException,
+                "Should return InvalidOperationException");
+
+            Assert.That(() => source.IsLooping, Is.EqualTo(false),
+                "Should return default value - false");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Check whether IsLooping throws exception when it's already disposed.")]
+        [Property("SPEC", "Tizen.Multimedia.Remoting.MediaFileSource.IsLooping A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PEX")]
+        [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")]
+        public void IsLooping_THROWS_IF_ALREADY_DISPOSED()
+        {
+            using (var webRtc = new WebRTC())
+            {
+                var source = new MediaFileSource(MediaType.Video, VideoFilePath);
+                webRtc.AddSource(source);
+
+                webRtc.Dispose();
+
+                Assert.That(() => source.IsLooping, Throws.TypeOf<ObjectDisposedException>(),
+                    "Should return ObjectDisposedException");
+
+                Assert.That(() => source.IsLooping = true, Throws.TypeOf<ObjectDisposedException>(),
+                    "Should return ObjectDisposedException");
+            }
+
+        }
     }
 }
\ No newline at end of file