From 585d656e9b0ae25aaa254ae781506b5eaaa17da6 Mon Sep 17 00:00:00 2001 From: nam Date: Tue, 19 Mar 2019 14:14:16 +0900 Subject: [PATCH] [MediaPlayer][TSACR-231] Change the TCs for buffering API Modified the range of parameter for buffering API and descriptions Change-Id: I97ab466dc1a3362d4b1fbe4d60be16d200e57fe7 --- .../Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs | 126 ++++++++++++++++++--- .../testcase/TSPlayerBufferingTime.cs | 41 ++++++- 2 files changed, 151 insertions(+), 16 deletions(-) diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs index 6b92c1c..b8d7be6 100755 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs @@ -2,6 +2,7 @@ using NUnit.Framework; using System; using System.IO; using System.Threading.Tasks; +using Tizen.System; namespace Tizen.Multimedia.Tests { @@ -14,6 +15,7 @@ namespace Tizen.Multimedia.Tests private const long Unit = 1_000_000; /* 1 Millisecond = 1,000,000 Nanoseconds */ private long ConvertMillisecondsToNanoseconds(int milliseconds) => milliseconds * Unit; private MediaUriSource _streamingSource = null; + private bool _isInternetSupported; [OneTimeSetUp] public void Init() @@ -22,6 +24,8 @@ namespace Tizen.Multimedia.Tests PreconditionUtils.SetPrecondition(); _streamingSource = new MediaUriSource(PreconditionUtils.STREAMING_URI); + + Information.TryGetValue("http://tizen.org/feature/network.internet", out _isInternetSupported); } [Test] @@ -648,7 +652,14 @@ namespace Tizen.Multimedia.Tests [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] public void BufferingTime_DEFAULT() { - Assert.That(TestPlayer.BufferingTime, Is.EqualTo(new PlayerBufferingTime(0, 0))); + try + { + Assert.That(TestPlayer.BufferingTime, Is.EqualTo(new PlayerBufferingTime(0, 0))); + } + catch (NotSupportedException) + { + Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException"); + } } [Test] @@ -660,18 +671,83 @@ namespace Tizen.Multimedia.Tests [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] public void BufferingTime_SET_GET() { - PlayerBufferingTime newValue = new PlayerBufferingTime(1000, 2000); + try + { + PlayerBufferingTime newValue = new PlayerBufferingTime(1000, 2000); - TestPlayer.BufferingTime = newValue; + TestPlayer.BufferingTime = newValue; - Assert.That(TestPlayer.BufferingTime.PreBufferMillisecond, - Is.EqualTo(newValue.PreBufferMillisecond), "Invalid value."); - Assert.That(TestPlayer.BufferingTime.ReBufferMillisecond, - Is.EqualTo(newValue.ReBufferMillisecond), "Invalid value."); + Assert.That(TestPlayer.BufferingTime.PreBufferMillisecond, + Is.EqualTo(newValue.PreBufferMillisecond), "Invalid value."); + Assert.That(TestPlayer.BufferingTime.ReBufferMillisecond, + Is.EqualTo(newValue.ReBufferMillisecond), "Invalid value."); + } + catch (NotSupportedException) + { + Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException"); + } } [Test] [Category("P1")] + [Description("BufferingTime check whether default value is correctly applied")] + [Property("SPEC", "Tizen.Multimedia.Player.BufferingTime A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PCST")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void BufferingTime_DEFAULT_SET_GET() + { + try + { + PlayerBufferingTime oldValue = new PlayerBufferingTime(2500, 2500); + PlayerBufferingTime newRebuf = new PlayerBufferingTime(reBufferMillisecond: 1000); + PlayerBufferingTime newPrebuf = new PlayerBufferingTime(preBufferMillisecond: 3000); + + TestPlayer.BufferingTime = oldValue; + Assert.That(TestPlayer.BufferingTime, Is.EqualTo(oldValue)); + + TestPlayer.BufferingTime = newRebuf; + Assert.That(TestPlayer.BufferingTime.PreBufferMillisecond, + Is.EqualTo(oldValue.PreBufferMillisecond), "Invalid value."); + Assert.That(TestPlayer.BufferingTime.ReBufferMillisecond, + Is.EqualTo(newRebuf.ReBufferMillisecond), "Invalid value."); + + TestPlayer.BufferingTime = newPrebuf; + Assert.That(TestPlayer.BufferingTime.PreBufferMillisecond, + Is.EqualTo(newPrebuf.PreBufferMillisecond), "Invalid value."); + Assert.That(TestPlayer.BufferingTime.ReBufferMillisecond, + Is.EqualTo(newRebuf.ReBufferMillisecond), "Invalid value."); + } + catch (NotSupportedException) + { + Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException"); + } +} + + [Test] + [Category("P1")] + [Description("Gets and sets the BufferingTime value to its limit. 0(min)")] + [Property("SPEC", "Tizen.Multimedia.Player.BufferingTime A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PMIN")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void BufferingTime_Progress_CHECK_MIN_VALUE() + { + try + { + PlayerBufferingTime Value = new PlayerBufferingTime(0, 0); + TestPlayer.BufferingTime = Value; + Assert.That(TestPlayer.BufferingTime, Is.EqualTo(Value)); + } + catch (NotSupportedException) + { + Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException"); + } + } + + + [Test] + [Category("P2")] [Description("BufferingTime throws exception if out of range")] [Property("SPEC", "Tizen.Multimedia.Player.BufferingTime A")] [Property("SPEC_URL", "-")] @@ -679,10 +755,17 @@ namespace Tizen.Multimedia.Tests [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] public void BufferingTime_OUT_OF_RANGE() { - Assert.That(() => TestPlayer.BufferingTime = new PlayerBufferingTime(0, -1), - Throws.TypeOf()); - Assert.That(() => TestPlayer.BufferingTime = new PlayerBufferingTime(-1, 0), + try + { + Assert.That(() => TestPlayer.BufferingTime = new PlayerBufferingTime(0, -2), Throws.TypeOf()); + Assert.That(() => TestPlayer.BufferingTime = new PlayerBufferingTime(-2, 0), + Throws.TypeOf()); + } + catch (NotSupportedException) + { + Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException"); + } } [Test] @@ -694,9 +777,16 @@ namespace Tizen.Multimedia.Tests [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] public void BufferingTime_DISPOSED() { - GetIdlePlayer().Dispose(); + try + { + GetIdlePlayer().Dispose(); - Assert.That(() => TestPlayer.BufferingTime, Throws.TypeOf()); + Assert.That(() => TestPlayer.BufferingTime, Throws.TypeOf()); + } + catch (NotSupportedException) + { + Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException"); + } } [Test] @@ -708,9 +798,15 @@ namespace Tizen.Multimedia.Tests [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] public async Task BufferingTime_THROWS_IF_STATE_NOT_VALID() { - var player = await GetPreparedPlayer(); - - Assert.That(() => player.BufferingTime = new PlayerBufferingTime(0, 0), Throws.InvalidOperationException); + try + { + var player = await GetPreparedPlayer(); + Assert.That(() => player.BufferingTime = new PlayerBufferingTime(0, 0), Throws.InvalidOperationException); + } + catch (NotSupportedException) + { + Assert.IsTrue(_isInternetSupported == false, "Invalid NotSupportedException"); + } } #endregion diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayerBufferingTime.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayerBufferingTime.cs index 1549f8a..e660778 100755 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayerBufferingTime.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayerBufferingTime.cs @@ -1,10 +1,11 @@ using NUnit.Framework; +using System; namespace Tizen.Multimedia.Tests { [TestFixture] [Description("Tizen.Multimedia.PlayerBufferingTime tests")] - public class PlayerBufferingTimeTests + public class PlayerBufferingTimeTests : TestBase { [Test] [Category("P1")] @@ -20,6 +21,44 @@ namespace Tizen.Multimedia.Tests [Test] [Category("P1")] + [Description("check default value for constructor")] + [Property("SPEC", "Tizen.Multimedia.PlayerBufferingTime.PlayerBufferingTime C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void PlayerBufferingTime_DEFAULT() + { + var pbt = new PlayerBufferingTime(-1, -1); + var pre = new PlayerBufferingTime(preBufferMillisecond:4567); + var re = new PlayerBufferingTime(reBufferMillisecond:6543); + Assert.IsInstanceOf(pbt, "Should return PlayerBufferingTime instance."); + + Assert.That(pbt.PreBufferMillisecond, Is.EqualTo(-1), "invalid PreBufferMillisecond"); + Assert.That(pbt.ReBufferMillisecond, Is.EqualTo(-1), "invalid ReBufferMillisecond"); + Assert.That(pre.PreBufferMillisecond, Is.EqualTo(4567), "invalid PreBufferMillisecond"); + Assert.That(pre.ReBufferMillisecond, Is.EqualTo(-1), "invalid ReBufferMillisecond"); + Assert.That(re.PreBufferMillisecond, Is.EqualTo(-1), "invalid PreBufferMillisecond"); + Assert.That(re.ReBufferMillisecond, Is.EqualTo(6543), "invalid ReBufferMillisecond"); + } + + [Test] + [Category("P1")] + [Description("check recommended value")] + [Property("SPEC", "Tizen.Multimedia.PlayerBufferingTime.PlayerBufferingTime C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTR")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void PlayerBufferingTime_INIT() + { + var pbt = new PlayerBufferingTime(1000, 1000); + Assert.IsInstanceOf(pbt, "Should return PlayerBufferingTime instance."); + + Assert.That(pbt.PreBufferMillisecond, Is.EqualTo(1000), "invalid PreBufferMillisecond"); + Assert.That(pbt.ReBufferMillisecond, Is.EqualTo(1000), "invalid ReBufferMillisecond"); + } + + [Test] + [Category("P1")] [Description("PreBuffMs Read/Write")] [Property("SPEC", "Tizen.Multimedia.PlayerBufferingTime.PreBufferMillisecond A")] [Property("SPEC_URL", "-")] -- 2.7.4