From: Haesu Gwon Date: Fri, 21 Aug 2020 06:36:25 +0000 (+0900) Subject: [Recorder][Non-ACR] Add negative TCs X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=60be605125a434f6254db219278c4421d7e6255f;p=test%2Ftct%2Fcsharp%2Fapi.git [Recorder][Non-ACR] Add negative TCs Change-Id: I35849f25f652f2625dde596cf32fa62b48056867 --- diff --git a/tct-suite-vs/Tizen.Recorder.Tests/testcase/TSAudioRecorder.Constructor.cs b/tct-suite-vs/Tizen.Recorder.Tests/testcase/TSAudioRecorder.Constructor.cs old mode 100755 new mode 100644 index 7f0c5c1dd..cc66a370f --- a/tct-suite-vs/Tizen.Recorder.Tests/testcase/TSAudioRecorder.Constructor.cs +++ b/tct-suite-vs/Tizen.Recorder.Tests/testcase/TSAudioRecorder.Constructor.cs @@ -53,7 +53,20 @@ namespace Tizen.Multimedia.Tests [Property("SPEC_URL", "-")] [Property("CRITERIA", "CONSTX")] [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] - public void AudioRecorder_WITH_INVALID_CODEC() + public void AudioRecorder_WITH_INVALID_CODEC_UPPER() + { + Assert.That(() => new AudioRecorder((RecorderAudioCodec)100, RecorderFileFormat.Mp4), + Throws.ArgumentException); + } + + [Test] + [Category("P2")] + [Description("Throws if the codec is invalid")] + [Property("SPEC", "Tizen.Multimedia.AudioRecorder.AudioRecorder C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")] + public void AudioRecorder_WITH_INVALID_CODEC_LOWER() { Assert.That(() => new AudioRecorder((RecorderAudioCodec)(-2), RecorderFileFormat.Mp4), Throws.ArgumentException); @@ -71,5 +84,18 @@ namespace Tizen.Multimedia.Tests Assert.That(() => new AudioRecorder(RecorderAudioCodec.Amr, (RecorderFileFormat)(-1)), Throws.ArgumentException); } + + [Test] + [Category("P2")] + [Description("Throws if the codec is out of range")] + [Property("SPEC", "Tizen.Multimedia.AudioRecorder.AudioRecorder C")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "CONSTX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void AudioRecorder_WITH_OUT_OF_RANGE() + { + Assert.Throws(() => + new AudioRecorder(RecorderAudioCodec.None, RecorderFileFormat.Mp4)); + } } } diff --git a/tct-suite-vs/Tizen.Recorder.Tests/testcase/TSRecorder.cs b/tct-suite-vs/Tizen.Recorder.Tests/testcase/TSRecorder.cs index c84e0a83f..146be25ee 100644 --- a/tct-suite-vs/Tizen.Recorder.Tests/testcase/TSRecorder.cs +++ b/tct-suite-vs/Tizen.Recorder.Tests/testcase/TSRecorder.cs @@ -53,6 +53,21 @@ namespace Tizen.Multimedia.Tests Assert.AreEqual(RecorderState.Paused, AudioRecorder.State, "Recorder should be in paused state"); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed.")] + [Property("SPEC", "Tizen.Multimedia.Recorder.State A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void State_THROWS_IF_DISPOSED() + { + AudioRecorder.Dispose(); + + Assert.That(() => AudioRecorder.State, Throws.TypeOf(), + "Should throws proper exception"); + } + [Test] [Category("P2")] [Description("Test AudioChannels property for below minimum value.")] @@ -65,6 +80,21 @@ namespace Tizen.Multimedia.Tests Assert.That(() => AudioRecorder.AudioChannels = 0, Throws.TypeOf()); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed.")] + [Property("SPEC", " Tizen.Multimedia.Recorder.AudioChannels A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void AudioChannels_THROWS_IF_DISPOSED() + { + AudioRecorder.Dispose(); + + Assert.That(() => AudioRecorder.AudioChannels = 2, Throws.TypeOf(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test AudioChannels property for Read/Write")] @@ -76,7 +106,8 @@ namespace Tizen.Multimedia.Tests { /* Test code */ AudioRecorder.AudioChannels = 2; - Assert.That(AudioRecorder.AudioChannels, Is.EqualTo(2), "Audio channel value is not same as set value"); + Assert.That(AudioRecorder.AudioChannels, Is.EqualTo(2), + "Audio channel value is not same as set value"); } [Test] @@ -98,7 +129,8 @@ namespace Tizen.Multimedia.Tests } catch (NotSupportedException) { - Assert.That(FeatureChecker.IsSupported(Features.AudioRecorder), Is.False, "Invalid NotSupportedException"); + Assert.That(FeatureChecker.IsSupported(Features.AudioRecorder), Is.False, + "Invalid NotSupportedException"); } try @@ -124,6 +156,22 @@ namespace Tizen.Multimedia.Tests Assert.That(() => AudioRecorder.AudioDevice = (RecorderAudioDevice)(-1), Throws.ArgumentException); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", " Tizen.Multimedia.Recorder.AudioDevice A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void AudioDevice_THROWS_DISPOSED() + { + AudioRecorder.Dispose(); + + Assert.That(() => AudioRecorder.AudioDevice = RecorderAudioDevice.Modem, + Throws.TypeOf(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Read/Write for AudioSampleRate property")] @@ -149,6 +197,21 @@ namespace Tizen.Multimedia.Tests Assert.That(() => AudioRecorder.AudioSampleRate = -1, Throws.TypeOf()); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", " Tizen.Multimedia.Recorder.AudioSampleRate A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void AudioSampleRate_THROWS_IF_DISPOSED() + { + AudioRecorder.Dispose(); + + Assert.That(() => AudioRecorder.AudioSampleRate = 44100, Throws.TypeOf(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Recorder Audio bitrate property for Read/Write")] @@ -174,6 +237,21 @@ namespace Tizen.Multimedia.Tests Assert.That(() => AudioRecorder.AudioBitRate = -1, Throws.TypeOf()); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", " Tizen.Multimedia.Recorder.AudioBitRate A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void AudioBitRate_THROWS_IF_DISPOSED() + { + AudioRecorder.Dispose(); + + Assert.That(() => AudioRecorder.AudioBitRate = 28800, Throws.TypeOf(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Audiocodec property for all enum values.")] @@ -260,6 +338,21 @@ namespace Tizen.Multimedia.Tests Assert.That(() => AudioRecorder.SizeLimit = -1, Throws.TypeOf()); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", " Tizen.Multimedia.Recorder.SizeLimit A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void SizeLimit_THROWS_IF_DISPOSED() + { + AudioRecorder.Dispose(); + + Assert.That(() => AudioRecorder.SizeLimit = 1024, Throws.TypeOf(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test default value of Recorder Time Limit property")] @@ -299,6 +392,21 @@ namespace Tizen.Multimedia.Tests Assert.That(() => AudioRecorder.TimeLimit = -1, Throws.TypeOf()); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", " Tizen.Multimedia.Recorder.TimeLimit A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void TimeLimit_THROWS_IF_DISPOSED() + { + AudioRecorder.Dispose(); + + Assert.That(() => AudioRecorder.TimeLimit = 2, Throws.TypeOf(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Recorder Muted property for Read/Write")] @@ -321,6 +429,21 @@ namespace Tizen.Multimedia.Tests Assert.IsTrue(AudioRecorder.Muted, "Mute value is not same as set value"); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", " Tizen.Multimedia.Recorder.Muted A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void Muted_THROWS_IF_DISPOSED() + { + AudioRecorder.Dispose(); + + Assert.That(() => AudioRecorder.Muted = false, Throws.TypeOf(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Recorder Prepare method")] @@ -337,6 +460,21 @@ namespace Tizen.Multimedia.Tests Assert.AreEqual(RecorderState.Ready, AudioRecorder.State, "Recorder should be in ready state"); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", "Tizen.Multimedia.Recorder.Prepare M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void Prepare_THROWS_IF_DISPOSED() + { + AudioRecorder.Dispose(); + + Assert.Throws(() => AudioRecorder.Prepare(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Recorder Start method")] @@ -354,6 +492,23 @@ namespace Tizen.Multimedia.Tests Assert.AreEqual(RecorderState.Recording, AudioRecorder.State, "Recorder should be in recording state"); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", "Tizen.Multimedia.Recorder.Start M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void Start_THROWS_IF_DISPOSED() + { + AudioRecorder.Prepare(); + + AudioRecorder.Dispose(); + + Assert.Throws(() => AudioRecorder.Start(SavePath), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Recorder Pause method")] @@ -383,6 +538,34 @@ namespace Tizen.Multimedia.Tests Assert.AreEqual(RecorderState.Paused, AudioRecorder.State, "Recorder should be in paused state"); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", "Tizen.Multimedia.Recorder.Pause M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public async Task Pause_THROWS_IF_DISPOSED() + { + AudioRecorder.Prepare(); + + using (var eventWaiter = EventAwaiter.Create()) + { + AudioRecorder.AudioStreamStoring += eventWaiter; + + AudioRecorder.Start(SavePath); + + await eventWaiter.IsRaisedAsync(); + + AudioRecorder.AudioStreamStoring -= eventWaiter; + } + + AudioRecorder.Dispose(); + + Assert.Throws(() => AudioRecorder.Pause(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Recorder Resume method")] @@ -413,6 +596,36 @@ namespace Tizen.Multimedia.Tests Assert.AreEqual(RecorderState.Recording, AudioRecorder.State, "Recorder should be in recording state"); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", "Tizen.Multimedia.Recorder.Resume M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public async Task Resume_THROWS_IF_DISPOSED() + { + AudioRecorder.Prepare(); + + using (var eventWaiter = EventAwaiter.Create()) + { + AudioRecorder.AudioStreamStoring += eventWaiter; + + AudioRecorder.Start(SavePath); + + await eventWaiter.IsRaisedAsync(); + + AudioRecorder.AudioStreamStoring -= eventWaiter; + } + + AudioRecorder.Pause(); + + AudioRecorder.Dispose(); + + Assert.Throws(() => AudioRecorder.Resume(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Recorder Commit method")] @@ -443,6 +656,34 @@ namespace Tizen.Multimedia.Tests Assert.IsTrue(File.Exists(SavePath), "Recorded file does not exist"); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", "Tizen.Multimedia.Recorder.Commit M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public async Task Commit_THROWS_IF_DISPOSED() + { + AudioRecorder.Prepare(); + + using (var eventWaiter = EventAwaiter.Create()) + { + AudioRecorder.AudioStreamStoring += eventWaiter; + + AudioRecorder.Start(SavePath); + + await eventWaiter.IsRaisedAsync(); + + AudioRecorder.AudioStreamStoring -= eventWaiter; + } + + AudioRecorder.Dispose(); + + Assert.Throws(() => AudioRecorder.Commit(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test whether invoking Cancel method transfers state to ready state, and does not save file")] @@ -464,6 +705,25 @@ namespace Tizen.Multimedia.Tests Assert.IsFalse(File.Exists(SavePath), "Recording File should not exist"); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", "Tizen.Multimedia.Recorder.Cancel M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void Cancel_THROWS_IF_DISPOSED() + { + File.Delete(SavePath); + AudioRecorder.Prepare(); + AudioRecorder.Start(SavePath); + + AudioRecorder.Dispose(); + + Assert.Throws(() => AudioRecorder.Cancel(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Recorder Unprepare method")] @@ -495,6 +755,36 @@ namespace Tizen.Multimedia.Tests Assert.AreEqual(RecorderState.Idle, AudioRecorder.State, "Recorder should be in created state"); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", "Tizen.Multimedia.Recorder.Unprepare M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public async Task Unprepare_THROWS_IF_DISPOSED() + { + AudioRecorder.Prepare(); + + using (var eventWaiter = EventAwaiter.Create()) + { + AudioRecorder.AudioStreamStoring += eventWaiter; + + AudioRecorder.Start(SavePath); + + await eventWaiter.IsRaisedAsync(); + + AudioRecorder.AudioStreamStoring -= eventWaiter; + } + + AudioRecorder.Commit(); + + AudioRecorder.Dispose(); + + Assert.Throws(() => AudioRecorder.Unprepare(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Recorder GetPeakAudioLevel method")] @@ -524,6 +814,34 @@ namespace Tizen.Multimedia.Tests Assert.IsNotNull(level, "audiolevel should not be null"); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", "Tizen.Multimedia.Recorder.GetPeakAudioLevel M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public async Task GetPeakAudioLevel_THROWS_IF_DISPOSED() + { + AudioRecorder.Prepare(); + + using (var eventWaiter = EventAwaiter.Create()) + { + AudioRecorder.AudioStreamStoring += eventWaiter; + + AudioRecorder.Start(SavePath); + + await eventWaiter.IsRaisedAsync(); + + AudioRecorder.AudioStreamStoring -= eventWaiter; + } + + AudioRecorder.Dispose(); + + Assert.Throws(() => AudioRecorder.GetPeakAudioLevel(), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test Recorder GetDeviceState method for all the states.")] @@ -607,6 +925,22 @@ namespace Tizen.Multimedia.Tests Assert.That(() => AudioRecorder.ApplyAudioStreamPolicy(null), Throws.ArgumentNullException); } + [Test] + [Category("P2")] + [Description("Throws if recorder is already disposed")] + [Property("SPEC", "Tizen.Multimedia.Recorder.ApplyAudioStreamPolicy M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MEX")] + [Property("AUTHOR", "Haesu Gwon, haesu.gwon@samsung.com")] + public void ApplyAudioStreamPolicy_THROWS_IF_DISPOSED() + { + AudioRecorder.Dispose(); + + Assert.Throws(() => + AudioRecorder.ApplyAudioStreamPolicy(new AudioStreamPolicy(AudioStreamType.Media)), + "Should throws proper exception"); + } + [Test] [Category("P1")] [Description("Test GetSupportedFileFormats method.")]