From 06be8f38786df1ee3f1de18f6a1ff91db4a89427 Mon Sep 17 00:00:00 2001 From: nam Date: Wed, 25 Jul 2018 16:34:21 +0900 Subject: [PATCH] [MediaPlayer][ACR-164] add TCs related with setting/getting playback in nanoseconds Change-Id: I51243edbbf1ee01c4de67fd09867a36dade1350d --- .../Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs | 157 ++++++++++++++++++++- .../testcase/TSStreamInfo.Audio.cs | 43 ++++++ 2 files changed, 195 insertions(+), 5 deletions(-) diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs index 067f2db..eed0be6 100755 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs @@ -806,7 +806,7 @@ namespace Tizen.Multimedia.Tests [Test] [Category("P2")] - [Description("SetPlayPositionAsync throws if the player is in the idle state")] + [Description("SetPlayPositionAsync throws exception if the player is in the idle state")] [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionAsync M")] [Property("SPEC_URL", "-")] [Property("CRITERIA", "MEX")] @@ -820,10 +820,10 @@ namespace Tizen.Multimedia.Tests [Test] [Category("P2")] - [Description("SetPlayPositionAsync throws if the specified position is invalid")] + [Description("SetPlayPositionAsync throws exception if the specified position is invalid")] [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionAsync M")] [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MEX")] + [Property("CRITERIA", "MAR")] [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] public async Task SetPlayPositionAsync_GREATER_THAN_LIMIT() { @@ -836,10 +836,10 @@ namespace Tizen.Multimedia.Tests [Test] [Category("P2")] - [Description("SetPlayPositionAsync throws if the specified position is invalid")] + [Description("SetPlayPositionAsync throws exception if the specified position is invalid")] [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionAsync M")] [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MEX")] + [Property("CRITERIA", "MAR")] [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] public async Task SetPlayPositionAsync_LESS_THAN_ZERO() { @@ -850,6 +850,153 @@ namespace Tizen.Multimedia.Tests Assert.That(() => task, Throws.TypeOf()); } + [Test] + [Category("P1")] + [Description("GetPlayPosition test")] + [Property("SPEC", "Tizen.Multimedia.Player.GetPlayPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task GetPlayPositionNanoseconds_CHECK() + { + var player = await GetPreparedPlayer(); + + Assert.That(player.GetPlayPositionNanoseconds(), Is.Zero); + + await player.SetPlayPositionNanosecondsAsync(5000, true); + + Assert.That(player.GetPlayPositionNanoseconds(), Is.EqualTo(5000)); + + await player.SetPlayPositionNanosecondsAsync(15000, true); + + Assert.That(player.GetPlayPositionNanoseconds(), Is.EqualTo(15000)); + } + + [Test] + [Category("P1")] + [Description("Any attempt to access the GetPlayPositionNanoseconds if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.Player.GetPlayPositionNanoseconds M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void GetPlayPositionNanoseconds_DISPOSED() + { + GetIdlePlayer().Dispose(); + + Assert.That(() => TestPlayer.GetPlayPositionNanoseconds(), + Throws.TypeOf()); + } + + [Test] + [Category("P2")] + [Description("GetPlayPositionNanoseconds throws exception if the player is in the idle state")] + [Property("SPEC", "Tizen.Multimedia.Player.GetPlayPositionNanoseconds M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void GetPlayPositionNanoseconds_THROWS_IN_IDLE_STATE() + { + Assert.That(() => TestPlayer.GetPlayPositionNanoseconds(), Throws.InvalidOperationException); + } + + [Test] + [Category("P1")] + [Description("SetPlayPositionNanosecondsAsync without accuracy")] + [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task SetPlayPositionNanosecondsAsync_INACCURATE() + { + var player = await GetPreparedPlayer(); + + const int targetPos = 700000; + + await player.SetPlayPositionNanosecondsAsync(targetPos, false); + + Assert.That(Math.Abs(targetPos - player.GetPlayPositionNanoseconds()), Is.LessThan(100000), + "The difference is too big."); + } + + [Test] + [Category("P1")] + [Description("SetPlayPositionNanosecondsAsync with accuracy")] + [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MCST")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task SetPlayPositionNanosecondsAsync_ACCURATE() + { + var player = await GetPreparedPlayer(); + + const int targetPos = 700000; + + await player.SetPlayPositionNanosecondsAsync(targetPos, true); + + Assert.That(player.GetPlayPositionNanoseconds(), Is.EqualTo(targetPos)); + } + + [Test] + [Category("P1")] + [Description("Any attempt to access the SetPlayPositionNanosecondsAsync if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void SetPlayPositionNanosecondsAsync_DISPOSED() + { + GetIdlePlayer().Dispose(); + + Assert.That(() => TestPlayer.SetPlayPositionNanosecondsAsync(15, false), + Throws.TypeOf()); + } + + [Test] + [Category("P2")] + [Description("SetPlayPositionNanosecondsAsync throws exception if the player is in the idle state")] + [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task SetPlayPositionNanosecondsAsync_THROWS_IN_IDLE_STATE() + { + var task = await AsyncWrapper.Wrap(() => TestPlayer.SetPlayPositionNanosecondsAsync(0, true)); + + Assert.That(() => task, Throws.InvalidOperationException); + } + + [Test] + [Category("P2")] + [Description("SetPlayPositionNanosecondsAsync throws exception if the specified position is invalid")] + [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MAR")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task SetPlayPositionNanosecondsAsync_GREATER_THAN_LIMIT() + { + var player = await GetPreparedPlayer(); + + var task = await AsyncWrapper.Wrap(() => player.SetPlayPositionNanosecondsAsync(40000000000, false)); + + Assert.That(() => task, Throws.TypeOf()); + } + + [Test] + [Category("P2")] + [Description("SetPlayPositionNanosecondsAsync throws exception if the specified position is invalid")] + [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionNanosecondsAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MAR")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task SetPlayPositionNanosecondsAsync_LESS_THAN_ZERO() + { + var player = await GetPreparedPlayer(); + + var task = await AsyncWrapper.Wrap(() => player.SetPlayPositionNanosecondsAsync(-1, false)); + + Assert.That(() => task, Throws.TypeOf()); + } + #endregion #region Subtitle diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSStreamInfo.Audio.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSStreamInfo.Audio.cs index 9975a99..d8d5897 100755 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSStreamInfo.Audio.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSStreamInfo.Audio.cs @@ -12,6 +12,7 @@ namespace Tizen.Multimedia.Tests { public const string Codec = "MPEG-1 Layer 3 (MP3)"; public const int Duration = 33380; + public const long DurationNanoseconds = 33380000000; public const int SampleRate = 22050; public const int Channels = 2; public const int BitRate = 128012; @@ -69,6 +70,48 @@ namespace Tizen.Multimedia.Tests [Test] [Category("P1")] + [Description("Duration returns the length of the media")] + [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetDurationNanoseconds M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task GetDurationNanoseconds_CHECK_RETURN() + { + var streamInfo = await GetAudioStreamInfo(); + + Assert.That(Math.Abs(ExpectedValues.DurationNanoseconds - streamInfo.GetDurationNanoseconds()), + Is.LessThan(10000000)); + } + + [Test] + [Category("P1")] + [Description("Any attempt to access the GetDurationNanoseconds if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetDurationNanoseconds M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void GetDurationNanoseconds_DISPOSED() + { + GetIdlePlayer().Dispose(); + + Assert.That(() => TestPlayer.StreamInfo.GetDurationNanoseconds(), + Throws.TypeOf()); + } + + [Test] + [Category("P2")] + [Description("GetDurationNanoseconds throws exception if the player is in the idle state")] + [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetDurationNanoseconds M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void GetDurationNanoseconds_THROWS_IN_IDLE_STATE() + { + Assert.That(() => TestPlayer.StreamInfo.GetDurationNanoseconds(), Throws.InvalidOperationException); + } + + [Test] + [Category("P1")] [Description("AudioStreamProperties returns audio stream info")] [Property("SPEC", "Tizen.Multimedia.StreamInfo.GetAudioProperties M")] [Property("SPEC_URL", "-")] -- 2.7.4