From fc5e8a01bd6cd7a76c6cb39208dd2ef64cc609e4 Mon Sep 17 00:00:00 2001 From: nam Date: Mon, 10 Sep 2018 14:57:06 +0900 Subject: [PATCH] [MediaPlayer][ACR-183] add new TCs to set/get the video roi area Change-Id: I444bee6b24e3f0902d4f0e6b04b116698b842df1 --- .../Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs | 103 +++++++++++++++++++++ .../testcase/TSScaleRectangle.cs | 72 ++++++++++++++ 2 files changed, 175 insertions(+) create mode 100644 tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSScaleRectangle.cs diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs index eed0be6..87c3f15 100755 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs @@ -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()); + } + + [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()); + Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.1, 0.1, 0.18, 4)), Throws.TypeOf()); + Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.99, -0.1, 1, 1)), Throws.TypeOf()); + Assert.That(() => player.SetVideoRoi(new ScaleRectangle(0.1, 0.1, 1.1, 1)), Throws.TypeOf()); + Assert.That(() => player.SetVideoRoi(new ScaleRectangle(-3, 0.1, 1, 1)), Throws.TypeOf()); + } + + [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()); + } + #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 index 0000000..aef88c7 --- /dev/null +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSScaleRectangle.cs @@ -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(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(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(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(nameof(ScaleRectangle.ScaleHeight)); + } + } +} -- 2.7.4