From 5e8a6d7ed066e7556c81526f3b4c71ab6c0fe0f4 Mon Sep 17 00:00:00 2001 From: ruble Date: Mon, 19 Aug 2019 18:11:35 +0900 Subject: [PATCH] [MediaPlayer][TCSACR-262] add TCs for AudioOffload Change-Id: I8effeab25a80caa5a9824c93133e859155e0d713 --- .../testcase/TSAudioEffect.cs | 108 +++++++++++++ .../testcase/TSAudioOffload.cs | 175 +++++++++++++++++++++ .../testcase/TSEqualizerBand.cs | 56 +++++++ .../Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs | 141 +++++++++++++++++ .../testcase/TSPlayerTrackInfo.cs | 98 ++++++++++++ .../testcase/support/Features.cs | 1 + 6 files changed, 579 insertions(+) create mode 100644 tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAudioOffload.cs diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAudioEffect.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAudioEffect.cs index 7694c66..036ffac 100755 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAudioEffect.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAudioEffect.cs @@ -8,6 +8,23 @@ namespace Tizen.Multimedia.Tests public class AudioEffectTests : TestBase { private AudioEffect _audioEffect; + private AudioOffload _audioOffload; + + private void SetAudioOffload() + { + try + { + _audioOffload = GetIdlePlayer().AudioOffload; + _audioOffload.IsEnabled = true; + } + catch (NotSupportedException) + { + if (FeatureChecker.IsSupported(Features.AudioOffload) == false) + { + Assert.Pass($"The feature({Features.AudioOffload} is not supported."); + } + } + } [SetUp] public void SetUp() @@ -100,5 +117,96 @@ namespace Tizen.Multimedia.Tests Assert.That(_audioEffect.Player, Is.Not.Null); } + [Test] + [Category("P2")] + [Description("Any attempt to access the Clear if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.AudioEffect.Clear M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void Clear_DISPOSED() + { + GetIdlePlayer().Dispose(); + Assert.That(() => _audioEffect.Clear(), Throws.TypeOf()); + } + + [Test] + [Category("P2")] + [Description("Clear throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.AudioEffect.Clear M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void Clear_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => _audioEffect.Clear(), Throws.InvalidOperationException); + } + + [Test] + [Category("P2")] + [Description("Any attempt to access the Indexer if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.AudioEffect.this[int] A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void this_DISPOSED() + { + GetIdlePlayer().Dispose(); + Assert.That(() => _audioEffect[0], Throws.TypeOf()); + } + + [Test] + [Category("P2")] + [Description("Indexer throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.AudioEffect.this[int] A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void this_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => _audioEffect[0], Throws.InvalidOperationException); + } + + [Test] + [Category("P2")] + [Description("Count throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.AudioEffect.Count A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void Count_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => _audioEffect.Count, Throws.InvalidOperationException); + } + + [Test] + [Category("P2")] + [Description("BandLevelRange throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.AudioEffect.BandLevelRange A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void BandLevelRange_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => _audioEffect.BandLevelRange, Throws.InvalidOperationException); + } + + [Test] + [Category("P2")] + [Description("IsAvailable throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.AudioEffect.IsAvailable A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void IsAvailable_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => _audioEffect.IsAvailable, Throws.InvalidOperationException); + } + } } diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAudioOffload.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAudioOffload.cs new file mode 100644 index 0000000..3060a3f --- /dev/null +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAudioOffload.cs @@ -0,0 +1,175 @@ +using NUnit.Framework; +using System.Threading.Tasks; +using System.Linq; +using System.Collections; +using System; + +namespace Tizen.Multimedia.Tests +{ + [TestFixture] + [Description("Tizen.Multimedia.AudioOffload tests")] + public class AudioOffloadTests : TestBase + { + private AudioOffload _audioOffload; + + [SetUp] + public void SetUp() + { + try + { + _audioOffload = GetIdlePlayer().AudioOffload; + _audioOffload.IsEnabled = true; + } + catch (NotSupportedException) + { + if (FeatureChecker.IsSupported(Features.AudioOffload) == false) + { + Assert.Pass($"The feature({Features.AudioOffload} is not supported."); + } + } + } + + [Test] + [Category("P1")] + [Description("check whether IsEnabled has a proper default value")] + [Property("SPEC", "Tizen.Multimedia.AudioOffload.IsEnabled A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void IsEnabled_DEFAULT() + { + using (var player = new Player()) + { + Assert.That(player.AudioOffload.IsEnabled, Is.EqualTo(false)); + } + } + + [Test] + [Category("P1")] + [Description("check whether IsEnabled is readable and writable")] + [Property("SPEC", "Tizen.Multimedia.AudioOffload.IsEnabled A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void IsEnabled_SET_GET() + { + Assert.That(_audioOffload.IsEnabled, Is.EqualTo(true)); + + const bool newValue = false; + _audioOffload.IsEnabled = newValue; + + Assert.That(_audioOffload.IsEnabled, Is.EqualTo(newValue)); + } + + [Test] + [Category("P2")] + [Description("IsEnabled throw exception if the player is not in a valid state")] + [Property("SPEC", "Tizen.Multimedia.AudioOffload.IsEnabled A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task IsEnabled_THROWS_IF_NOT_VALID_STATE() + { + TestPlayer.SetSource(Constants.AudioFileSource); + await TestPlayer.PrepareAsync(); + + Assert.That(() => _audioOffload.IsEnabled = false, Throws.InvalidOperationException); + } + + [Test] + [Category("P2")] + [Description("Any attempt to access the IsEnabled if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.AudioOffload.IsEnabled A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void IsEnabled_DISPOSED() + { + GetIdlePlayer().Dispose(); + Assert.That(() => _audioOffload.IsEnabled, Throws.TypeOf()); + } + + [Test] + [Category("P1")] + [Description("Check if IsActivated is readable")] + [Property("SPEC", "Tizen.Multimedia.AudioOffload.IsActivated A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task IsActivated_DEFAULT() + { + TestPlayer.SetSource(Constants.AudioFileSource); + await TestPlayer.PrepareAsync(); + + Assert.That(() => _audioOffload.IsActivated, Throws.Nothing); + } + + [Test] + [Category("P2")] + [Description("IsActivated throw exception if the player is not in a valid state")] + [Property("SPEC", "Tizen.Multimedia.AudioOffload.IsActivated A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void IsActivated_THROWS_IF_NOT_VALID_STATE() + { + Assert.That(() => _audioOffload.IsActivated, Throws.InvalidOperationException); + } + + [Test] + [Category("P2")] + [Description("Any attempt to access the IsActivated if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.AudioOffload.IsActivated A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void IsActivated_CHECK() + { + GetIdlePlayer().Dispose(); + Assert.That(() => _audioOffload.IsActivated, Throws.TypeOf()); + } + + [Test] + [Category("P1")] + [Description("Test SupportedFormats supported property. Supported list should be greater than 0")] + [Property("SPEC", "Tizen.Multimedia.AudioOffload.SupportedFormats A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void SupportedFormats_PROPERTY_READ_ONLY() + { + IList result = _audioOffload.SupportedFormats.ToList(); + Assert.IsNotNull(result, "The list of adaptive variants should not be null."); + Assert.IsNotEmpty(result, "The list of adaptive variants should not be empty."); + Assert.Greater(result.Count, 0, "The list of adaptive variants should be greater than 0"); + } + + [Test] + [Category("P1")] + [Description("Check if SupportedFormats is readable")] + [Property("SPEC", "Tizen.Multimedia.AudioOffload.SupportedFormats A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void SupportedFormats_CHECK() + { + Assert.That(() => _audioOffload.SupportedFormats.ToList(), + Throws.Nothing); + } + + [Test] + [Category("P2")] + [Description("Any attempt to access the SupportedFormats if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.AudioOffload.SupportedFormats A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void SupportedFormats_DISPOSED() + { + GetIdlePlayer().Dispose(); + + Assert.That(() => TestPlayer.AudioOffload.SupportedFormats.ToList(), + Throws.TypeOf()); + } + } +} \ No newline at end of file diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSEqualizerBand.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSEqualizerBand.cs index ab5c659..6da6e40 100755 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSEqualizerBand.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSEqualizerBand.cs @@ -10,6 +10,23 @@ namespace Tizen.Multimedia.Tests { private AudioEffect _audioEffect; private EqualizerBand _band; + private AudioOffload _audioOffload; + + private void SetAudioOffload() + { + try + { + _audioOffload = GetIdlePlayer().AudioOffload; + _audioOffload.IsEnabled = true; + } + catch (NotSupportedException) + { + if (FeatureChecker.IsSupported(Features.AudioOffload) == false) + { + Assert.Pass($"The feature({Features.AudioOffload} is not supported."); + } + } + } [SetUp] public void SetUp() @@ -147,5 +164,44 @@ namespace Tizen.Multimedia.Tests Assert.That(() => _band.Level, Throws.TypeOf()); } + + [Test] + [Category("P2")] + [Description("Frequency throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.EqualizerBand.Frequency A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void Frequency_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => _band.Frequency, Throws.InvalidOperationException); + } + + [Test] + [Category("P2")] + [Description("FrequencyRange throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.EqualizerBand.FrequencyRange A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void FrequencyRange_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => _band.FrequencyRange, Throws.InvalidOperationException); + } + + [Test] + [Category("P2")] + [Description("Level throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.EqualizerBand.Level A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void Level_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => _band.Level, Throws.InvalidOperationException); + } } } diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs index 53a9d2a..2661172 100755 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs @@ -18,6 +18,23 @@ namespace Tizen.Multimedia.Tests private MediaUriSource _streamingSource = null; private bool _isInternetSupported; private readonly AudioMediaFormat _audioFormat = new AudioMediaFormat(MediaFormatAudioMimeType.Pcm, 2, 48000, 16, 128); + private AudioOffload _audioOffload; + + private void SetAudioOffload() + { + try + { + _audioOffload = GetIdlePlayer().AudioOffload; + _audioOffload.IsEnabled = true; + } + catch (NotSupportedException) + { + if (FeatureChecker.IsSupported(Features.AudioOffload) == false) + { + Assert.Pass($"The feature({Features.AudioOffload} is not supported."); + } + } + } [OneTimeSetUp] public void Init() @@ -494,6 +511,18 @@ namespace Tizen.Multimedia.Tests Assert.That(() => TestPlayer.ReplayGain, Throws.TypeOf()); } + [Test] + [Category("P2")] + [Description("ReplayGain throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.Player.ReplayGain A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void ReplayGain_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => TestPlayer.ReplayGain = true, Throws.InvalidOperationException); + } #endregion #region AudioOnly @@ -576,6 +605,34 @@ namespace Tizen.Multimedia.Tests Assert.That(() => TestPlayer.AudioLatencyMode = (AudioLatencyMode)0xFF, Throws.ArgumentException); } + + [Test] + [Category("P2")] + [Description("Any attempt to access AudioLatencyMode Clear if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.Player.AudioLatencyMode M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void AudioLatencyMode_DISPOSED() + { + GetIdlePlayer().Dispose(); + Assert.That(() => TestPlayer.AudioLatencyMode = AudioLatencyMode.Low, Throws.TypeOf()); + } + + [Test] + [Category("P2")] + [Description("AudioLatencyMode throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.Player.AudioLatencyMode A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void AudioLatencyMode_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => TestPlayer.AudioLatencyMode = AudioLatencyMode.Low, Throws.InvalidOperationException); + Assert.That(() => TestPlayer.AudioLatencyMode = AudioLatencyMode.Mid, Throws.InvalidOperationException); + Assert.That(() => TestPlayer.AudioLatencyMode = AudioLatencyMode.High, Throws.InvalidOperationException); + } #endregion #region Mute @@ -1617,6 +1674,31 @@ namespace Tizen.Multimedia.Tests Assert.That(() => TestPlayer.SetPlaybackRate(0.1F), Throws.InvalidOperationException); } + [Test] + [Category("P2")] + [Description("Any attempt to access SetPlaybackRate Clear if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.Player.SetPlaybackRate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void SetPlaybackRate_DISPOSED() + { + GetIdlePlayer().Dispose(); + Assert.That(() => TestPlayer.SetPlaybackRate(0.1F), Throws.TypeOf()); + } + + [Test] + [Category("P2")] + [Description("SetPlaybackRate throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.Player.SetPlaybackRate M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void SetPlaybackRate_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => TestPlayer.SetPlaybackRate(0.1F), Throws.InvalidOperationException); + } #endregion #region SetSource @@ -2069,6 +2151,19 @@ namespace Tizen.Multimedia.Tests } [Test] + [Category("P2")] + [Description("AudioPitchEnabled throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.Player.AudioPitchEnabled A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void AudioPitchEnabled_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => TestPlayer.AudioPitchEnabled = true, Throws.InvalidOperationException); + } + + [Test] [Category("P1")] [Description("AudioPitch check default value")] [Property("SPEC", "Tizen.Multimedia.Player.AudioPitch A")] @@ -2171,6 +2266,19 @@ namespace Tizen.Multimedia.Tests GetIdlePlayer().Dispose(); Assert.That(() => TestPlayer.AudioPitch = 1.0F, Throws.TypeOf()); } + + [Test] + [Category("P2")] + [Description("AudioPitch throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.Player.AudioPitch A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void AudioPitch_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => TestPlayer.AudioPitch = 1.0F, Throws.InvalidOperationException); + } #endregion #region AudioFrameDecoded @@ -2313,6 +2421,20 @@ namespace Tizen.Multimedia.Tests } [Test] + [Category("P2")] + [Description("EnableExportingAudioData throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.Player.EnableExportingAudioData M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void EnableExportingAudioData_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + Assert.That(() => TestPlayer.EnableExportingAudioData(_audioFormat, PlayerAudioExtractOption.NoSyncAndDeinterleave), + Throws.InvalidOperationException); + } + + [Test] [Category("P1")] [Description("Check DisableExportingAudioData does not throw exceptions")] [Property("SPEC", "Tizen.Multimedia.Player.DisableExportingAudioData M")] @@ -2358,5 +2480,24 @@ namespace Tizen.Multimedia.Tests Assert.That(() => TestPlayer.DisableExportingAudioData(), Throws.TypeOf()); } #endregion + + [Test] + [Category("P1")] + [Description("AudioOffload check default value")] + [Property("SPEC", "Tizen.Multimedia.Player.AudioOffload A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PDV")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void AudioOffload_DEFAULT() + { + try + { + Assert.That(TestPlayer.AudioOffload, Is.Not.Null); + } + catch (NotSupportedException) + { + Assert.False(FeatureChecker.IsSupported(Features.AudioOffload), "NotSupportedException shouldn't be thrown."); + } + } } } diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayerTrackInfo.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayerTrackInfo.cs index 6cc1c2a..c3855f9 100755 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayerTrackInfo.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayerTrackInfo.cs @@ -8,6 +8,23 @@ namespace Tizen.Multimedia.Tests [Description("Tizen.Multimedia.PlayerTrackInfo Tests")] public class PlayerTrackInfoTests : TestBase { + private AudioOffload _audioOffload; + + private void SetAudioOffload() + { + try + { + _audioOffload = GetIdlePlayer().AudioOffload; + _audioOffload.IsEnabled = true; + } + catch (NotSupportedException) + { + if (FeatureChecker.IsSupported(Features.AudioOffload) == false) + { + Assert.Pass($"The feature({Features.AudioOffload} is not supported."); + } + } + } private async Task GetAudioTrackInfo() { var player = await GetPlayingPlayer(Constants.AudioFileSource); @@ -145,5 +162,86 @@ namespace Tizen.Multimedia.Tests Assert.That(() => audioTrackInfo.Selected = audioTrackInfo.GetCount(), Throws.TypeOf()); } + + [Test] + [Category("P2")] + [Description("Any attempt to access the GetCount if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.PlayerTrackInfo.GetCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void GetCount_DISPOSED() + { + GetIdlePlayer().Dispose(); + Assert.That(() => TestPlayer.AudioTrackInfo.GetCount(), Throws.TypeOf()); + } + + [Test] + [Category("P2")] + [Description("Any attempt to access the GetLanguageCode if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.PlayerTrackInfo.GetLanguageCode M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void GetLanguageCode_DISPOSED() + { + GetIdlePlayer().Dispose(); + Assert.That(() => TestPlayer.AudioTrackInfo.GetLanguageCode(0), Throws.TypeOf()); + } + + [Test] + [Category("P2")] + [Description("Any attempt to access the Selected if the player has been disposed of")] + [Property("SPEC", "Tizen.Multimedia.PlayerTrackInfo.Selected M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public void Selected_DISPOSED() + { + GetIdlePlayer().Dispose(); + Assert.That(() => TestPlayer.AudioTrackInfo.Selected, Throws.TypeOf()); + } + + [Test] + [Category("P2")] + [Description("GetCount throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.PlayerTrackInfo.GetCount M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task GetCount_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + var audioTrackInfo = await GetAudioTrackInfo(); + Assert.That(() => audioTrackInfo.GetCount(), Throws.InvalidOperationException); + } + + [Test] + [Category("P2")] + [Description("GetLanguageCode throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.PlayerTrackInfo.GetLanguageCode M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task GetLanguageCode_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + var audioTrackInfo = await GetAudioTrackInfo(); + Assert.That(() => audioTrackInfo.GetLanguageCode(0), Throws.InvalidOperationException); + } + + [Test] + [Category("P2")] + [Description("Selected throws exception if an audio offload is enabled")] + [Property("SPEC", "Tizen.Multimedia.PlayerTrackInfo.Selected A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Jeongyoon Nam, just.nam@samsung.com")] + public async Task Selected_THROWS_IF_AUDIOOFFLOAD_ENABLED() + { + SetAudioOffload(); + var audioTrackInfo = await GetAudioTrackInfo(); + Assert.That(() => audioTrackInfo.Selected, Throws.InvalidOperationException); + } } } diff --git a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/support/Features.cs b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/support/Features.cs index 3bb47de..95b9c54 100755 --- a/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/support/Features.cs +++ b/tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/support/Features.cs @@ -5,4 +5,5 @@ internal static class Features internal const string StreamInfo = "http://tizen.org/feature/multimedia.player.stream_info"; internal const string OpenGl = "http://tizen.org/feature/opengles.version.2_0"; internal const string SphericalVideo = "http://tizen.org/feature/multimedia.player.spherical_video"; + internal const string AudioOffload = "http://tizen.org/feature/multimedia.player.audio_offload"; } -- 2.7.4