[MediaPlayer][ACR-183] add new TCs to set/get the video roi area 59/188759/4
authornam <just.nam@samsung.com>
Mon, 10 Sep 2018 05:57:06 +0000 (14:57 +0900)
committernam <just.nam@samsung.com>
Thu, 13 Sep 2018 07:05:46 +0000 (16:05 +0900)
Change-Id: I444bee6b24e3f0902d4f0e6b04b116698b842df1

tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs
tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSScaleRectangle.cs [new file with mode: 0644]

index eed0be6..87c3f15 100755 (executable)
@@ -1658,5 +1658,108 @@ namespace Tizen.Multimedia.Tests
             Assert.That(TestPlayer.AdaptiveVariants, Is.Not.Null);
         }
         #endregion
+
+        #region VideoRoi
+        [Test]
+        [Category("P1")]
+        [Description("SetVideoRoi default test")]
+        [Property("SPEC", "Tizen.Multimedia.Player.SetVideoRoi M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MCST")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void SetVideoRoi_DEFAULT()
+        {
+            Player player = new Player();
+            player.SetSource(Constants.VideoFileSource);
+            player.Display = new Display(CreateWindow());
+
+            ScaleRectangle sr = new ScaleRectangle(0.19, 0.98765, 1.0, 0.21548);
+
+            Assert.That(() => player.SetVideoRoi(sr), Throws.Nothing);
+            Assert.That(player.GetVideoRoi(), Is.EqualTo(sr), "Invalid value.");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Any attempt to call the SetVideoRoi if the player has been disposed of")]
+        [Property("SPEC", "Tizen.Multimedia.Player.SetVideoRoi M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void SetVideoRoi_DISPOSED()
+        {
+            GetIdlePlayer().Dispose();
+
+            Assert.That(() => TestPlayer.SetVideoRoi(new ScaleRectangle(0.1, 0.1, 0.3, 0.4)),
+                Throws.TypeOf<ObjectDisposedException>());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("SetVideoRoi throws exceptions if out of range")]
+        [Property("SPEC", "Tizen.Multimedia.Player.SetVideoRoi M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void SetVideoRoi_OUT_OF_RANGE()
+        {
+            Player player = new Player();
+            player.SetSource(Constants.VideoFileSource);
+            player.Display = new Display(CreateWindow());
+
+            Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0, 0, 0, 0)), Throws.TypeOf<ArgumentOutOfRangeException>());
+            Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.1, 0.1, 0.18, 4)), Throws.TypeOf<ArgumentOutOfRangeException>());
+            Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.99, -0.1, 1, 1)), Throws.TypeOf<ArgumentOutOfRangeException>());
+            Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.1, 0.1, 1.1, 1)), Throws.TypeOf<ArgumentOutOfRangeException>());
+            Assert.That(() => player.SetVideoRoi(new ScaleRectangle(-3, 0.1, 1, 1)), Throws.TypeOf<ArgumentOutOfRangeException>());
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("SetVideoRoi throws if display has wrong type")]
+        [Property("SPEC", "Tizen.Multimedia.Player.SetVideoRoi M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void SetVideoRoi_THROWS_IF_WRONG_DISPLAY_SET()
+        {
+            var player = GetIdlePlayer();
+            player.SetSource(Constants.VideoFileSource);
+
+            Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.1, 0.1, 0.3, 0.4)), Throws.InvalidOperationException);
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("GetVideoRoi default test")]
+        [Property("SPEC", "Tizen.Multimedia.Player.GetVideoRoi M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MCST")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public async Task GetVideoRoi_DEFAULT()
+        {
+            var player = await GetPreparedPlayer();
+
+            Assert.That(player.GetVideoRoi().ScaleX, Is.EqualTo(0), "Invalid default value. (ScaleX)");
+            Assert.That(player.GetVideoRoi().ScaleY, Is.EqualTo(0), "Invalid default value. (ScaleY)");
+
+            Assert.That(player.GetVideoRoi().ScaleWidth, Is.EqualTo(1), "Invalid default value. (ScaleWidth)");
+            Assert.That(player.GetVideoRoi().ScaleHeight, Is.EqualTo(1), "Invalid default value. (ScaleHeight)");
+        }
+
+        [Test]
+        [Category("P2")]
+        [Description("Any attempt to call the GetVideoRoi if the player has been disposed of")]
+        [Property("SPEC", "Tizen.Multimedia.Player.GetVideoRoi M")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "MEX")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public void GetVideoRoi_DISPOSED()
+        {
+            GetIdlePlayer().Dispose();
+
+            Assert.That(() => TestPlayer.GetVideoRoi(), Throws.TypeOf<ObjectDisposedException>());
+        }
+        #endregion
     }
 }
diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSScaleRectangle.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSScaleRectangle.cs
new file mode 100644 (file)
index 0000000..aef88c7
--- /dev/null
@@ -0,0 +1,72 @@
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Threading.Tasks;
+
+namespace Tizen.Multimedia.Tests
+{
+    [TestFixture]
+    [Description("Tizen.Multimedia.ScaleRectangle Tests")]
+    public class ScaleRectangleoTests : TestBase
+    {
+        [Test]
+        [Category("P1")]
+        [Description("Constructor test")]
+        [Property("SPEC", "Tizen.Multimedia.ScaleRectangle.ScaleRectangle C")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "CONSTR")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void ScaleRectangle_CHECK_RETURN()
+        {
+            Assert.DoesNotThrow(() => new ScaleRectangle(0, 0, 1, 1));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check whether ScaleX is readable and writable")]
+        [Property("SPEC", "Tizen.Multimedia.ScaleRectangle.ScaleX A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void ScaleX_READ_WRITE()
+        {
+            AssertHelper.PropertyReadWrite<ScaleRectangle>(nameof(ScaleRectangle.ScaleX));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check whether ScaleY is readable and writable")]
+        [Property("SPEC", "Tizen.Multimedia.ScaleRectangle.ScaleY A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void ScaleY_READ_WRITE()
+        {
+            AssertHelper.PropertyReadWrite<ScaleRectangle>(nameof(ScaleRectangle.ScaleY));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check whether ScaleWidth is readable and writable")]
+        [Property("SPEC", "Tizen.Multimedia.ScaleRectangle.ScaleWidth A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void ScaleWidth_READ_WRITE()
+        {
+            AssertHelper.PropertyReadWrite<ScaleRectangle>(nameof(ScaleRectangle.ScaleWidth));
+        }
+
+        [Test]
+        [Category("P1")]
+        [Description("Check whether ScaleHeight is readable and writable")]
+        [Property("SPEC", "Tizen.Multimedia.ScaleRectangle.ScaleHeight A")]
+        [Property("SPEC_URL", "-")]
+        [Property("CRITERIA", "PRW")]
+        [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")]
+        public static void ScaleHeight_READ_WRITE()
+        {
+            AssertHelper.PropertyReadWrite<ScaleRectangle>(nameof(ScaleRectangle.ScaleHeight));
+        }
+    }
+}