+++ /dev/null
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using TestFramework;
-using Tizen;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.AudioDevice class")]
- public static class AudioDeviceTests
- {
- public const string LogTag = "TizenTest.Multimedia.AudioDevice";
- private static AudioDevice _device;
- private static IEnumerable<AudioDevice> _deviceList;
-
- [SetUp]
- public static void Init()
- {
- _deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.All);
- _device = _deviceList.ElementAt(0);
- Log.Info(LogTag, "AudioDevice Test Init");
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "AudioDevice Test Destroy");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioDevice Id")]
- [Property("SPEC", "Tizen.Multimedia.AudioDevice.Id A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void Id_PROPERTY_READ_ONLY()
- {
-
- Log.Info(LogTag, "AudioDevice Test Id starting");
- object ret = _device.Id;
-
- /* TEST CODE
- * Test ID property of AudioDevice
- */
- Assert.IsNotNull(ret, "Id value returned is null");
- Assert.True((ret is int), "Id value returned is not of type int");
- Log.Info(LogTag, "AudioDevice Test Id finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioDevice Name")]
- [Property("SPEC", "Tizen.Multimedia.AudioDevice.Name A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void Name_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "AudioDevice Test Name starting");
- object ret = _device.Name;
-
- /* TEST CODE
- * Test Name property of AudioDevice
- */
- Assert.IsNotNull(ret, "Name value returned is null");
- Assert.True((ret is string), "Name value returned is not of type string");
- Log.Info(LogTag, "AudioDevice Test Name finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioDevice Type")]
- [Property("SPEC", "Tizen.Multimedia.AudioDevice.Type A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void Type_GET_ENUM_ALL()
- {
- Log.Info(LogTag, "AudioDevice Test Type starting");
- object ret = _device.Type;
-
- /* TEST CODE
- * Test Builtin Speaker type for AudioDevice.
- */
- Assert.True((ret is AudioDeviceType), "Type value returned is not of type AudioDeviceType");
- Assert.AreEqual(AudioDeviceType.BuiltinSpeaker, _device.Type, "Type should be of builtin speaker");
- Log.Info(LogTag, "AudioDevice Test Type finished");
-
- /* TEST CODE
- * Test Builtin Receiver type for AudioDevice.
- */
- _device = _deviceList.ElementAt(1);
- Assert.True((ret is AudioDeviceType), "Type value returned is not of type AudioDeviceType");
- Assert.AreEqual(AudioDeviceType.BuiltinReceiver, _device.Type, "Type should be of builtin receiver");
- Log.Info(LogTag, "AudioDevice Test Type finished");
-
- /* TEST CODE
- * Test Builtin Mic type for AudioDevice.
- */
- _device = _deviceList.ElementAt(2);
- Assert.True((ret is AudioDeviceType), "Type value returned is not of type AudioDeviceType");
- Assert.AreEqual(AudioDeviceType.BuiltinMic, _device.Type, "Type should be of builtin mic");
- Log.Info(LogTag, "AudioDevice Test Type finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioDevice IoDirection")]
- [Property("SPEC", "Tizen.Multimedia.AudioDevice.IoDirection A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void IoDirection_GET_ENUM_ALL()
- {
- Log.Info(LogTag, "AudioDevice Test IoDirection starting");
- object ret = _device.IoDirection;
-
- /* TEST CODE
- * Test IO Direction property of AudioDevice
- */
- Assert.IsNotNull(ret, "IoDirection value returned is null");
- Assert.True((ret is AudioDeviceIoDirection), "IoDirection value returned is not of type AudioDeviceIoDirection");
- Assert.AreEqual(AudioDeviceIoDirection.Output, _device.IoDirection, "The IODirection of speaker should be of output type");
- Log.Info(LogTag, "AudioDevice Test IoDirection finished");
-
- /* TEST CODE
- * Test IO Direction property of AudioDevice
- */
- _device = _deviceList.ElementAt(2);
- Assert.IsNotNull(ret, "IoDirection value returned is null");
- Assert.True((ret is AudioDeviceIoDirection), "IoDirection value returned is not of type AudioDeviceIoDirection");
- Assert.AreEqual(AudioDeviceIoDirection.Input, _device.IoDirection, "The IODirection of mic should be of input type");
- Log.Info(LogTag, "AudioDevice Test IoDirection finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioDevice State")]
- [Property("SPEC", "Tizen.Multimedia.AudioDevice.State A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void State_GET_ENUM_DEACTIVATED_STATE()
- {
- Log.Info(LogTag, "AudioDevice Test State starting");
- object ret = _device.State;
-
- /* TEST CODE
- * Test Deactivated State property of AudioDevice
- */
- Assert.IsNotNull(ret, "State value returned is null");
- Assert.True((ret is AudioDeviceState), "State value returned is not of type AudioDeviceState");
- Assert.AreEqual(AudioDeviceState.Deactivated, _device.State, "Device should be in deactivated state");
- Log.Info(LogTag, "AudioDevice Test State finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioDevice State")]
- [Property("SPEC", "Tizen.Multimedia.AudioDevice.State A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Vivek Ellur, vivek.ellur@samsung.com")]
- public static void State_GET_ENUM_ACTIVATED_STATE()
- {
- Recorder recorder = new Tizen.Multimedia.Recorder();
- recorder.AudioCodec = RecorderAudioCodec.Aac;
- recorder.FileFormat = RecorderFileFormat.ThreeGp;
- recorder.TimeLimit = 5;
- recorder.FilePath = "/opt/usr/home/owner/share/res/audiosample.3gp";
-
- recorder.Prepare();
- recorder.Start();
- Log.Info(LogTag, "AudioDevice Test State starting");
-
- /* TEST CODE
- * Test Activated State property of AudioDevice
- */
- _deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.All);
- _device = _deviceList.ElementAt(2);
- AudioDeviceState state = _device.State;
-
- Assert.AreEqual(AudioDeviceState.Activated, _device.State, "Device should be in activated state");
- Log.Info(LogTag, "****** AudioDevice Test State finished ");
- recorder.Commit();
- recorder.Unprepare();
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.AudioEffect Tests")]
- public static class AudioEffectTests
- {
- static private int[] FrequencyList = { 36, 98, 265, 711, 1907, 5117, 13727 };
- static private int[] RangeList = { 33, 90, 242, 649, 1743, 4676, 12544 };
- static private Player TestPlayer;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AudioEffect availability")]
- [Property("SPEC", "Tizen.Multimedia.AudioEffect.Available A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Available_PROPERTY_READ_ONLY()
- {
- /*
- * TEST:
- * Check if AudioEffect is available
- */
- Assert.True(TestPlayer.AudioEffect.Available, "Equalizer not available");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AudioEffect MaxLevel")]
- [Property("SPEC", "Tizen.Multimedia.AudioEffect.MaxLevel A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void MaxLevel_PROPERTY_READ_ONLY()
- {
- /*
- * TEST:
- * Check AudioEffect MaxLevel
- */
- Assert.AreEqual(TestPlayer.AudioEffect.MaxLevel, 12, "Equalizer MaxLevel has incorrect value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AudioEffect MinLevel")]
- [Property("SPEC", "Tizen.Multimedia.AudioEffect.MinLevel A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void MinLevel_PROPERTY_READ_ONLY()
- {
- /*
- * TEST:
- * Check AudioEffect MinLevel
- */
- Assert.AreEqual(TestPlayer.AudioEffect.MinLevel, -12, "Equalizer MinLevel has incorrect value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AudioEffect EqualizerBands")]
- [Property("SPEC", "Tizen.Multimedia.AudioEffect.EqualizerBands A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void EqualizerBands_READ_WRITE()
- {
- int counter = 0;
- List<EqualizerBand> bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
-
- Assert.AreEqual(bands.Count, 7, "Incorrect bands");
-
-
- // TEST: Read equalizer bands
- foreach(EqualizerBand b in bands)
- {
- Assert.AreEqual(b.Level, 0, "Incorrect level");
- // TEST: write level (Level is READ_WRITE. Frequency and Range are not.)
- b.Level = 5;
- Assert.AreEqual(b.Frequency, FrequencyList[counter], "Incorrect frequency");
- Assert.AreEqual(b.Range, RangeList[counter++], "Incorrect Range");
- }
-
- TestPlayer.AudioEffect.EqualizerBands = bands;
- bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
-
- // TEST: read updated level
- foreach(EqualizerBand b in bands)
- {
- Assert.AreEqual(b.Level, 5, "Incorrect level");
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using TestFramework;
-using Tizen;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.AudioInput class")]
- public static class AudioInputTests
- {
- public const string LogTag = "TizenTest.Multimedia.AudioInput";
- private static int MAX_SIZE = 131072;
-
- [SetUp]
- public static void Init()
- {
- Log.Info(LogTag, "AudioInput Test Init");
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "AudioInput Test Destroy");
- }
-
- [Test]
- [Category("P1")]
- [Description("Create AudioInput object with Mono and U8 value and verify")]
- [Property("SPEC", "Tizen.Multimedia.AudioInput.AudioInput C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void AudioInput_CREATE_MONO_U8()
- {
- Log.Info(LogTag, "AudioInput Test Create(mono, u8) started");
-
- /* TEST CODE
- * Create handle.
- */
- AudioInput _in = new AudioInput(44100, AudioChannel.Mono, AudioSampleType.U8);
- Assert.IsNotNull(_in, "AudioInput object should not be null after construction");
- Assert.IsInstanceOf<AudioInput>(_in, "The object should be of AudioInput");
-
- Log.Info(LogTag, "AudioInput Test Create(mono, u8) finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Create AudioInput object with Mono and Sl6Le value and verify")]
- [Property("SPEC", "Tizen.Multimedia.AudioInput.AudioInput C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void AudioInput_CREATE_MONO_S16Le()
- {
- Log.Info(LogTag, "AudioInput Test Create(mono, S16Le) started");
-
- /* TEST CODE
- * Create handle.
- */
- AudioInput _in = new AudioInput(44100, AudioChannel.Mono, AudioSampleType.S16Le);
- Assert.IsNotNull(_in, "AudioInput object should not be null after construction");
- Assert.IsInstanceOf<AudioInput>(_in, "The object should be of AudioInput");
-
- Log.Info(LogTag, "AudioInput Test Create(mono, S16Le) finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Create AudioInput object with Stereo and U8 value and verify")]
- [Property("SPEC", "Tizen.Multimedia.AudioInput.AudioInput C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void AudioInput_CREATE_STEREO_U8()
- {
- Log.Info(LogTag, "AudioInput Test Create(stereo, u8) started");
-
- /* TEST CODE
- * Create handle.
- */
- AudioInput _in = new AudioInput(44100, AudioChannel.Stereo, AudioSampleType.U8);
- Assert.IsNotNull(_in, "AudioInput object should not be null after construction");
- Assert.IsInstanceOf<AudioInput>(_in, "The object should be of AudioInput");
-
- Log.Info(LogTag, "AudioInput Test Create(stereo, u8) finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Create AudioInput object with Stereo and S16Le value and verify")]
- [Property("SPEC", "Tizen.Multimedia.AudioInput.AudioInput C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void AudioInput_CREATE_STEREO_S16Le()
- {
- Log.Info(LogTag, "AudioInput Test Create(stereo, s16le) started");
-
- /* TEST CODE
- * Create handle.
- */
- AudioInput _in = new AudioInput(44100, AudioChannel.Stereo, AudioSampleType.S16Le);
- Assert.IsNotNull(_in, "AudioInput object should not be null after construction");
- Assert.IsInstanceOf<AudioInput>(_in, "The object should be of AudioInput");
-
- Log.Info(LogTag, "AudioInput Test Create(stereo, s16le) finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Check whether Prepare method can be invoked without any exception")]
- [Property("SPEC", "Tizen.Multimedia.AudioInput.Prepare M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void Prepare_CHECK_NO_EXCEPTION()
- {
- Log.Info(LogTag, "AudioInput Test Prepare started");
-
- /* PRECONDITION
- * Create handle.
- */
- AudioInput _in = new AudioInput(44100, AudioChannel.Mono, AudioSampleType.S16Le);
- Assert.IsNotNull(_in, "AudioInput object should not be null after construction");
- Assert.IsInstanceOf<AudioInput>(_in, "The object should be of AudioInput");
-
- /* TEST CODE
- * Prepare handle.
- */
- try
- {
- _in.Prepare();
- }
- catch (Exception e)
- {
- Assert.True(false, "Failed at Prepare: " + e.ToString());
- }
-
- /* POSTCONDITION
- * Unprepare the handle.
- */
- _in.Unprepare();
-
- Log.Info(LogTag, "AudioInput Test Prepare finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Check whether Unprepare method can be invoked without any exception")]
- [Property("SPEC", "Tizen.Multimedia.AudioInput.Unprepare M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void Unprepare_CHECK_NO_EXCEPTION()
- {
- Log.Info(LogTag, "AudioInput Test Unprepare started");
-
- /* PRECONDITION
- * Create handle and prepare handle.
- */
- AudioInput _in = new AudioInput(44100, AudioChannel.Mono, AudioSampleType.S16Le);
- Assert.IsNotNull(_in, "AudioInput object should not be null after construction");
- Assert.IsInstanceOf<AudioInput>(_in, "The object should be of AudioInput");
- _in.Prepare();
-
- /* TEST CODE
- * Unprepare the handle.
- */
- try
- {
- _in.Unprepare();
- }
- catch (Exception e)
- {
- Assert.True(false, "Failed at Unprepare: " + e.ToString());
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Check the return value of the Read method")]
- [Property("SPEC", "Tizen.Multimedia.AudioInput.Read M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void Read_CHECK_RETURN()
- {
- AudioInput _in;
- AudioOutput _out;
-
- Log.Info(LogTag, "AudioInput Test Read Sync started");
-
- /* PRECONDITION
- * Create handles(output handle for checking buffer) and prepare handles.
- */
- _in = new AudioInput(44100, AudioChannel.Mono, AudioSampleType.S16Le);
- Assert.IsNotNull(_in, "AudioInput object should not be null after construction");
- Assert.IsInstanceOf<AudioInput>(_in, "The object should be of AudioInput");
-
- _out = new AudioOutput(44100, AudioChannel.Mono, AudioSampleType.S16Le);
- Assert.IsNotNull(_out, "AudioOutput object should not be null after construction");
- Assert.IsInstanceOf<AudioOutput>(_out, "The object should be of AudioOutput");
-
- try
- {
- _in.Prepare();
- }
- catch (Exception e)
- {
- Assert.True(false, "Failed at Prepare(in): " + e.ToString());
- }
-
- try
- {
- _out.Prepare();
- }
- catch (Exception e)
- {
- Assert.True(false, "Failed at Prepare(out): " + e.ToString());
- }
-
- /* TEST CODE
- * Read buffer and write buffer
- */
- try
- {
- int remain_size = MAX_SIZE;
- while (remain_size > 0)
- {
- int size = _in.BufferSize;
- byte[] buffer = new byte[size];
- buffer = _in.Read(size);
-
- _out.Write(buffer);
- remain_size -= size;
- }
- }
- catch (Exception e)
- {
- Assert.True(false, "Failed at Read and Write: " + e.ToString());
- }
-
- /* POSTCONDITION
- * Unprepare the handles.
- */
- _in.Unprepare();
- _out.Unprepare();
-
- Log.Info(LogTag, "AudioInput Test Read Sync finished");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using TestFramework;
-using Tizen;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.AudioManager class")]
- public static class AudioManagerTests
- {
- private const string LogTag = "TizenTest.Multimedia.AudioManager";
-
- [SetUp]
- public static void Init()
- {
- Log.Info(LogTag, "AudioManager Test Init");
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "AudioManager Test Destroy");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioManager GetCurrectDevices")]
- [Property("SPEC", "Tizen.Multimedia.AudioManager.GetCurrectDevices M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void GetCurrentDevices_RETURN_DEVICES_LIST()
- {
- Log.Info(LogTag, "AudioManager Test GetCurrentDevices starting");
- IEnumerable<AudioDevice> deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.All);
-
- /* TEST CODE
- * Test the GetCurrentDevices method by checking for All type.
- */
- Assert.IsNotNull(deviceList, "DeviceList value returned is null");
- Assert.AreNotEqual(0, deviceList.Count(), "DeviceList count cannot be 0");
-
- /* TEST CODE
- * Test the GetCurrentDevices method by checking for Deactivated type.
- */
- deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.Deactivated);
- Assert.IsNotNull(deviceList, "DeviceList value returned is null");
- Assert.AreNotEqual(0, deviceList.Count(), "DeviceList count cannot be 0");
- //Log.Info(LogTag, "AudioManager Test GetCurrentDevices decativated total = " + deviceList.Count());
-
- /* TEST CODE
- * Test the GetCurrentDevices method by checking for Activated type.
- */
- deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.Activated);
- Assert.IsNotNull(deviceList, "DeviceList value returned is null");
- Assert.AreEqual(0, deviceList.Count(), "DeviceList activated count should be 0");
- // Log.Info(LogTag, "AudioManager Test GetCurrentDevices activated total = " + deviceList.Count());
-
- /* TEST CODE
- * Test the GetCurrentDevices method by checking for Input type.
- */
- deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.Input);
- Assert.IsNotNull(deviceList, "DeviceList value returned is null");
- Assert.AreNotEqual(0, deviceList.Count(), "DeviceList count cannot be 0");
- //Log.Info(LogTag, "AudioManager Test GetCurrentDevices in total = " + deviceList.Count());
-
- /* TEST CODE
- * Test the GetCurrentDevices method by checking for Output type.
- */
- deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.Output);
- Assert.IsNotNull(deviceList, "DeviceList value returned is null");
- Assert.AreNotEqual(0, deviceList.Count(), "DeviceList count cannot be 0");
- //Log.Info(LogTag, "AudioManager Test GetCurrentDevices out total = " + deviceList.Count());
-
- /* TEST CODE
- * Test the GetCurrentDevices method by checking for InputAndOutput type.
- */
- deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.InputAndOutput);
- Assert.IsNotNull(deviceList, "DeviceList value returned is null");
- Assert.AreEqual(0, deviceList.Count(), "DeviceList i/o count should be 0");
- //Log.Info(LogTag, "AudioManager Test GetCurrentDevices i/o total = " + deviceList.Count());
-
- /* TEST CODE
- * Test the GetCurrentDevices method by checking for Internal type.
- */
- deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.Internal);
- Assert.IsNotNull(deviceList, "DeviceList value returned is null");
- Assert.AreNotEqual(0, deviceList.Count(), "DeviceList count cannot be 0");
- //Log.Info(LogTag, "AudioManager Test GetCurrentDevices internal total = " + deviceList.Count());
-
- /* TEST CODE
- * Test the GetCurrentDevices method by checking for External type.
- */
- deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.External);
- Assert.IsNotNull(deviceList, "DeviceList value returned is null");
- Assert.AreEqual(0, deviceList.Count(), "DeviceList external count should be 0");
- //Log.Info(LogTag, "AudioManager Test GetCurrentDevices external total = " + deviceList.Count());
-
- Log.Info(LogTag, "AudioManager Test GetCurrentDevices finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioManager VolumeController")]
- [Property("SPEC", "Tizen.Multimedia.AudioManager.VolumeController A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void VolumeController_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "AudioManager Test VolumeController starting");
- AudioVolume volume = AudioManager.VolumeController;
- volume.CurrentType = AudioVolumeType.Ringtone;
-
- /* TEST CODE
- * Test VolumeController class
- */
- Assert.IsNotNull(volume, "VolumeController value returned is null");
- Assert.AreEqual(AudioVolumeType.Ringtone, volume.CurrentType, "volumeController is not same as set type");
- Log.Info(LogTag, "AudioManager Test VolumeController finished");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using TestFramework;
-using Tizen;
-
-namespace Tizen.Multimedia.Tests
-{
- public struct testWav
- {
- public float[] sine;
- public int left_channel;
- public int right_channel;
- private int size;
- private static float M_PI = 3.14159265F;
-
- public testWav(int s, int l, int r)
- {
- sine = new float[s];
- left_channel = l;
- right_channel = r;
- size = s;
- }
-
- public void initSine()
- {
- /* generate wave data */
- for (int i = 0; i < size; i++)
- sine[i] = (float)(0.9 * Math.Sin(((double)i / (double)size) * M_PI * 2));
- left_channel = right_channel = 0;
- }
- }
-
- [TestFixture]
- [Description("Testing Tizen.Multimedia.AudioOutput class")]
- public static class AudioOutTests
- {
- public const string LogTag = "TizenTest.Multimedia.AudioOutput";
- private static int TABLE_SIZE = 200;
- private static int MAX_SIZE = 131072;
-
- public static void MakeBufferAndWrite(AudioOutput _out, int length)
- {
- byte[] buffer;
- testWav testW = new testWav(TABLE_SIZE, 0, 0);
- testW.initSine();
-
- Log.Info(LogTag, "AudioOutput buffer length=>" + length);
- if (length > 0)
- {
- buffer = new byte[length];
- for (int i = 0; i < length / 2; i += 2)
- {
- buffer[i] = (byte)(32768 * testW.sine[testW.left_channel]);
- buffer[i + 1] = (byte)(32768 * testW.sine[testW.right_channel]);
- testW.left_channel += 1;
- if (testW.left_channel >= TABLE_SIZE)
- testW.left_channel -= TABLE_SIZE;
- testW.right_channel += 3;
- if (testW.right_channel >= TABLE_SIZE)
- testW.right_channel -= TABLE_SIZE;
- }
- _out.Write(buffer);
- }
- }
-
- [SetUp]
- public static void Init()
- {
- Log.Info(LogTag, "AudioOut Test Init");
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "AudioOut Test Destroy");
- }
-
- [Test]
- [Category("P1")]
- [Description("Create AudioOutput object with Mono and U8 value and verify")]
- [Property("SPEC", "Tizen.Multimedia.AudioOutput.AudioOutput C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void Create_CREATE_MONO_U8()
- {
- Log.Info(LogTag, "AudioOutput Test Create(mono, u8) started");
-
- /* TEST CODE
- * Create handle.
- */
- AudioOutput _out = new AudioOutput(44100, AudioChannel.Mono, AudioSampleType.U8);
- Assert.IsNotNull(_out, "AudioOutput object should not be null after construction");
- Assert.IsInstanceOf<AudioOutput>(_out, "The object should be of AudioOutput");
-
- Log.Info(LogTag, "AudioOutput Test Create(mono, u8) finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Create AudioOutput object with Mono and S16Le value and verify")]
- [Property("SPEC", "Tizen.Multimedia.AudioOutput.AudioOutput C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void Create_CREATE_MONO_S16Le()
- {
- Log.Info(LogTag, "AudioOutput Test Create(mono, s16le) started");
-
- /* TEST CODE
- * Create handle.
- */
- AudioOutput _out = new AudioOutput(44100, AudioChannel.Mono, AudioSampleType.S16Le);
- Assert.IsNotNull(_out, "AudioOutput object should not be null after construction");
- Assert.IsInstanceOf<AudioOutput>(_out, "The object should be of AudioOutput");
-
- Log.Info(LogTag, "AudioOutput Test Create(mono, s16le) finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Create AudioOutput object with Stereo and U8 value and verify")]
- [Property("SPEC", "Tizen.Multimedia.AudioOutput.AudioOutput C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void Create_CREATE_STEREO_U8()
- {
- Log.Info(LogTag, "AudioOutput Test Create(stereo, u8) started");
-
- /* TEST CODE
- * Create handle.
- */
- AudioOutput _out = new AudioOutput(44100, AudioChannel.Stereo, AudioSampleType.U8);
- Assert.IsNotNull(_out, "AudioOutput object should not be null after construction");
- Assert.IsInstanceOf<AudioOutput>(_out, "The object should be of AudioOutput");
-
- Log.Info(LogTag, "AudioOutput Test Create(stereo, u8) finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Create AudioOutput object with Stereo and S16Le value and verify")]
- [Property("SPEC", "Tizen.Multimedia.AudioOutput.AudioOutput C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void Create_CREATE_STEREO_S16Le()
- {
- Log.Info(LogTag, "AudioOutput Test Create(stereo, s16le) started");
-
- /* TEST CODE
- * Create handle.
- */
- AudioOutput _out = new AudioOutput(44100, AudioChannel.Stereo, AudioSampleType.S16Le);
- Assert.IsNotNull(_out, "AudioOutput object should not be null after construction");
- Assert.IsInstanceOf<AudioOutput>(_out, "The object should be of AudioOutput");
-
- Log.Info(LogTag, "AudioOutput Test Create(stereo, s16le) finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Check whether Prepare method can be invoked without any exception")]
- [Property("SPEC", "Tizen.Multimedia.AudioOutput.Prepare M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void Prepare_CHECK_NO_EXCEPTION()
- {
- Log.Info(LogTag, "AudioOutput Test Prepare started");
-
- /* PRECONDITION
- * Create handle.
- */
- AudioOutput _out = new AudioOutput(44100, AudioChannel.Mono, AudioSampleType.S16Le);
- Assert.IsNotNull(_out, "AudioOutput object should not be null after construction");
- Assert.IsInstanceOf<AudioOutput>(_out, "The object should be of AudioOutput");
-
- /* TEST CODE
- * Prepare and unprepare handle.
- */
- try
- {
- _out.Prepare();
- }
- catch (Exception e)
- {
- Assert.True(false, "Failed at Prepare: " + e.ToString());
- }
-
- /* POSTCONDITION
- * Unprepare the handle.
- */
- _out.Unprepare();
-
- Log.Info(LogTag, "AudioOutput Test Prepare finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Check whether Unprepare method can be invoked without any exception")]
- [Property("SPEC", "Tizen.Multimedia.AudioOutput.Unprepare M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void Unprepare_CHECK_NO_EXCEPTION()
- {
- Log.Info(LogTag, "AudioOutput Test Unprepare");
-
- /* PRECONDITION
- * Create handle and prepare handle.
- */
- AudioOutput _out = new AudioOutput(44100, AudioChannel.Mono, AudioSampleType.S16Le);
- Assert.IsNotNull(_out, "AudioOutput object should not be null after construction");
- Assert.IsInstanceOf<AudioOutput>(_out, "The object should be of AudioOutput");
- _out.Prepare();
-
- /* TEST CODE
- * Unprepare handle.
- */
- try
- {
- _out.Unprepare();
- }
- catch (Exception e)
- {
- Assert.True(false, "Failed at Unprepare: " + e.ToString());
- }
-
- Log.Info(LogTag, "AudioOutput Test Unprepare finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Check whether Write method can be invoked without any exception")]
- [Property("SPEC", "Tizen.Multimedia.AudioOutput.Write M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Sangchul Lee, sc11.lee@samsung.com")]
- public static void Write_CHECK_NO_EXCEPTION()
- {
- Log.Info(LogTag, "AudioOutput Test Write Sync started");
-
- /* PRECONDITION
- * Create handle and prepare handle.
- */
- AudioOutput _out = new AudioOutput(44100, AudioChannel.Stereo, AudioSampleType.S16Le);
- Assert.IsNotNull(_out, "AudioOutput object should not be null after construction");
- Assert.IsInstanceOf<AudioOutput>(_out, "The object should be of AudioOutput");
- _out.Prepare();
-
- /* TEST CODE
- * Make buffer and write buffer.
- */
- try
- {
- MakeBufferAndWrite(_out, MAX_SIZE);
- }
- catch (Exception e)
- {
- Assert.True(false, "Failed at MakeBufferAndWrite: " + e.ToString());
- }
-
- /* POSTCONDITION
- * Unprepare the handle.
- */
- _out.Unprepare();
-
- Log.Info(LogTag, "AudioOutput Test Write Sync finished");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Runtime.CompilerServices;
-using System.Diagnostics;
-using TestFramework;
-using Tizen;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Tizen.Multimedia.AudioStreamDeliveredEventArgs Tests")]
- public static class AudioStreamDeliveredEventArgsTests
- {
- private static Recorder _recorder;
- private static bool _streamFlag = false;
- private static RecorderFileFormat _fileFormat = RecorderFileFormat.ThreeGp;
- private static RecorderAudioCodec _audioCodec = RecorderAudioCodec.Aac;
- private static int _timeLimit = 3;
- private static string _filePath = "/opt/usr/home/owner/share/res/audiosample.3gp";
- public const string LogTag = "Tizen.Multimedia.AudioStreamDeliveredEventArgs";
-
- [SetUp]
- public static void Init()
- {
- _recorder = new Tizen.Multimedia.Recorder();
- _streamFlag = false;
- }
-
- [TearDown]
- public static void Destroy()
- {
- }
-
- public static void CheckChannel(object sender, AudioStreamDeliveredEventArgs e)
- {
- if(e.Channel > 0)
- _streamFlag = true;
- }
-
- private static void InitRecorder()
- {
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = _timeLimit;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Channel property of AudioStreamDeliveredEventArgs.")]
- [Property("SPEC", " Tizen.Multimedia.AudioStreamDeliveredEventArgs.Channel A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task Channel_GET()
- {
- Log.Info(LogTag, "AudioStreamDelivered Test Channel starting");
- /*
- * PRECONDITION
- * Set Audiocode, fileformat, filepath and
- * Timelimit
- */
- InitRecorder();
- _recorder.AudioStreamDelivered += CheckChannel;
-
- _recorder.Prepare();
- _recorder.Start();
-
- /*
- * TEST CODE
- * Check number of channels created
- */
- await Task.Delay(3000);
- Assert.IsTrue(_streamFlag, "Channel should be greater than 0.");
-
- /*
- * POSTCONDITION
- * Cleanup Recorder
- */
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.AudioStreamDelivered -= CheckChannel;
- Log.Info(LogTag, "AudioStreamDelivered Test Channel finished");
- }
-
- public static void CheckRecordingTime(object sender, AudioStreamDeliveredEventArgs e)
- {
- if(e.RecordingTime > 0)
- _streamFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecordingTime property of AudioStreamDeliveredEventArgs.")]
- [Property("SPEC", " Tizen.Multimedia.AudioStreamDeliveredEventArgs.RecordingTime A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task RecordingTime_GET()
- {
- Log.Info(LogTag, "AudioStreamDelivered Test RecordingTime starting");
- /*
- * PRECONDITION
- * Set Audiocode, fileformat, filepath and
- * Timelimit
- */
- InitRecorder();
-
- _recorder.AudioStreamDelivered += CheckRecordingTime;
-
- _recorder.Prepare();
- _recorder.Start();
-
- /*
- * TEST CODE
- * Check recording time.
- */
- await Task.Delay(3000);
- Assert.IsTrue(_streamFlag, "Recording time should be greater than 0.");
-
- /*
- * POSTCONDITION
- * Cleanup Recorder
- */
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.AudioStreamDelivered -= CheckRecordingTime;
- Log.Info(LogTag, "AudioStreamDelivered Test RecordingTime finished");
- }
-
- public static void CheckStream(object sender, AudioStreamDeliveredEventArgs e)
- {
- if(e.Stream.Length > 0)
- _streamFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Stream property of AudioStreamDeliveredEventArgs.")]
- [Property("SPEC", " Tizen.Multimedia.AudioStreamDeliveredEventArgs.Stream A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task Stream_GET()
- {
- Log.Info(LogTag, "AudioStreamDelivered Test Stream starting");
- /*
- * PRECONDITION
- * Set Audiocode, fileformat, filepath and
- * Timelimit
- */
- InitRecorder();
- _recorder.AudioStreamDelivered += CheckStream;
-
- _recorder.Prepare();
- _recorder.Start();
-
- /*
- * TEST CODE
- * Check recorded stream length.
- */
- await Task.Delay(3000);
- Assert.IsTrue(_streamFlag, "Recorded stream length should be greater than 0.");
- /*
- * POSTCONDITION
- * Cleanup Recorder
- */
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.AudioStreamDelivered -= CheckStream;
- Log.Info(LogTag, "AudioStreamDelivered Test stream finished");
- }
-
- public static void CheckType(object sender, AudioStreamDeliveredEventArgs e)
- {
- if(e.Type == AudioSampleType.S16Le)
- _streamFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Type property of AudioStreamDeliveredEventArgs.")]
- [Property("SPEC", " Tizen.Multimedia.AudioStreamDeliveredEventArgs.Type A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task Type_GET()
- {
- Log.Info(LogTag, "AudioStreamDelivered Test Type starting");
- /*
- * PRECONDITION
- * Set Audiocode, fileformat, filepath and
- * Timelimit
- */
- InitRecorder();
-
- _recorder.AudioStreamDelivered += CheckType;
- try {
- Log.Info(LogTag, "AudioStreamDelivered prepare");
- _recorder.Prepare();
- Log.Info(LogTag, "AudioStreamDelivered start");
- _recorder.Start();
- } catch(Exception e) {
- Log.Info(LogTag, "exception thrown " + e.Message);
- }
- /*
- * TEST CODE
- * Check Audio sample type.
- */
- Log.Info(LogTag, "AudioStreamDelivered await");
- await Task.Delay(3000);
- Log.Info(LogTag, "AudioStreamDelivered assert");
- Assert.IsTrue(_streamFlag, "stream deliver callback should be occured");
-
- /*
- * POSTCONDITION
- * Cleanup Recorder
- */
- _recorder.Commit();
- _recorder.Unprepare();
- Log.Info(LogTag, "AudioStreamDelivered Test Type finished");
- _recorder.AudioStreamDelivered -= CheckType;
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using TestFramework;
-using Tizen;
-using Tizen.UI;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.AudioStreamPolicy class")]
- public static class AudioStreamPolicyTests
- {
- public static int PlaybackFlag = 0;
- public static bool PlaybackFlagBool = false;
- public static int RecordingFlag = 0;
- public static bool StreamFocusFlag = false;
- public const string LogTag = "TizenTest.Multimedia.AudioStreamPolicy";
- static private Player _player;
-
-
- [SetUp]
- public static void Init()
- {
- PlaybackFlag = 0;
- RecordingFlag = 0;
- PlaybackFlagBool = false;
- Log.Info(LogTag, "AudioStreamPolicy Test Init");
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "AudioStreamPolicy Test Destroy");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioStreamPolicy Constructor")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void AudioStreamPolicy_INIT()
- {
- Log.Info(LogTag, "StreamPolicy Test INIT starting");
- /*
- * TEST CODE
- * Test AudioStreamPolicy constructor for media type.
- */
- AudioStreamPolicy asp = null;
- asp = new AudioStreamPolicy(AudioStreamType.Media);
- Assert.IsNotNull(asp, "AudioStreamPolicy object should not be null after construction");
- Assert.IsInstanceOf<AudioStreamPolicy>(asp, "The object should be of AudioStreamPolicyType");
-
- /*
- * TEST CODE
- * Test AudioStreamPolicy constructor for Alarm type.
- */
- asp = null;
- asp = new AudioStreamPolicy(AudioStreamType.Alarm);
- Assert.IsNotNull(asp, "AudioStreamPolicy object should not be null after construction");
- Assert.IsInstanceOf<AudioStreamPolicy>(asp, "The object should be of AudioStreamPolicyType");
-
- /*
- * TEST CODE
- * Test AudioStreamPolicy constructor for Emergency type.
- */
- asp = null;
- asp = new AudioStreamPolicy(AudioStreamType.Emergency);
- Assert.IsNotNull(asp, "AudioStreamPolicy object should not be null after construction");
- Assert.IsInstanceOf<AudioStreamPolicy>(asp, "The object should be of AudioStreamPolicyType");
-
- /*
- * TEST CODE
- * Test AudioStreamPolicy constructor for MediaExternal type.
- */
- asp = null;
- asp = new AudioStreamPolicy(AudioStreamType.MediaExternalOnly);
- Assert.IsNotNull(asp, "AudioStreamPolicy object should not be null after construction");
- Assert.IsInstanceOf<AudioStreamPolicy>(asp, "The object should be of AudioStreamPolicyType");
-
- /*
- * TEST CODE
- * Test AudioStreamPolicy constructor for Notification type.
- */
- asp = null;
- asp = new AudioStreamPolicy(AudioStreamType.Notification);
- Assert.IsNotNull(asp, "AudioStreamPolicy object should not be null after construction");
- Assert.IsInstanceOf<AudioStreamPolicy>(asp, "The object should be of AudioStreamPolicyType");
-
- /*
- * TEST CODE
- * Test AudioStreamPolicy constructor for RingtoneVoip type.
- */
- asp = null;
- asp = new AudioStreamPolicy(AudioStreamType.RingtoneVoip);
- Assert.IsNotNull(asp, "AudioStreamPolicy object should not be null after construction");
- Assert.IsInstanceOf<AudioStreamPolicy>(asp, "The object should be of AudioStreamPolicyType");
-
- /*
- * TEST CODE
- * Test AudioStreamPolicy constructor for System type.
- */
- asp = null;
- asp = new AudioStreamPolicy(AudioStreamType.System);
- Assert.IsNotNull(asp, "AudioStreamPolicy object should not be null after construction");
- Assert.IsInstanceOf<AudioStreamPolicy>(asp, "The object should be of AudioStreamPolicyType");
-
- /*
- * TEST CODE
- * Test AudioStreamPolicy constructor for VoiceInformation type.
- */
- asp = null;
- asp = new AudioStreamPolicy(AudioStreamType.VoiceInformation);
- Assert.IsNotNull(asp, "AudioStreamPolicy object should not be null after construction");
- Assert.IsInstanceOf<AudioStreamPolicy>(asp, "The object should be of AudioStreamPolicyType");
-
- /*
- * TEST CODE
- * Test AudioStreamPolicy constructor for VoiceRecognition type.
- */
- asp = null;
- asp = new AudioStreamPolicy(AudioStreamType.VoiceRecognition);
- Assert.IsNotNull(asp, "AudioStreamPolicy object should not be null after construction");
- Assert.IsInstanceOf<AudioStreamPolicy>(asp, "The object should be of AudioStreamPolicyType");
-
- /*
- * TEST CODE
- * Test AudioStreamPolicy constructor for Voip type.
- */
- asp = null;
- asp = new AudioStreamPolicy(AudioStreamType.Voip);
- Assert.IsNotNull(asp, "AudioStreamPolicy object should not be null after construction");
- Assert.IsInstanceOf<AudioStreamPolicy>(asp, "The object should be of AudioStreamPolicyType");
-
- Log.Info(LogTag, "StreamPolicy Test INIT finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy VolumeType Return type")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.VolumeType A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void VolumeType_GET_ENUM_ALL()
- {
- Log.Info(LogTag, "StreamPolicy Test VolumeType read starting");
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- object ret = asp.VolumeType;
-
- /* TEST CODE
- * Test Volume type property for Media.
- */
- Assert.IsNotNull(ret, "VolumeType value returned is null");
- Assert.True((ret is AudioVolumeType), "VolumeType value returned is not of type AudioVolumeType");
- Assert.AreEqual(AudioVolumeType.Media, asp.VolumeType, "VolumeType should be of media type");
-
- /* TEST CODE
- * Test Volume type property for Alarm.
- */
- asp = new AudioStreamPolicy(AudioStreamType.Alarm);
- ret = asp.VolumeType;
- Assert.IsNotNull(ret, "VolumeType value returned is null");
- Assert.True((ret is AudioVolumeType), "VolumeType value returned is not of type AudioVolumeType");
- Assert.AreEqual(AudioVolumeType.Alarm, asp.VolumeType, "VolumeType should be of alarm type");
-
- /* TEST CODE
- * Test Volume type property for Notification.
- */
- asp = new AudioStreamPolicy(AudioStreamType.Notification);
- ret = asp.VolumeType;
- Assert.IsNotNull(ret, "VolumeType value returned is null");
- Assert.True((ret is AudioVolumeType), "VolumeType value returned is not of type AudioVolumeType");
- Assert.AreEqual(AudioVolumeType.Notification, asp.VolumeType, "VolumeType should be of notification type");
-
- /* TEST CODE
- * Test Volume type property for System.
- */
- asp = new AudioStreamPolicy(AudioStreamType.System);
- ret = asp.VolumeType;
- Assert.IsNotNull(ret, "VolumeType value returned is null");
- Assert.True((ret is AudioVolumeType), "VolumeType value returned is not of type AudioVolumeType");
- Assert.AreEqual(AudioVolumeType.System, asp.VolumeType, "VolumeType should be of system type");
-
- /* TEST CODE
- * Test Volume type property for Voip.
- */
- asp = new AudioStreamPolicy(AudioStreamType.Voip);
- ret = asp.VolumeType;
- Assert.IsNotNull(ret, "VolumeType value returned is null");
- Assert.True((ret is AudioVolumeType), "VolumeType value returned is not of type AudioVolumeType");
- Assert.AreEqual(AudioVolumeType.Voip, asp.VolumeType, "VolumeType should be of voip type");
-
- asp = new AudioStreamPolicy(AudioStreamType.VoiceInformation);
- ret = asp.VolumeType;
- Assert.IsNotNull(ret, "VolumeType value returned is null");
- Assert.True((ret is AudioVolumeType), "VolumeType value returned is not of AudioVolumeType");
- Assert.AreEqual(AudioVolumeType.Voice, asp.VolumeType, "VolumeType should be of Voice type");
-
- asp = new AudioStreamPolicy(AudioStreamType.RingtoneVoip);
- ret = asp.VolumeType;
- Assert.IsNotNull(ret, "VolumeType value returned is null");
- Assert.True((ret is AudioVolumeType), "VolumeType value returned is not of AudioVolumeType");
- Assert.AreEqual(AudioVolumeType.Ringtone, asp.VolumeType, "VolumeType should be of Ringtone type");
- Log.Info(LogTag, "StreamPolicy Test volumetype read finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy FocusReacquisitionEnabled.")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.FocusReacquisitionEnabled A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void FocusReacquisitionEnabled_READ_WRITE()
- {
- Log.Info(LogTag, "StreamPolicy Test FocusReacquisitionEnabled write starting");
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
-
- /*
- * TEST CODE
- * Test FocusReacquistionEnabled property.
- */
- bool ret = asp.FocusReacquisitionEnabled;
- Assert.True(ret, "FocusReacquisitionEnabled should be true by default.");
- asp.FocusReacquisitionEnabled = false;
- ret = asp.FocusReacquisitionEnabled;
- Assert.True(ret == false, "FocusReacquisitionEnabled value not same as initially set");
-
- Log.Info(LogTag, "StreamPolicy Test FocusReacquisitionEnabled write finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy PlaybackFocusState")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.PlaybackFocusState A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void PlaybackFocusState_GET_ENUM_ALL()
- {
- Log.Info(LogTag, "StreamPolicy Test PlaybackFocusState read starting");
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
-
- /*
- * TEST CODE
- * Test PlaybackFocusState property.
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- AudioStreamFocusState ret = asp.PlaybackFocusState;
- Assert.True(ret == AudioStreamFocusState.Acquired, "PlaybackFocusState not acquired even after calling AudioStreamPolicy.AcquireFocus(Playback)");
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- ret = asp.PlaybackFocusState;
- Assert.True(ret == AudioStreamFocusState.Released, "PlaybackFocusState not released even after calling AudioStreamPolicy.ReleaseFocus(Playback)");
-
- Log.Info(LogTag, "StreamPolicy Test PlaybackFocusState read finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy RecordingFocusState")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.RecordingFocusState A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void RecordingFocusState_GET_ENUM_ALL()
- {
- Log.Info(LogTag, "StreamPolicy Test RecordingFocusState read starting");
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
-
- /*
- * TEST CODE
- * Test RecordingFocusState property.
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Recording, "");
- AudioStreamFocusState ret = asp.RecordingFocusState;
- Log.Info(LogTag, "ret = " + ret);
- Log.Info(LogTag, "expected = " + AudioStreamFocusState.Acquired);
- Assert.True(ret == AudioStreamFocusState.Acquired, "RecordingFocusState not acquired even after calling AudioStreamPolicy.AcquireFocus(Recording)");
- asp.ReleaseFocus(AudioStreamFocusOptions.Recording, "");
- ret = asp.RecordingFocusState;
- Assert.True(ret == AudioStreamFocusState.Released, "RecordingFocusState not released even after calling AudioStreamPolicy.ReleaseFocus(Recording)");
-
- Log.Info(LogTag, "StreamPolicy Test RecordingFocusState read finished");
- }
-
- public static void PlaybackFocusStateWatchCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "******************** called ******************* " + PlaybackFlag);
- PlaybackFlag++;
- }
-
- public static void RecordingFocusStateWatchCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "******************** called ******************* " + RecordingFlag);
- RecordingFlag++;
- }
-
- public static void StreamFocusStateChangedCallback(object sender, StreamFocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "******************** called *******************");
- StreamFocusFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy AcquireFocus Playback")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.AcquireFocus M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MAE")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void AcquireFocus_RETURN_FOCUS_PLAYBACK()
- {
- /* TEST CODE
- * Test AcquireFocus method for playback type.
- */
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, null);
- AudioStreamFocusState ret = asp.PlaybackFocusState;
- Assert.True(ret == AudioStreamFocusState.Acquired, "PlaybackFocusState not acquired even after calling AudioStreamPolicy.AcquireFocus(Playback)");
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, null);
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy AcquireFocus Recording")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.AcquireFocus M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MAE")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void AcquireFocus_RETURN_FOCUS_RECORDING()
- {
- /*
- * TEST CODE
- * Test AcquireFocus method for Recording type.
- */
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- asp.AcquireFocus(AudioStreamFocusOptions.Recording, null);
- AudioStreamFocusState ret = asp.RecordingFocusState;
- Assert.True(ret == AudioStreamFocusState.Acquired, "RecordingFocusState not acquired even after calling AudioStreamPolicy.AcquireFocus(Playback)");
- asp.ReleaseFocus(AudioStreamFocusOptions.Recording, null);
- }
-
- public static void ExtraInformationCallbackNull(object sender, FocusStateChangedEventArgs args)
- {
- string ret = args.ExtraInformation;
- Log.Info(LogTag, "ret = [" + ret + "] len = " + ret.Length);
- //if (ret.Equals(null))
- if (ret.Length == 0)
- PlaybackFlagBool = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AcquireFocus method with null value on ExtraInformation param.")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.AcquireFocus M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MAC")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task AcquireFocus_EXTRAINFORMATION_NULL()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test ExtraInformation read starting");
- PlaybackFlagBool = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += ExtraInformationCallbackNull;
-
- /* TEST CODE
- * Test ExtraInformation property of FocusStateChangedEventArgs."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, null);
- await Task.Delay(2000);
- Assert.True(PlaybackFlagBool, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= ExtraInformationCallbackNull;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, null);
- Log.Info(LogTag, "AcquireFocus_EXTRAINFORMATION_NULL Test ExtraInformation read finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy RecordingFocusState")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.ReleaseFocus M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MAE")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void ReleaseFocus_RETURN_FOCUS_PLAYBACK()
- {
- /* TEST CODE
- * Test ReleaseFocus method for playback type.
- */
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, null);
- AudioStreamFocusState ret = asp.PlaybackFocusState;
- Assert.True(ret == AudioStreamFocusState.Acquired, "PlaybackFocusState not acquired even after calling AudioStreamPolicy.AcquireFocus(Playback)");
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, null);
- ret = asp.RecordingFocusState;
- Assert.True(ret == AudioStreamFocusState.Released, "RecordingFocusState not released even after calling AudioStreamPolicy.ReleaseFocus(Playback)");
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy RecordingFocusState")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.ReleaseFocus M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MAE")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void ReleaseFocus_RETURN_FOCUS_RECORDING()
- {
- /* TEST CODE
- * Test ReleaseFocus method for Recording type.
- */
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- asp.AcquireFocus(AudioStreamFocusOptions.Recording, null);
- AudioStreamFocusState ret = asp.RecordingFocusState;
- Assert.True(ret == AudioStreamFocusState.Acquired, "RecordingFocusState not acquired even after calling AudioStreamPolicy.AcquireFocus(Playback)");
- asp.ReleaseFocus(AudioStreamFocusOptions.Recording, null);
- ret = asp.RecordingFocusState;
- Assert.True(ret == AudioStreamFocusState.Released, "RecordingFocusState not released even after calling AudioStreamPolicy.ReleaseFocus(Playback)");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ReleaseFocus method with null value on ExtraInformation param.")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.ReleaseFocus M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MAC")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task ReleaseFocus_EXTRAINFORMATION_NULL()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test ExtraInformation read starting");
- PlaybackFlagBool = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
-
- /* TEST CODE
- * Test ExtraInformation property of FocusStateChangedEventArgs."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, null);
- AudioStreamPolicy.PlaybackFocusStateWatch += ExtraInformationCallbackNull;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, null);
- await Task.Delay(2000);
- Assert.True(PlaybackFlagBool, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= ExtraInformationCallbackNull;
- Log.Info(LogTag, "ReleaseFocus_EXTRAINFORMATION_NULL Test ExtraInformation read finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy PlaybackFocusStateWatch")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.PlaybackFocusStateWatch E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task PlaybackFocusStateWatch_CHECK_EVENT()
- {
- Log.Info(LogTag, "StreamPolicy Test PlaybackFocusStateWatch CB starting");
- //PlaybackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- AudioStreamPolicy.PlaybackFocusStateWatch += PlaybackFocusStateWatchCallback;
-
- /* TEST CODE
- * Test PlaybackFocusStateWatch event
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.AreEqual(2, PlaybackFlag, "PlaybackFocusStateWatch CB not called");
-
- /* POSTCONDITION
- * Remove the EventHandler
- */
- AudioStreamPolicy.PlaybackFocusStateWatch -= PlaybackFocusStateWatchCallback;
- Log.Info(LogTag, "StreamPolicy Test PlaybackFocusStateWatch CB finished ");
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy RecordingFocusStateWatch")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.RecordingFocusStateWatch E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task RecordingFocusStateWatch_CHECK_EVENT()
- {
- Log.Info(LogTag, "StreamPolicy Test RecordingFocusStateWatch CB starting");
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- RecordingFlag = 0;
- AudioStreamPolicy.RecordingFocusStateWatch += RecordingFocusStateWatchCallback;
-
- /* TEST CODE
- * Test RecordingFocusStateWatch event
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Recording, "");
- asp.ReleaseFocus(AudioStreamFocusOptions.Recording, "");
- await Task.Delay(2000);
- Assert.AreEqual(2, RecordingFlag, "RecordingFocusStateWatch Callback not called");
-
- /* POSTCONDITION
- * Remove the EventHandler
- */
- AudioStreamPolicy.RecordingFocusStateWatch -= RecordingFocusStateWatchCallback;
- Log.Info(LogTag, "StreamPolicy Test RecordingFocusStateWatch CB finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy StreamFocusStateChanged")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.StreamFocusStateChanged E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task StreamFocusStateChanged_CHECK_EVENT()
- {
- Log.Info(LogTag, "StreamPolicy Test StreamFocusStateChanged CB starting");
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- asp.StreamFocusStateChanged += StreamFocusStateChangedCallback;
-
- AudioStreamPolicy asp2 = new AudioStreamPolicy(AudioStreamType.Media);
-
- /* TEST CODE
- * Test StreamFocusStateChanged event
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Recording, "");
- asp2.AcquireFocus(AudioStreamFocusOptions.Recording, "");
- asp2.ReleaseFocus(AudioStreamFocusOptions.Recording, "");
- asp.ReleaseFocus(AudioStreamFocusOptions.Recording, "");
- await Task.Delay(2000);
- Assert.True(StreamFocusFlag, "StreamFocusStateChanged Callback not called");
-
- /* POSTCONDITION
- * Remove the EventHandler
- */
- asp.StreamFocusStateChanged -= StreamFocusStateChangedCallback;
- Log.Info(LogTag, "StreamPolicy Test StreamFocusStateChanged CB finished = " + StreamFocusFlag.ToString());
- }
-
- public static void StreamFocusStateChangedCallbackAcquire(object sender, StreamFocusStateChangedEventArgs args)
- {
- AudioStreamPolicy asp = (AudioStreamPolicy)sender;
- try {
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- Assert.True(false, "Exception should occur");
- } catch(Exception e) {
- Assert.True(true, "Should not call acquirefocus within Eventhandler of StreamFocusStateChanged");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Check whether AcquireFocus method throws exception when invoked with FocuStateChanged and StreamFocusStateWatch event handler.")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.AcquireFocus M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task AcquireFocus_CHECK_EXCEPTION()
- {
- Log.Info(LogTag, "StreamPolicy Test StreamFocusStateChanged CB starting");
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- asp.StreamFocusStateChanged += StreamFocusStateChangedCallbackAcquire;
-
- /* TEST CODE
- * Test StreamFocusStateChanged event
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Recording, "");
- asp.ReleaseFocus(AudioStreamFocusOptions.Recording, "");
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
-
- /* POSTCONDITION
- * Remove the EventHandler
- */
- asp.StreamFocusStateChanged -= StreamFocusStateChangedCallbackAcquire;
- Log.Info(LogTag, "StreamPolicy Test StreamFocusStateChanged CB finished = " + StreamFocusFlag.ToString());
- }
-
- public static void StreamFocusStateChangedCallbackRelease(object sender, StreamFocusStateChangedEventArgs args)
- {
- AudioStreamPolicy asp = (AudioStreamPolicy)sender;
- try {
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- Assert.True(false, "Exception should occur");
- } catch(Exception e) {
- Assert.True(true, "Should not call releasefocus within Eventhandler of StreamFocusStateChanged");
- }
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Check whether ReleaseFocus method throws exception when invoked with FocuStateChanged and StreamFocusStateWatch event handler.")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.ReleaseFocus M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task ReleaseFocus_CHECK_EXCEPTION()
- {
- Log.Info(LogTag, "StreamPolicy Test StreamFocusStateChanged CB starting");
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- asp.StreamFocusStateChanged += StreamFocusStateChangedCallbackRelease;
-
- /* TEST CODE
- * Test StreamFocusStateChanged event
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Recording, "");
- asp.ReleaseFocus(AudioStreamFocusOptions.Recording, "");
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
-
- /* POSTCONDITION
- * Remove the EventHandler
- */
- asp.StreamFocusStateChanged -= StreamFocusStateChangedCallbackRelease;
- Log.Info(LogTag, "StreamPolicy Test StreamFocusStateChanged CB finished = " + StreamFocusFlag.ToString());
- }
-
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy AddDeviceForStreamRouting")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.AddDeviceForStreaming M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void AddDeviceForStreamRouting_NO_EXCEPTION()
- {
- /*
- * PRECONDITION
- * Initialize the device.
- */
- Log.Info(LogTag, "StreamPolicy Test AddDeviceForStreamRouting started");
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Voip);
- IEnumerable<AudioDevice> deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.All);
- AudioDevice _device = deviceList.ElementAt(0);
-
- /* TEST CODE
- * Test Adding audiodevice for stream routing.
- */
- Assert.IsInstanceOf<AudioDevice>(_device, "device is not of AudioDevice type");
- try {
- asp.AddDeviceForStreamRouting(_device);
- Assert.True(true, "");
- } catch(Exception e) {
- Assert.True(false, "Failed at AddDevieForStreamRouting");
- }
-
- Log.Info(LogTag, "StreamPolicy Test AddDeviceForStreamRouting finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy ApplyStreamRouting")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.ApplyStreamRouting M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void ApplyStreamRouting_NO_EXCEPTION()
- {
- /*
- * PRECONDITION
- * Initialize the device for applying stream.
- */
- Log.Info(LogTag, "StreamPolicy Test ApplyStreamRouting started");
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Voip);
- IEnumerable<AudioDevice> deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.All);
- AudioDevice _device = deviceList.ElementAt(0);
-
- /* TEST CODE
- * Test ApplyStreamRouting for device.
- */
- Assert.IsInstanceOf<AudioDevice>(_device, "device is not of AudioDevice type");
- try {
- asp.AddDeviceForStreamRouting(_device);
- asp.ApplyStreamRouting();
- Assert.True(true, "");
- } catch(Exception e) {
- Assert.True(false, "Failed at ApplyStreamRouting");
- }
-
- Log.Info(LogTag, "StreamPolicy Test ApplyStreamRouting finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamPolicy RemoveDeviceForStreamRouting")]
- [Property("SPEC", "Tizen.Multimedia.AudioStreamPolicy.RemoveDeviceForStreamRouting M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void RemoveDeviceForStreamRouting_NO_EXCEPTION()
- {
- /*
- * PRECONDITION
- * Initialize the Audiodevice.
- */
- Log.Info(LogTag, "StreamPolicy Test RemoveDeviceForStreamRouting started");
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Voip);
- IEnumerable<AudioDevice> deviceList = AudioManager.GetCurrentDevices(AudioDeviceOptions.All);
- AudioDevice _device = deviceList.ElementAt(0);
-
- /* TEST CODE
- * Test removing device from stream routing.
- */
- Assert.IsInstanceOf<AudioDevice>(_device, "device is not of AudioDevice type");
- try {
- asp.AddDeviceForStreamRouting(_device);
- asp.RemoveDeviceForStreamRouting(_device);
- Assert.True(true, "");
- } catch(Exception e) {
- Assert.True(false, "Failed at RemoveDeviceForStreamRouting");
- }
-
- Log.Info(LogTag, "StreamPolicy Test RemoveDeviceForStreamRouting finished");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using TestFramework;
-using Tizen;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.AudioVolume class")]
- public static class AudioVolumeTests
- {
- public const string LogTag = "TizenTest.Multimedia.AudioVolume";
- private static AudioVolume _volume;
- private static bool _vFlag = false;
-
- [SetUp]
- public static void Init()
- {
- _vFlag = false;
- _volume = AudioManager.VolumeController;
- Log.Info(LogTag, "AudioVolume Test Init");
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "AudioVolume Test Destroy");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioVolume CurrentType Write")]
- [Property("SPEC", "Tizen.Multimedia.AudioVolume.CurrentType A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void CurrentType_GET_SET_ENUM_ALL()
- {
- Log.Info(LogTag, "AudioVolume Test CurrentType write starting");
-
- /* TEST CODE
- * Test CurrentType for ringtone type.
- */
- _volume.CurrentType = AudioVolumeType.Ringtone;
- AudioVolumeType ret = _volume.CurrentType;
- Assert.True(ret == AudioVolumeType.Ringtone, "CurrentType value returned is not same as the one set");
-
- /* TEST CODE
- * Test CurrentType for Alarm type.
- */
- _volume.CurrentType = AudioVolumeType.Alarm;
- ret = _volume.CurrentType;
- Assert.True(ret == AudioVolumeType.Alarm, "CurrentType value returned is not same as the one set");
-
- /* TEST CODE
- * Test CurrentType for Call type.
- */
- _volume.CurrentType = AudioVolumeType.Call;
- ret = _volume.CurrentType;
- Assert.True(ret == AudioVolumeType.Call, "CurrentType value returned is not same as the one set");
-
- /* TEST CODE
- * Test CurrentType for Media type.
- */
- _volume.CurrentType = AudioVolumeType.Media;
- ret = _volume.CurrentType;
- Assert.True(ret == AudioVolumeType.Media, "CurrentType value returned is not same as the one set");
-
- /* TEST CODE
- * Test CurrentType for Notification type.
- */
- _volume.CurrentType = AudioVolumeType.Notification;
- ret = _volume.CurrentType;
- Assert.True(ret == AudioVolumeType.Notification, "CurrentType value returned is not same as the one set");
-
- /* TEST CODE
- * Test CurrentType for System type.
- */
- _volume.CurrentType = AudioVolumeType.System;
- ret = _volume.CurrentType;
- Assert.True(ret == AudioVolumeType.System, "CurrentType value returned is not same as the one set");
-
- /* TEST CODE
- * Test CurrentType for Voice type.
- */
- _volume.CurrentType = AudioVolumeType.Voice;
- ret = _volume.CurrentType;
- Assert.True(ret == AudioVolumeType.Voice, "CurrentType value returned is not same as the one set");
-
- /* TEST CODE
- * Test CurrentType for Voip type.
- */
- _volume.CurrentType = AudioVolumeType.Voip;
- ret = _volume.CurrentType;
- Assert.True(ret == AudioVolumeType.Voip, "CurrentType value returned is not same as the one set");
- Log.Info(LogTag, "AudioVolume Test CurrentType write finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioVolume MaxLevel")]
- [Property("SPEC", "Tizen.Multimedia.AudioVolume.MaxLevel A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void MaxLevel_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "AudioVolume Test MaxLevel starting");
-
- /* TEST CODE
- * Test MaxLevel of Volume.
- */
- object ret = _volume.MaxLevel[AudioVolumeType.Notification];
- Assert.IsNotNull(ret, "MaxLevel value returned is null");
- Assert.True((ret is int), "MaxLevel value returned is not of type int");
- Log.Info(LogTag, "AudioVolume Test MaxLevel finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioVolume Level")]
- [Property("SPEC", "Tizen.Multimedia.AudioVolume.Level A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void Level_READ_WRITE()
- {
- Log.Info(LogTag, "AudioVolume Test Level write starting");
- _volume.Level[AudioVolumeType.Ringtone] = 4;
-
- /* TEST CODE
- * Test Level of Ringtone Volume.
- */
- int ret = _volume.Level[AudioVolumeType.Ringtone];
- Assert.True(ret == 4, "Level value returned is not same as the one set");
-
- _volume.Level[AudioVolumeType.Ringtone] = 6;
-
- /* TEST CODE
- * Test Level of Ringtone Volume.
- */
- ret = _volume.Level[AudioVolumeType.Ringtone];
- Assert.True(ret == 6, "Level value returned is not same as the one set");
- Log.Info(LogTag, "AudioVolume Test Level write finished");
- }
-
- public static void VolumeChangedCallback(object sender, VolumeChangedEventArgs args)
- {
- if(args.Type == AudioVolumeType.Ringtone)
- _vFlag = true;
- else
- Log.Info(LogTag, "Volume level Type not same as the one changed");
- }
-
- [Test]
- [Category("P1")]
- [Description("AudioVolume Changed Callback")]
- [Property("SPEC", "Tizen.Multimedia.AudioVolume.Changed E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task Changed_CHECK_EVENT()
- {
- Log.Info(LogTag, "AudioVolume Test Changed Callback starting");
- _volume.Level[AudioVolumeType.Ringtone] = 4;
- _volume.Changed += VolumeChangedCallback;
-
- /* TEST CODE
- * Check AudioVolumeChanged Event.
- */
- _volume.Level[AudioVolumeType.Ringtone] = 5;
- await Task.Delay(3000);
- Assert.True(_vFlag, "Volume Changed Callback should have been called");
- Log.Info(LogTag, "AudioVolume Test Changed Callback finished");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.BufferStatusEventArgs Tests")]
- public static class BufferStatusEventArgsTests
- {
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test stream type")]
- [Property("SPEC", "Tizen.Multimedia.BufferStatusEventArgs.StreamType A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void StreamType_PROPERTY_READ_ONLY()
- {
- //TODO: Fill this when MediaFormat is implemented.
- Assert.True(false, "[NA] MediaFormat class not available yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test buffer status")]
- [Property("SPEC", "Tizen.Multimedia.BufferStatusEventArgs.Status A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Status_PROPERTY_READ_ONLY()
- {
- //TODO: Fill this when MediaFormat is implemented.
- Assert.True(false, "[NA] MediaFormat class not available yet");
- }
-
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.BufferingProgressEventArgs Tests")]
- public static class BufferingProgressEventArgsTests
- {
-
- static private int _bufferingPercent;
- private const string UrlPath = "http://content.bitsontherun.com/videos/ntPYsD4L-1ahmry41.mp4";
- static private Player TestPlayer;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Buffering progress percent")]
- [Property("SPEC", "Tizen.Multimedia.BufferingProgressEventArgs.Percent A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Percent_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION :
- * Set remote url path to player
- * Register buffering event handler
- * Start player
- */
- _bufferingPercent = 0;
- MediaSource src = new MediaUriSource(UrlPath);
- TestPlayer.SetSource(src);
- TestPlayer.StreamingConfiguration.BufferingProgressChanged += BufferingProgressCB;
- await TestPlayer.PrepareAsync();
- TestPlayer.Start();
-
- /*
- * TEST CODE
- * Wait for 5 seconds and measure buffering progress percent
- */
- await Task.Delay(5000);
- Assert.Greater(_bufferingPercent, 2, "Buffering event not received");
-
- /*
- * POST CONDITION :
- * Cleanup player
- */
- TestPlayer.Stop();
- TestPlayer.Unprepare();
- }
-
- static void BufferingProgressCB(object sender, BufferingProgressEventArgs args)
- {
- _bufferingPercent = args.Percent;
- }
-
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Runtime.CompilerServices;
-using System.Diagnostics;
-using TestFramework;
-using Tizen;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Tizen.Multimedia.Camera Tests")]
- public static class CameraTests
- {
- public const string LogTag = "Tizen.Multimedia.Camera";
-
- [SetUp]
- public static void Init()
- {
- }
-
- [TearDown]
- public static void Destroy()
- {
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Camera constructor.")]
- [Property("SPEC", " Tizen.Multimedia.Camera C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Camera_INIT()
- {
- Assert.IsTrue(false, "[NA] Camera class unavailable yet");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.Display Tests")]
- public static class DisplayTests
- {
- static private Player TestPlayer;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Constructor Display")]
- [Property("SPEC", "Tizen.Multimedia.Display.Display C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Display_INIT()
- {
- //TODO: Fill this when VideoView is implemented
- Assert.True(false, "[NA] VideoView class not available yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Display Mode")]
- [Property("SPEC", "Tizen.Multimedia.Display.Mode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Mode_SET_ENUM_ALL()
- {
- TestPlayer.Display.Mode = DisplayMode.LetterBox;
- Assert.AreEqual((int)TestPlayer.Display.Mode, (int)DisplayMode.LetterBox, "Could not set mode to LetterBox");
-
- TestPlayer.Display.Mode = DisplayMode.OriginalSize;
- Assert.AreEqual((int)TestPlayer.Display.Mode, (int)DisplayMode.OriginalSize, "Could not set mode to OriginalSize");
-
- TestPlayer.Display.Mode = DisplayMode.FullScreen;
- Assert.AreEqual((int)TestPlayer.Display.Mode, (int)DisplayMode.FullScreen, "Could not set mode to FullScreen");
-
- TestPlayer.Display.Mode = DisplayMode.CroppedFull;
- Assert.AreEqual((int)TestPlayer.Display.Mode, (int)DisplayMode.CroppedFull, "Could not set mode to CroppedFull");
-
- TestPlayer.Display.Mode = DisplayMode.OriginalOrFull;
- Assert.AreEqual((int)TestPlayer.Display.Mode, (int)DisplayMode.OriginalOrFull, "Could not set mode to OriginalOrFull");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Display IsVisible")]
- [Property("SPEC", "Tizen.Multimedia.Display.IsVisible A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void IsVisible_READ_WRITE()
- {
- TestPlayer.Display.IsVisible = false;
- Assert.False(TestPlayer.Display.IsVisible, "Could not set IsVisible to false");
-
- TestPlayer.Display.IsVisible = true;
- Assert.True(TestPlayer.Display.IsVisible, "Could not set IsVisible to true");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Display Rotation")]
- [Property("SPEC", "Tizen.Multimedia.Display.Rotation A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Rotation_SET_ENUM_ALL()
- {
- TestPlayer.Display.Rotation = DisplayRotation.RotationNone;
- Assert.AreEqual((int)TestPlayer.Display.Rotation, (int)DisplayRotation.RotationNone, "Could not set rotation to RotationNone");
-
- TestPlayer.Display.Rotation = DisplayRotation.Rotation90;
- Assert.AreEqual((int)TestPlayer.Display.Rotation, (int)DisplayRotation.Rotation90, "Could not set rotation to Rotation90");
-
- TestPlayer.Display.Rotation = DisplayRotation.Rotation180;
- Assert.AreEqual((int)TestPlayer.Display.Rotation, (int)DisplayRotation.Rotation180, "Could not set rotation to Rotation180");
-
- TestPlayer.Display.Rotation = DisplayRotation.Rotation270;
- Assert.AreEqual((int)TestPlayer.Display.Rotation, (int)DisplayRotation.Rotation270, "Could not set rotation to Rotation270");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.DownloadProgress Tests")]
- public static class DownloadProgressTests
- {
- static private string UrlPath = "http://content.bitsontherun.com/videos/ntPYsD4L-1ahmry41.mp4";
- static private Player TestPlayer;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- private static async Task Initialize()
- {
- MediaSource src = new MediaUriSource(UrlPath);
- TestPlayer.SetSource(src);
- await TestPlayer.PrepareAsync();
- TestPlayer.Start();
- }
-
- private static void Cleanup()
- {
- TestPlayer.Stop();
- TestPlayer.Unprepare();
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test download progress start")]
- [Property("SPEC", "Tizen.Multimedia.DownloadProgress.Start A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Start_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION :
- * Set remote url path to player
- * Start player
- */
- await Initialize();
-
- /*
- * TEST CODE
- * Wait for 5 seconds and measure download progress start
- */
- await Task.Delay(5000);
- Assert.IsNotNull(TestPlayer.StreamingConfiguration.DownloadProgress, "Expected object");
- Assert.AreEqual(TestPlayer.StreamingConfiguration.DownloadProgress.Start, 0, "Unexpected start value");
-
- /*
- * POST CONDITION :
- * Cleanup player
- */
- Cleanup();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test download progress start")]
- [Property("SPEC", "Tizen.Multimedia.DownloadProgress.Start A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Start_CHECK_NON_ZERO()
- {
- /*
- * PRECONDITION :
- * Set remote url path to player
- * Start player
- * Set play position to 61 secs (Total length of source = 10 mins)
- */
- await Initialize();
- await TestPlayer.SetPlayPositionAsync(61000, false);
-
- /*
- * TEST CODE
- * Wait for 2 seconds and measure download progress start
- * Since Download should start from sought position (61 sec), start should be 10%
- */
- await Task.Delay(2000);
- Assert.IsNotNull(TestPlayer.StreamingConfiguration.DownloadProgress, "Expected object");
- Assert.AreEqual(TestPlayer.StreamingConfiguration.DownloadProgress.Start, 10, "Unexpected start value");
-
- /*
- * POST CONDITION :
- * Cleanup player
- */
- Cleanup();
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test download progress current")]
- [Property("SPEC", "Tizen.Multimedia.DownloadProgress.Current A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Current_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION :
- * Set remote url path to player
- * Start player
- */
- await Initialize();
-
- /*
- * TEST CODE
- * Wait for 5 seconds and measure download progress Current
- */
- await Task.Delay(5000);
- Assert.IsNotNull(TestPlayer.StreamingConfiguration.DownloadProgress, "Expected object");
- //Assuming good connection, download should have started
- Assert.Greater(TestPlayer.StreamingConfiguration.DownloadProgress.Current, 0, "Unexpected current value");
-
- /*
- * POST CONDITION :
- * Cleanup player
- */
- Cleanup();
- }
-
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.EqualizerBand Tests")]
- public static class EqualizerBandTests
- {
- static private int[] FrequencyList = { 36, 98, 265, 711, 1907, 5117, 13727 };
- static private int[] RangeList = { 33, 90, 242, 649, 1743, 4676, 12544 };
-
- static private Player TestPlayer;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test EqualizerBand Frequency")]
- [Property("SPEC", "Tizen.Multimedia.EqualizerBands.Frequency A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Frequency_PROPERTY_READ_ONLY()
- {
- int counter = 0;
- List<EqualizerBand> bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
-
- // TEST: Check frequency
- foreach(EqualizerBand b in bands)
- {
- Assert.AreEqual(b.Frequency, FrequencyList[counter++], "Incorrect frequency");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test EqualizerBand Range")]
- [Property("SPEC", "Tizen.Multimedia.EqualizerBands.Range A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Range_PROPERTY_READ_ONLY()
- {
- int counter = 0;
- List<EqualizerBand> bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
-
- // TEST: Check Range
- foreach(EqualizerBand b in bands)
- {
- Assert.AreEqual(b.Range, RangeList[counter++], "Incorrect Range");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test EqualizerBand Level")]
- [Property("SPEC", "Tizen.Multimedia.EqualizerBands.Level A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Level_PROPERTY_READ_WRITE()
- {
- List<EqualizerBand> bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
-
- foreach(EqualizerBand b in bands)
- {
- // TEST: Read level
- Assert.AreEqual(b.Level, 0, "Incorrect Level");
- // TEST: Write level
- b.Level = 1;
- }
-
- TestPlayer.AudioEffect.EqualizerBands = bands;
- bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
- foreach(EqualizerBand b in bands)
- {
- // TEST: Check updated level
- Assert.AreEqual(b.Level, 1, "Incorrect Level");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AudioEffect EqualizerBands Level above max")]
- [Property("SPEC", "Tizen.Multimedia.AudioEffect.EqualizerBands.Level A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PAM")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Level_WRITE_ABOVE_MAX()
- {
- bool pass = false;
- List<EqualizerBand> bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
-
- EqualizerBand b = bands.ElementAt(0);
- b.Level = TestPlayer.AudioEffect.MaxLevel + 1;
-
- // TEST: Write and check equalizer band level above max
- try
- {
- TestPlayer.AudioEffect.EqualizerBands = bands;
- } catch(Exception e)
- {
- pass = e.GetType().Name.Equals("ArgumentException");
- }
-
- Assert.True(pass, "Invalid result");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AudioEffect EqualizerBands Level max")]
- [Property("SPEC", "Tizen.Multimedia.AudioEffect.EqualizerBands.Level A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PMAX")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Level_WRITE_MAX()
- {
- // TEST: Write and check equalizer bands level max
- List<EqualizerBand> bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
-
- EqualizerBand b = bands.ElementAt(0);
- b.Level = TestPlayer.AudioEffect.MaxLevel;
-
- TestPlayer.AudioEffect.EqualizerBands = bands;
-
- bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
-
- Assert.AreEqual(bands.ElementAt(0).Level, TestPlayer.AudioEffect.MaxLevel, "Could not set Max value");
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AudioEffect EqualizerBands Level below min")]
- [Property("SPEC", "Tizen.Multimedia.AudioEffect.EqualizerBands.Level A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PBM")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Level_WRITE_BELOW_MIN()
- {
- bool pass = false;
- List<EqualizerBand> bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
-
- EqualizerBand b = bands.ElementAt(0);
- b.Level = TestPlayer.AudioEffect.MinLevel - 1;
-
- // TEST: Check equalizer bands Level below min value
- try
- {
- TestPlayer.AudioEffect.EqualizerBands = bands;
- } catch(Exception e)
- {
- pass = e.GetType().Name.Equals("ArgumentException");
- }
-
- Assert.True(pass, "Invalid result");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AudioEffect EqualizerBands Level min")]
- [Property("SPEC", "Tizen.Multimedia.AudioEffect.EqualizerBands.Level A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PMIN")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Level_WRITE_MIN()
- {
- // TEST: Write and check equalizer bands min Level
- List<EqualizerBand> bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
- EqualizerBand b = bands.ElementAt(0);
- b.Level = TestPlayer.AudioEffect.MinLevel;
-
- TestPlayer.AudioEffect.EqualizerBands = bands;
-
- bands = TestPlayer.AudioEffect.EqualizerBands.ToList();
-
- Assert.AreEqual(bands.ElementAt(0).Level, TestPlayer.AudioEffect.MinLevel, "Could not set Max value");
-
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using TestFramework;
-using Tizen;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Tizen.Multimedia.FocusStateChangedEventArgs tests")]
- public static class FocusStateChangedEventArgsTests
- {
- private const string LogTag = "TizenTest.Multimedia.FocusStateChangedEventArgs";
- private static bool playbackFlag = false;
-
- [SetUp]
- public static void Init()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test Init");
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test Destroy");
- }
-
- public static void AcquiredFocusCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "**************** state = " + args.FocusState.ToString());
- if(args.FocusState == AudioStreamFocusState.Acquired)
- playbackFlag = true;
- }
-
- public static void ReleasedFocusCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "**************** state = " + args.FocusState.ToString());
- if(args.FocusState == AudioStreamFocusState.Released)
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs FocusState")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.FocusState A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusState_Acquired_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusState read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += AcquiredFocusCallback;
-
- /* TEST CODE
- * Test FocusState property of FocusStateChangedEventArgs"
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= AcquiredFocusCallback;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusState read finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs FocusState")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.FocusState A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusState_Released_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusState read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += ReleasedFocusCallback;
-
- /* TEST CODE
- * Test FocusState property of FocusStateChangedEventArgs"
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
-
- AudioStreamPolicy.PlaybackFocusStateWatch -= ReleasedFocusCallback;
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusState read finished");
- }
-
- public static void MediaFocusStateChangedCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "**************** Media = " + args.FocusChangedReason.ToString());
- if(args.FocusChangedReason == AudioStreamFocusChangedReason.Media)
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusChangedReason_Media_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += MediaFocusStateChangedCallback;
-
- /* TEST CODE
- * Test FocusChangedReason property of FocusStateChangedEventArgs for Media type."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= MediaFocusStateChangedCallback;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read finished");
- }
-
- public static void NotificationFocusStateChangedCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "**************** Media = " + args.FocusChangedReason.ToString());
- if(args.FocusChangedReason == AudioStreamFocusChangedReason.Notification)
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusChangedReason_Notification_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Notification);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += NotificationFocusStateChangedCallback;
-
- /* TEST CODE
- * Test FocusChangedReason property of FocusStateChangedEventArgs for Notification type."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= NotificationFocusStateChangedCallback;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read finished");
- }
-
- public static void AlarmFocusStateChangedCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "**************** Media = " + args.FocusChangedReason.ToString());
- if(args.FocusChangedReason == AudioStreamFocusChangedReason.Alarm)
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusChangedReason_Alarm_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Alarm);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += AlarmFocusStateChangedCallback;
-
- /* TEST CODE
- * Test FocusChangedReason property of FocusStateChangedEventArgs for Alarm type."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= AlarmFocusStateChangedCallback;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read finished");
- }
-
- public static void EmergencyFocusStateChangedCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "**************** Media = " + args.FocusChangedReason.ToString());
- if(args.FocusChangedReason == AudioStreamFocusChangedReason.Emergency)
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusChangedReason_Emergency_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Emergency);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += EmergencyFocusStateChangedCallback;
-
- /* TEST CODE
- * Test FocusChangedReason property of FocusStateChangedEventArgs for Emergency type."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= EmergencyFocusStateChangedCallback;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read finished");
- }
-
- public static void VoipFocusStateChangedCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "**************** Media = " + args.FocusChangedReason.ToString());
- if(args.FocusChangedReason == AudioStreamFocusChangedReason.Voip)
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusChangedReason_Voip_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Voip);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += VoipFocusStateChangedCallback;
-
- /* TEST CODE
- * Test FocusChangedReason property of FocusStateChangedEventArgs for Voip type."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= VoipFocusStateChangedCallback;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read finished");
- }
-
- public static void SystemFocusStateChangedCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "**************** Media = " + args.FocusChangedReason.ToString());
- if(args.FocusChangedReason == AudioStreamFocusChangedReason.System)
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusChangedReason_System_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.System);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += SystemFocusStateChangedCallback;
-
- /* TEST CODE
- * Test FocusChangedReason property of FocusStateChangedEventArgs for System type."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= SystemFocusStateChangedCallback;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read finished");
- }
-
- public static void RingtoneFocusStateChangedCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "**************** Media = " + args.FocusChangedReason.ToString());
- if(args.FocusChangedReason == AudioStreamFocusChangedReason.RingtoneVoip)
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusChangedReason_Ringtone_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.RingtoneVoip);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += RingtoneFocusStateChangedCallback;
-
- /* TEST CODE
- * Test FocusChangedReason property of FocusStateChangedEventArgs for Ringtone voip type."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= RingtoneFocusStateChangedCallback;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read finished");
- }
-
- public static void VoiceInformationFocusStateChangedCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "**************** Media = " + args.FocusChangedReason.ToString());
- if(args.FocusChangedReason == AudioStreamFocusChangedReason.VoiceInformation)
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusChangedReason_VoiceInformation_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.VoiceInformation);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += VoiceInformationFocusStateChangedCallback;
-
- /* TEST CODE
- * Test FocusChangedReason property of FocusStateChangedEventArgs for Voice Information type."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= VoiceInformationFocusStateChangedCallback;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read finished");
- }
-
- public static void VoiceRecognitionFocusStateChangedCallback(object sender, FocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "**************** Media = " + args.FocusChangedReason.ToString());
- if(args.FocusChangedReason == AudioStreamFocusChangedReason.VoiceRecognition)
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusChangedReason_VoiceRecognition_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.VoiceRecognition);
-
- AudioStreamPolicy.RecordingFocusStateWatch += VoiceRecognitionFocusStateChangedCallback;
-
- /* TEST CODE
- * Test FocusChangedReason property of FocusStateChangedEventArgs for Voice Recognition type."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Recording, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.RecordingFocusStateWatch -= VoiceRecognitionFocusStateChangedCallback;
- asp.ReleaseFocus(AudioStreamFocusOptions.Recording, "");
- Log.Info(LogTag, "FocusStateChangedEventArgs Test FocusChangedReason read finished");
- }
-
-
- public static void ExtraInformationCallback(object sender, FocusStateChangedEventArgs args)
- {
- string ret = args.ExtraInformation;
- Log.Info(LogTag, "**************** ret = [" + ret + "]");
- if(ret.Equals("ExtraInfo"))
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("FocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.FocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task ExtraInformation_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "FocusStateChangedEventArgs Test ExtraInformation read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
-
- AudioStreamPolicy.PlaybackFocusStateWatch += ExtraInformationCallback;
-
- /* TEST CODE
- * Test ExtraInformation property of FocusStateChangedEventArgs."
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "ExtraInfo");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackFocusStateWatch CB not called");
- AudioStreamPolicy.PlaybackFocusStateWatch -= ExtraInformationCallback;
- asp.ReleaseFocus(AudioStreamFocusOptions.Playback, "ExtraInfo");
- Log.Info(LogTag, "FocusStateChangedEventArgs Test ExtraInformation read finished");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using TestFramework;
-using Tizen;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.MaxVolumeLevel class")]
- public static class MaxVolumeLevelTests
- {
- private const string LogTag = "TizenTest.Multimedia.MaxVolumeLevel";
-
- [SetUp]
- public static void Init()
- {
- Log.Info(LogTag, "MaxVolumeLevel Test Init");
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "MaxVolumeLevel Test Destroy");
- }
-
- [Test]
- [Category("P1")]
- [Description("MaxVolumeLevel MaxVolumeLevel")]
- [Property("SPEC", "Tizen.Multimedia.MaxVolumeLevel.MaxVolumeLevel C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void MaxVolumeLevel_INIT()
- {
- Log.Info(LogTag, "MaxVolumeLevel Test CONSTR starting");
-
- /* TEST CODE
- * Test MaxVolumeLevel constructor.
- */
- MaxVolumeLevel max = new Tizen.Multimedia.MaxVolumeLevel();
- Assert.IsNotNull(max, "MaxVolumeLevel should not be null");
- Assert.IsInstanceOf<MaxVolumeLevel>(max, "object should be instance of MaxVolumeLevel class");
- Log.Info(LogTag, "MaxVolumeLevel Test CONSTR finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("MaxVolumeLevel Item")]
- [Property("SPEC", "Tizen.Multimedia.MaxVolumeLevel.Item A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void Item_READ()
- {
- Log.Info(LogTag, "MaxVolumeLevel Test Item starting");
- AudioVolume volume = AudioManager.VolumeController;
-
- /* TEST CODE
- * Test the default property of MaxVolumeLevel indexer class.
- */
- foreach(AudioVolumeType type in Enum.GetValues(typeof(AudioVolumeType))) {
- if (type != AudioVolumeType.None)
- {
- object val = volume.MaxLevel[type];
- Assert.IsNotNull(val, "object cannot be null");
- Assert.IsTrue((val is int), "return value should be of type int");
- }
- }
- Log.Info(LogTag, "MaxVolumeLevel Test Item finished");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.MediaBufferSource Tests")]
- public static class MediaBufferSourceTests
- {
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P0")]
- [Description("Test MediaBufferSource Instantiation")]
- [Property("SPEC", "Tizen.Multimedia.MediaBufferSource.MediaBufferSource C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void MediaBufferSource_INIT()
- {
- MediaBufferSource t = new MediaBufferSource(null);
- Assert.IsInstanceOf<MediaBufferSource>(t, "Should return MediaBufferSource instance");
- }
-
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.IO;
-using System.Threading.Tasks;
-using System.Threading;
-
-namespace Tizen.Multimedia.MediaCodec.Tests
-{
-
- [TestFixture]
- [Description("Testing Tizen.Multimedia.MediaCodec.MediaFormat class")]
- public static class MediaCodecTests
- {
- private readonly static MediaFormat SimpleFormat =
- new VideoMediaFormat(MediaFormatVideoMimeType.Mpeg4SP, 640, 480);
-
- private static MediaCodec _codec;
-
- [SetUp]
- public static void SetUp()
- {
- _codec = new MediaCodec();
- }
-
- [TearDown]
- public static void TearDown()
- {
- _codec.Dispose();
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Configure throws if the specified format is null")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.Configure M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Configure_ERROR_IF_FORMAT_NULL()
- {
- AssertHelper.ThrowsExact<ArgumentNullException>(
- () => _codec.Configure(null, true, MediaCodecTypes.Software));
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Configure throws if the specified codecType is invalid")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.Configure M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Configure_ERROR_IF_CODEC_TYPE_INVALID()
- {
- AssertHelper.ThrowsExact<ArgumentException>(
- () => _codec.Configure(SimpleFormat, true, MediaCodecTypes.Software | MediaCodecTypes.Hardware));
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Configure throws if the specified format is invalid")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.Configure M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Configure_ERROR_IF_FORMAT_INVALID()
- {
- MediaFormat format = new ContainerMediaFormat(MediaFormatContainerMimeType.AacAdif);
-
- AssertHelper.ThrowsExact<ArgumentException>(
- () => _codec.Configure(format, true, MediaCodecTypes.Software));
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Configure throws if the specified format is not supported")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.Configure M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Configure_ERROR_IF_FORMAT_NOT_SUPPORTED()
- {
- MediaFormat format = new VideoMediaFormat(MediaFormatVideoMimeType.Argb, 100, 100);
-
- AssertHelper.ThrowsExact<NotSupportedException>(
- () => _codec.Configure(format, true, MediaCodecTypes.Software));
- }
-
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("ProcessInput throws if the specified packet is null")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.Configure M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void ProcessInput_ERROR_IF_PACKET_NULL()
- {
- AssertHelper.ThrowsExact<ArgumentNullException>(() => _codec.ProcessInput(null));
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Prepare throws if not configured")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.Prepare M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Prepare_ERROR_IF_NOT_CONFIGURED()
- {
- AssertHelper.ThrowsExact<InvalidOperationException>(() => _codec.Prepare());
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("GetCodecType throws if the specified type is not supported")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.Prepare M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void GetCodecType_ERROR_IF_NOT_SUPPORTED()
- {
- AssertHelper.ThrowsExact<NotSupportedException>(() =>
- _codec.GetCodecType(true, MediaFormatVideoMimeType.Argb));
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("SupportedAudioCodec has elements")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.SupportedAudioCodec A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void SupportedAudioCodecs_NOT_NULL()
- {
- Assert.NotNull(MediaCodec.SupportedAudioCodecs);
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("SupportedVideoCodec has elements")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.SupportedAudioCodec A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void SupportedVideoCodecs_NOT_NULL()
- {
- Assert.NotNull(MediaCodec.SupportedVideoCodecs);
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Disposed codec")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.Dispose M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Dispose_THROW_FOR_ANY_OPERATIONS()
- {
- _codec.Dispose();
-
- AssertHelper.ThrowsExact<ObjectDisposedException>(() =>
- _codec.Configure(SimpleFormat, true, MediaCodecTypes.Hardware));
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => _codec.Prepare());
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => _codec.ProcessInput(null));
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => _codec.Unprepare());
-
- AssertHelper.ThrowsExact<ObjectDisposedException>(() =>
- _codec.ErrorOccurred += (object s, ErrorOccurredEventArgs e) => { });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() =>
- _codec.EosReached += (object s, EosReachedEventArgs e) => { });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() =>
- _codec.InputProcessed += (object s, InputProcessedEventArgs e) => { });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() =>
- _codec.OutputAvailable += (object s, OutputAvailableEventArgs e) => { });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() =>
- _codec.BufferStatusChanged += (object s, BufferStatusChangedEventArgs e) => { });
-
- AssertHelper.ThrowsExact<ObjectDisposedException>(() =>
- _codec.GetCodecType(true, MediaFormatVideoMimeType.Argb));
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("InputPrcessed event called after ProcessInput called")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.InputProcessed M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.EventListen)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void InputProcessed_CHECK()
- {
- CountdownEvent countdownEvent = new CountdownEvent(Feeder.NumberOfFeed - 2);
-
- _codec.Configure(VideoDecoderFeeder.FORMAT, false, MediaCodecTypes.Software);
-
- _codec.InputProcessed += (object sender, InputProcessedEventArgs e) =>
- {
- e.Packet.Dispose();
- countdownEvent.Signal();
- };
-
- _codec.Prepare();
-
- new VideoDecoderFeeder().Feed(_codec);
-
- countdownEvent.Wait(4000);
-
- _codec.Unprepare();
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("EosReached event called after all buffers are processed")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.EosReached M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.EventListen)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void EosReached_CHECK()
- {
- CountdownEvent countdownEvent = new CountdownEvent(1);
-
- _codec.Configure(VideoDecoderFeeder.FORMAT, false, MediaCodecTypes.Software);
-
- _codec.EosReached += (object sender, EosReachedEventArgs e) => countdownEvent.Signal();
-
- _codec.Prepare();
-
- new VideoDecoderFeeder().Feed(_codec);
-
- countdownEvent.Wait(4000);
-
- _codec.Unprepare();
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("ErrorOccurred event called if processing input is not able")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.ErrorOccurred M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.EventListen)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void ErrorOccurred_CHECK()
- {
- CountdownEvent countdownEvent = new CountdownEvent(Feeder.NumberOfFeed - 2);
-
- _codec.Configure(new VideoMediaFormat(MediaFormatVideoMimeType.Mpeg4SP, 640, 480),
- false, MediaCodecTypes.Software);
-
- _codec.ErrorOccurred += (object sender, ErrorOccurredEventArgs e) => countdownEvent.Signal();
-
- _codec.Prepare();
-
- new VideoDecoderFeeder().Feed(_codec);
-
- countdownEvent.Wait(4000);
-
- _codec.Unprepare();
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("OutputAvailable event called after ProcessInput")]
- [Property("SPEC", "Tizen.Multimedia.Codec.MediaCodec.ProcessInput M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.EventListen)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void OutputAvailable_CHECK()
- {
- CountdownEvent countdownEvent = new CountdownEvent(11);
-
- _codec.Configure(new AudioMediaFormat(MediaFormatAudioMimeType.Aac, 2, 48000, 16, 128),
- true, MediaCodecTypes.Software);
-
- _codec.OutputAvailable += (object sender, OutputAvailableEventArgs e) =>
- {
- e.Packet.Dispose();
- countdownEvent.Signal();
- };
-
- _codec.Prepare();
-
- new AudioEncoderFeeder().Feed(_codec);
-
- Assert.True(countdownEvent.Wait(4000));
-
- _codec.Unprepare();
- }
-
- }
-
- class MediaPacketBufferWriter
- {
- private readonly MediaPacketBuffer _buffer;
- private int _pos;
-
- public MediaPacketBufferWriter(MediaPacketBuffer buffer)
- {
- _buffer = buffer;
- }
-
- public void Write(params byte[] b)
- {
- for (int i = 0; i < b.Length; ++i)
- {
- _buffer[_pos++] = b[i];
- }
- }
-
- public void Fill(byte value, int count)
- {
- for (int i = 0; i < count; ++i)
- {
- _buffer[_pos++] = value;
- }
- }
-
- public int Length
- {
- get
- {
- return _pos;
- }
- }
- }
-
- abstract class Feeder
- {
- public const int NumberOfFeed = 20;
-
- public void Feed(MediaCodec codec)
- {
- int frameCount = 0;
-
- using (Stream file = File.OpenRead(GetFilePath()))
- {
- while (frameCount < NumberOfFeed)
- {
- FeedData(codec, file, frameCount++);
- }
- }
- }
-
- private void FeedData(MediaCodec codec, Stream file, int frameCount)
- {
- MediaPacket packet = CreatePacket(file, frameCount);
-
- if (packet == null)
- {
- return;
- }
-
- codec.ProcessInput(packet);
- }
-
- protected abstract string GetFilePath();
- protected abstract MediaPacket CreatePacket(Stream file, int frameCount);
- }
-
- class AudioEncoderFeeder : Feeder
- {
- public const string FILE_PATH = "/opt/usr/home/owner/share/res/test.pcm";
-
- public static readonly MediaFormat FORMAT =
- new AudioMediaFormat(MediaFormatAudioMimeType.Pcm, 2, 48000, 16, 128000);
-
- protected override MediaPacket CreatePacket(Stream file, int frameCount)
- {
- MediaPacket packet = MediaPacket.Create(FORMAT);
-
- const int readSize = 1024 * 2 * 2;
- byte[] arr = new byte[readSize];
-
- file.Read(arr, 0, readSize);
-
- packet.Buffer.CopyFrom(arr, 0, readSize);
- packet.BufferWrittenLength = readSize;
-
- if (frameCount == 0)
- {
- packet.BufferFlags |= MediaPacketBufferFlags.CodecConfig;
- }
- else if (frameCount == NumberOfFeed - 1)
- {
- packet.BufferFlags |= MediaPacketBufferFlags.EndOfStream;
- }
-
- return packet;
- }
-
- protected override string GetFilePath()
- {
- return FILE_PATH;
- }
- }
-
- class VideoDecoderFeeder : Feeder
- {
- public static readonly MediaFormat FORMAT =
- new VideoMediaFormat(MediaFormatVideoMimeType.H264SP, 1280, 544);
-
- private const string FILE_PATH = "/opt/usr/home/owner/share/res/simpsons.h264";
-
- private const int ES_DEFAULT_VIDEO_PTS_OFFSET = 20000000;
-
- private static ulong _pts;
- private static byte[] _sps;
- private static byte[] _pps;
-
- protected override MediaPacket CreatePacket(Stream file, int frameCount)
- {
- MediaPacket packet = MediaPacket.Create(FORMAT);
-
- packet.Pts = _pts / 1000000;
-
- packet.BufferWrittenLength = Extract(file, packet.Buffer);
-
- if (packet.BufferWrittenLength == 0)
- {
- packet.Dispose();
- return null;
- }
-
- if (frameCount == 2)
- {
- packet.BufferFlags |= MediaPacketBufferFlags.CodecConfig;
- }
- else if (frameCount == NumberOfFeed - 1)
- {
- packet.BufferFlags |= MediaPacketBufferFlags.EndOfStream;
- }
-
- _pts += ES_DEFAULT_VIDEO_PTS_OFFSET;
-
- return packet;
- }
-
-
- private static int Extract(Stream file, MediaPacketBuffer buffer)
- {
- MediaPacketBufferWriter writer = new MediaPacketBufferWriter(buffer);
- int unitType = 0;
-
- while (file.ReadByte() == 0) ;
-
- writer.Write(0, 0, 0, 1);
-
- int zero_count = 0;
-
- bool init = true;
- while (true)
- {
- if (file.Length == file.Position)
- {
- return writer.Length;
- }
-
- int val = file.ReadByte();
- if (val < 0)
- {
- break;
- }
-
- if (init)
- {
- unitType = val & 0xf;
- init = false;
- }
-
- if (val == 0)
- {
- zero_count++;
- }
- else
- {
- if ((zero_count == 2 || zero_count == 3 || zero_count == 4) && val == 1)
- {
- break;
- }
- else
- {
- writer.Fill(0, zero_count);
- writer.Write((byte)val);
- zero_count = 0;
- }
- }
- }
-
- file.Position -= zero_count + 1;
-
- if (unitType == 0x7)
- {
- _sps = new byte[writer.Length];
- buffer.CopyTo(_sps, 0, writer.Length);
- return 0;
- }
- else if (unitType == 0x8)
- {
- _pps = new byte[writer.Length];
- buffer.CopyTo(_pps, 0, writer.Length);
- return 0;
- }
- else if (unitType == 0x5)
- {
- byte[] tmpBuf = new byte[writer.Length];
- buffer.CopyTo(tmpBuf, 0, writer.Length);
- int offset = 0;
- if (_sps != null)
- {
- buffer.CopyFrom(_sps, 0, _sps.Length);
- offset += _sps.Length;
- }
- if (_pps != null)
- {
- buffer.CopyFrom(_pps, 0, _pps.Length, offset);
- offset += _pps.Length;
- }
- buffer.CopyFrom(tmpBuf, 0, writer.Length, offset);
-
- return writer.Length + offset;
- }
-
- return writer.Length;
- }
-
- protected override string GetFilePath()
- {
- return FILE_PATH;
- }
- }
-
-}
+++ /dev/null
-using TestFramework;
-using System;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.MediaFormat class")]
- public static class MediaFormatTests
- {
- #region ContainerMediaFormat tests
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("Create ContainerMediaFormat")]
- [Property("SPEC", "Tizen.Multimedia.ContainerMediaFormat.ContainerMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.Constructor)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void ContainerMediaFormat_PROPERTIES_ARE_SET_BY_CONSTRUCTOR()
- {
- const MediaFormatContainerMimeType mimeType = MediaFormatContainerMimeType.AacAdif;
-
- Assert.AreEqual(new ContainerMediaFormat(mimeType).MimeType, mimeType);
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Throw if the specified mime type is invalid")]
- [Property("SPEC", "Tizen.Multimedia.ContainerMediaFormat.ContainerMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.Constructor)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void ContainerMediaFormat_CONSTRUCTION_INVALID_MIME_TYPE()
- {
- MediaFormatContainerMimeType mimeType = 0;
- while (Enum.IsDefined(typeof(MediaFormatContainerMimeType), mimeType))
- {
- ++mimeType;
- }
-
- AssertHelper.ThrowsExact<ArgumentException>(() => new ContainerMediaFormat(mimeType));
- }
-
- #endregion
-
- #region VideoMediaFormat tests
-
- private const int VALID_VIDEO_WIDTH = 10;
- private const int VALID_VIDEO_HEIGHT = 20;
- private const int VALID_VIDEO_FRAME_RATE = 30;
- private const int VALID_VIDEO_BIT_RATE = 40;
-
- private const int INVALID_VIDEO_WIDTH = -1;
- private const int INVALID_VIDEO_HEIGHT = -2;
- private const int INVALID_VIDEO_FRAME_RATE = -3;
- private const int INVALID_VIDEO_BIT_RATE = -4;
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("Create VideoMediaFormat")]
- [Property("SPEC", "Tizen.Multimedia.VideoMediaFormat.VideoMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.Constructor)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void VideoMediaFormat_PROPERTIES_ARE_SET_BY_CONSTRUCTOR()
- {
- const MediaFormatVideoMimeType mimeType = MediaFormatVideoMimeType.Argb;
-
- var videoFormat = new VideoMediaFormat(mimeType, VALID_VIDEO_WIDTH,
- VALID_VIDEO_HEIGHT, VALID_VIDEO_FRAME_RATE, VALID_VIDEO_BIT_RATE);
-
- Assert.AreEqual(mimeType, videoFormat.MimeType);
- Assert.AreEqual(VALID_VIDEO_WIDTH, videoFormat.Width);
- Assert.AreEqual(VALID_VIDEO_HEIGHT, videoFormat.Height);
- Assert.AreEqual(VALID_VIDEO_FRAME_RATE, videoFormat.FrameRate);
- Assert.AreEqual(VALID_VIDEO_BIT_RATE, videoFormat.BitRate);
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Throw if the specified mime type is invalid")]
- [Property("SPEC", "Tizen.Multimedia.VideoMediaFormat.VideoMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.Constructor)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void VideoMediaFormat_CONSTRUCTION_INVALID_MIME_TYPE()
- {
- MediaFormatVideoMimeType mimeType = 0;
- while (Enum.IsDefined(typeof(MediaFormatVideoMimeType), mimeType))
- {
- ++mimeType;
- }
-
- AssertHelper.ThrowsExact<ArgumentException>(
- () => new VideoMediaFormat(mimeType, VALID_VIDEO_WIDTH, VALID_VIDEO_HEIGHT));
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Throw if one of the specified parameters is invalid")]
- [Property("SPEC", "Tizen.Multimedia.VideoMediaFormat.VideoMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.Constructor)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void VideoMediaFormat_CONSTRUCTION_INVALID_VALUE()
- {
- const MediaFormatVideoMimeType mimeType = MediaFormatVideoMimeType.Argb;
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => new VideoMediaFormat(
- width: INVALID_VIDEO_WIDTH,
- mimeType: mimeType,
- height: VALID_VIDEO_HEIGHT));
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => new VideoMediaFormat(
- height: INVALID_VIDEO_HEIGHT,
- mimeType: mimeType,
- width: VALID_VIDEO_WIDTH));
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => new VideoMediaFormat(
- frameRate: INVALID_VIDEO_FRAME_RATE,
- mimeType: mimeType,
- width: VALID_VIDEO_WIDTH,
- height: VALID_VIDEO_HEIGHT));
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => new VideoMediaFormat(
- bitRate: INVALID_VIDEO_BIT_RATE,
- mimeType: mimeType,
- width: VALID_VIDEO_WIDTH,
- height: VALID_VIDEO_HEIGHT,
- frameRate: VALID_VIDEO_FRAME_RATE));
- }
-
- #endregion
-
- #region AudioMediaFormat tests
-
- private const int VALID_AUDIO_CHANNEL = 11;
- private const int VALID_AUDIO_SAMPLE_RATE = 21;
- private const int VALID_AUDIO_BIT = 31;
- private const int VALID_AUDIO_BIT_RATE = 41;
-
- private const int INVALID_AUDIO_CHANNEL = -1;
- private const int INVALID_AUDIO_SAMPLE_RATE = -2;
- private const int INVALID_AUDIO_BIT = -3;
- private const int INVALID_AUDIO_BIT_RATE = -4;
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("Create AudioMediaFormat")]
- [Property("SPEC", "Tizen.Multimedia.AudioMediaFormat.AudioMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void AudioMediaFormat_PROPERTIES_ARE_SET_BY_CONSTRUCTOR()
- {
- const MediaFormatAudioMimeType mimeType = MediaFormatAudioMimeType.Aac;
-
- var audioFormat = new AudioMediaFormat(mimeType, VALID_AUDIO_CHANNEL,
- VALID_AUDIO_SAMPLE_RATE, VALID_AUDIO_BIT, VALID_AUDIO_BIT_RATE);
-
- Assert.AreEqual(mimeType, audioFormat.MimeType);
- Assert.AreEqual(VALID_AUDIO_CHANNEL, audioFormat.Channel);
- Assert.AreEqual(VALID_AUDIO_SAMPLE_RATE, audioFormat.SampleRate);
- Assert.AreEqual(VALID_AUDIO_BIT, audioFormat.Bit);
- Assert.AreEqual(VALID_AUDIO_BIT_RATE, audioFormat.BitRate);
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Throw if the specified mime type is invalid")]
- [Property("SPEC", "Tizen.Multimedia.AudioMediaFormat.AudioMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.Constructor)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void AudioMediaFormat_CONSTRUCTION_INVALID_MIME_TYPE()
- {
- MediaFormatAudioMimeType mimeType = 0;
- while (Enum.IsDefined(typeof(MediaFormatAudioMimeType), mimeType))
- {
- ++mimeType;
- }
-
- AssertHelper.ThrowsExact<ArgumentException>(
- () => new AudioMediaFormat(mimeType, VALID_AUDIO_CHANNEL,
- VALID_AUDIO_SAMPLE_RATE, VALID_AUDIO_BIT, VALID_AUDIO_BIT_RATE));
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Throw if one of the specified parameters is invalid")]
- [Property("SPEC", "Tizen.Multimedia.AudioMediaFormat.AudioMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.Constructor)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void AudioMediaFormat_CONSTRUCTION_INVALID_VALUE()
- {
- const MediaFormatAudioMimeType mimeType = MediaFormatAudioMimeType.Aac;
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => new AudioMediaFormat(
- channel: INVALID_AUDIO_CHANNEL,
- mimeType: mimeType,
- sampleRate: VALID_AUDIO_SAMPLE_RATE,
- bit: VALID_AUDIO_BIT,
- bitRate: VALID_AUDIO_BIT_RATE));
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => new AudioMediaFormat(
- sampleRate: INVALID_AUDIO_SAMPLE_RATE,
- mimeType: mimeType,
- channel: VALID_AUDIO_CHANNEL,
- bit: VALID_AUDIO_BIT,
- bitRate: VALID_AUDIO_BIT_RATE));
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => new AudioMediaFormat(
- bit: INVALID_AUDIO_BIT,
- mimeType: mimeType,
- channel: VALID_AUDIO_CHANNEL,
- sampleRate: VALID_AUDIO_SAMPLE_RATE,
- bitRate: VALID_AUDIO_BIT_RATE));
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => new AudioMediaFormat(
- bitRate: INVALID_AUDIO_BIT_RATE,
- mimeType: mimeType,
- sampleRate: VALID_AUDIO_SAMPLE_RATE,
- bit: VALID_AUDIO_BIT,
- channel: VALID_AUDIO_CHANNEL));
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Throw if the specified aac type is not none but the mime type is a aac type")]
- [Property("SPEC", "Tizen.Multimedia.AudioMediaFormat.AudioMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.Constructor)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void AudioMediaFormat_CONSTRUCTION_THROW_IF_AAC_SPECIFIED_WITH_NOT_AAC_MIME_TYPE()
- {
- AssertHelper.ThrowsExact<ArgumentException>(
- () => new AudioMediaFormat(MediaFormatAudioMimeType.Flac, VALID_AUDIO_CHANNEL,
- VALID_AUDIO_SAMPLE_RATE, VALID_AUDIO_BIT, VALID_AUDIO_BIT_RATE,
- MediaFormatAacType.Adif));
- }
-
- #endregion
-
- #region TextMediaFormat tests
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("Create TextMediaFormat")]
- [Property("SPEC", "Tizen.Multimedia.TextMediaFormat.TextMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.Constructor)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void TextMediaFormat_PROPERTIES_ARE_SET_BY_CONSTRUCTOR()
- {
- const MediaFormatTextMimeType mimeType = MediaFormatTextMimeType.MP4;
- const MediaFormatTextType textType = MediaFormatTextType.Mp4;
-
- var textFormat = new TextMediaFormat(mimeType, textType);
-
- Assert.AreEqual(mimeType, textFormat.MimeType);
- Assert.AreEqual(textType, textFormat.TextType);
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Throw if the specified mime type is invalid")]
- [Property("SPEC", "Tizen.Multimedia.TextMediaFormat.TextMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.Constructor)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void TextMediaFormat_CONSTRUCTION_INVALID_MIME_TYPE()
- {
- MediaFormatTextMimeType mimeType = 0;
- while (Enum.IsDefined(typeof(MediaFormatTextMimeType), mimeType))
- {
- ++mimeType;
- }
-
- AssertHelper.ThrowsExact<ArgumentException>(
- () => new TextMediaFormat(mimeType, MediaFormatTextType.Mp4));
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Throw if the specified text type is invalid")]
- [Property("SPEC", "Tizen.Multimedia.TextMediaFormat.TextMediaFormat C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.Constructor)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void TextMediaFormat_CONSTRUCTION_INVALID_TEXT_TYPE()
- {
- MediaFormatTextType textType = 0;
- while (Enum.IsDefined(typeof(MediaFormatTextType), textType))
- {
- ++textType;
- }
-
- AssertHelper.ThrowsExact<ArgumentException>(
- () => new TextMediaFormat(MediaFormatTextMimeType.ThreeGP, textType));
- }
-
- #endregion
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.MediaPacket class")]
- public static class MediaPacketTests
- {
- private static readonly MediaFormat SimpleFormat =
- new AudioMediaFormat(MediaFormatAudioMimeType.Aac, 1, 2, 3, 4);
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Throw a parameter is null when creating MediaPacket")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.Create M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void MediaPacket_NULL_MEDIA_FORMAT()
- {
- AssertHelper.ThrowsExact<ArgumentNullException>(
- () => MediaPacket.Create(null));
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Throw if the specified format is a container type")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.Create M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void MediaPacket_INVALID_MEDIA_FORMAT()
- {
- MediaFormat format =
- new ContainerMediaFormat(MediaFormatContainerMimeType.AacAdif);
-
- AssertHelper.ThrowsExact<ArgumentException>(() => MediaPacket.Create(format));
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("MediaFormat is the format passed to the constructor")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.Format A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void MediaFormat_IS_PASSED_TO_CONSTRUCTOR()
- {
- using (MediaPacket packet = MediaPacket.Create(SimpleFormat))
- {
- Assert.AreEqual(SimpleFormat, packet.Format);
- }
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Disposed object is not usable")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.Dispose M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Dispose_DISPOSED_OBJECT()
- {
- MediaPacket packet = MediaPacket.Create(SimpleFormat);
- packet.Dispose();
-
- #region Read operations
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => { var v = packet.Format; });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => { var v = packet.Pts; });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => { var v = packet.Dts; });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => { var v = packet.IsEncoded; });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => { var v = packet.Buffer; });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => { var v = packet.BufferWrittenLength; });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => { var v = packet.VideoPlanes; });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => { var v = packet.BufferFlags; });
- #endregion
-
- #region Write operations
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => { packet.Pts = 1; });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => { packet.Dts = 1; });
- AssertHelper.ThrowsExact<ObjectDisposedException>(() => { packet.BufferFlags = MediaPacketBufferFlags.CodecConfig; });
- #endregion
- }
-
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("IsDisposed returns false before the object disposed")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.IsDisposed A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyCheckStatus)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void IsDisposed_RETURNS_FALSE_BEFORE_OBJECT_DISPOSED()
- {
- MediaPacket packet = MediaPacket.Create(SimpleFormat);
-
- Assert.AreEqual(false, packet.IsDisposed);
-
- packet.Dispose();
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("IsDisposed returns true after the object disposed")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.IsDisposed A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyCheckStatus)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void IsDisposed_RETURNS_TRUE_AFTER_OBJECT_DISPOSED()
- {
- MediaPacket packet = MediaPacket.Create(SimpleFormat);
- packet.Dispose();
-
- Assert.AreEqual(true, packet.IsDisposed);
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("Default Pts value is zero")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.Pts A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Pts_DEFAULT_VALUE()
- {
- using (MediaPacket packet = MediaPacket.Create(SimpleFormat))
- {
- Assert.AreEqual(0u, packet.Pts);
- }
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("Pts value can be set")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.Pts A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyCheckStatus)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Pts_VALUE()
- {
- ulong value = 1;
- using (MediaPacket packet = MediaPacket.Create(SimpleFormat))
- {
- packet.Pts = value;
- Assert.AreEqual(value, packet.Pts);
- }
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("Default Dts value is zero")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.Dts A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Dts_DEFAULT_VALUE()
- {
- using (MediaPacket packet = MediaPacket.Create(SimpleFormat))
- {
- Assert.AreEqual(0u, packet.Dts);
- }
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("Dts value can be set")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.Dts A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyCheckStatus)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Dts_SET_VALUE()
- {
- ulong value = 1;
- using (MediaPacket packet = MediaPacket.Create(SimpleFormat))
- {
- packet.Dts = value;
- Assert.AreEqual(value, packet.Dts);
- }
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("IsEncoded returns a value indicating whether the packet is encoded type")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.IsEncoded A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void IsEncoded_DEPENDS_ON_FORMAT()
- {
- using (MediaPacket packet =
- MediaPacket.Create(new AudioMediaFormat(MediaFormatAudioMimeType.Aac, 1, 1, 1, 1)))
- {
- Assert.True(packet.IsEncoded);
- }
-
- using (MediaPacket packet =
- MediaPacket.Create(new VideoMediaFormat(MediaFormatVideoMimeType.Bgra, 1, 1)))
- {
- Assert.False(packet.IsEncoded);
- }
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Buffer is supported if and if only the packet is raw video format")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.Buffer A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Buffer_RETURNS_NULL_FOR_RAW_VIDEO_FORMAT()
- {
- using (MediaPacket packet =
- MediaPacket.Create(new VideoMediaFormat(MediaFormatVideoMimeType.Bgra, 1, 1)))
- {
- Assert.IsNull(packet.Buffer);
- }
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("Buffer is supported if and if only the packet is raw video format")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.Buffer A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Buffer_RETURNS_NOT_NULL_FOR_NONE_RAW_VIDEO_FORMAT()
- {
- using (MediaPacket packet =
- MediaPacket.Create(new AudioMediaFormat(MediaFormatAudioMimeType.Aac, 1, 1, 1, 1)))
- {
- Assert.IsNotNull(packet.Buffer);
- }
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("BufferWrittenLength is supported if and if only the packet is raw video format")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.BufferWrittenLength A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void BufferWrittenLength_THROWS_IF_RAW_VIDEO_FORMAT()
- {
- using (MediaPacket packet =
- MediaPacket.Create(new VideoMediaFormat(MediaFormatVideoMimeType.Bgra, 1, 1)))
- {
- AssertHelper.ThrowsExact<InvalidOperationException>(() => packet.BufferWrittenLength = 2);
- }
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("BufferWrittenLength is supported if and if only the packet is raw video format")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.BufferWrittenLength A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyAboveMax)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void BufferWrittenLength_MAX_VALUE()
- {
- using (MediaPacket packet =
- MediaPacket.Create(new AudioMediaFormat(MediaFormatAudioMimeType.Aac, 1, 1, 1, 1)))
- {
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => { packet.BufferWrittenLength = packet.Buffer.Length; });
- }
- }
-
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("VideoPlanes is supported when the packet is not raw video format")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.VidepPlanes A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void VideoPlanes_RETURNS_NULL_NONE_FOR_RAW_VIDEO_FORMAT()
- {
- using (MediaPacket packet =
- MediaPacket.Create(new AudioMediaFormat(MediaFormatAudioMimeType.Aac, 1, 1, 1, 1)))
- {
- Assert.IsNull(packet.VideoPlanes);
- }
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("VideoPlanes is supported when the packet is not raw video format")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.VideoPlanes A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Buffer_RETURNS_NOT_NULL_FOR_RAW_VIDEO_FORMAT()
- {
- using (MediaPacket packet =
- MediaPacket.Create(new VideoMediaFormat(MediaFormatVideoMimeType.Argb, 1, 1)))
- {
- Assert.IsNotNull(packet.VideoPlanes);
- }
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("BufferFlags default value is zero")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.BufferFlags A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void BufferFlags_DEFAULT_VALUE()
- {
- using (MediaPacket packet = MediaPacket.Create(SimpleFormat))
- {
- Assert.AreEqual((MediaPacketBufferFlags)0, packet.BufferFlags);
- }
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("BufferFlags can be set")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacket.BufferFlags A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyCheckStatus)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void BufferFlags_SET()
- {
- using (MediaPacket packet = MediaPacket.Create(SimpleFormat))
- {
- MediaPacketBufferFlags flags = MediaPacketBufferFlags.CodecConfig | MediaPacketBufferFlags.EndOfStream;
- packet.BufferFlags = flags;
- Assert.AreEqual(flags, packet.BufferFlags);
- }
- }
- }
-}
+++ /dev/null
-using System;
-using TestFramework;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.MediaPacketBuffer class")]
- public static class MediaPacketBufferTests
- {
- private static MediaPacket _packet;
- private static MediaPacketBuffer _buffer;
-
- [SetUp]
- public static void SetUp()
- {
- _packet = MediaPacket.Create(
- new AudioMediaFormat(MediaFormatAudioMimeType.Pcm, 2, 48000, 16, 128000));
-
- _buffer = _packet.Buffer;
- }
-
- [TearDown]
- public static void TearDown()
- {
- _packet.Dispose();
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Indexer throws if range is not valid")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacketBuffer.this[] A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyDefaultValue)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Indexer_NOT_VALID_INDEX()
- {
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(() => { byte b = _buffer[-1]; });
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(() => { byte b = _buffer[_buffer.Length]; });
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("Indexer sets a value in the buffer")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacketBuffer.this[] A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.PropertyCheckStatus)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Indexer_SET_VALUE()
- {
- const byte value = 4;
-
- _buffer[2] = value;
-
- Assert.AreEqual(value, _buffer[2]);
- }
-
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("CopyFrom copies data from an array")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacketBuffer.CopyFrom M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodReturn)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void CopyFrom_COPYING_DATA()
- {
- byte[] tempBuf = new byte[100];
- for (int i = 0; i < tempBuf.Length; ++i)
- {
- tempBuf[i] = (byte)(tempBuf.Length - i);
- }
-
- int offset = 1;
- _buffer.CopyFrom(tempBuf, 0, tempBuf.Length - offset, offset);
-
- Assert.AreEqual(tempBuf[0], _buffer[offset]);
- Assert.AreEqual(tempBuf[1], _buffer[offset + 1]);
- }
-
- [Test]
- [Category(TestCategories.Normal)]
- [Description("CopyTo copies data to an array")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacketBuffer.CopyTo M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodCheckStatus)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void CopyTo_COPYING_DATA()
- {
- int offset = 3;
- byte[] arr = new byte[2] { 23, 244 };
- _buffer.CopyTo(arr, 0, arr.Length, offset);
-
- Assert.AreEqual(arr[0], _buffer[offset]);
- Assert.AreEqual(arr[1], _buffer[offset + 1]);
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("CopyFrom throws if range is not valid")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacketBuffer.CopyFrom M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void CopyFrom_NOT_VALID_INDEX()
- {
- byte[] arr = new byte[2];
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => { _buffer.CopyFrom(arr, -1, 0); });
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => { _buffer.CopyFrom(arr, 0, -1); });
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => { _buffer.CopyFrom(arr, 0, 1, -1); });
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => { _buffer.CopyFrom(arr, 0, _buffer.Length, 1); });
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => { _buffer.CopyFrom(arr, 1, arr.Length, 1); });
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("CopyTo throws if range is not valid")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacketBuffer.CopyTo M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void CopyTo_NOT_VALID_INDEX()
- {
- byte[] arr = new byte[2];
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => { _buffer.CopyTo(arr, -1, 0); });
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => { _buffer.CopyTo(arr, 0, -1); });
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => { _buffer.CopyTo(arr, 0, 1, -1); });
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => { _buffer.CopyTo(arr, 0, _buffer.Length, 1); });
-
- AssertHelper.ThrowsExact<ArgumentOutOfRangeException>(
- () => { _buffer.CopyTo(arr, 1, arr.Length, 1); });
- }
-
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Any operation throws if the MediaPacket that owns the buffer has been disposed of")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacketBuffer M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Disposed()
- {
- _packet.Dispose();
-
- AssertHelper.ThrowsExact<ObjectDisposedException>(
- () => { _buffer.CopyTo(new byte[] { 1 }, 0, 0); });
-
- AssertHelper.ThrowsExact<ObjectDisposedException>(
- () => _buffer.CopyFrom(new byte[] { 1 }, 0, 0));
-
- AssertHelper.ThrowsExact<ObjectDisposedException>(
- () => { var a = _buffer.Length; });
-
- AssertHelper.ThrowsExact<ObjectDisposedException>(
- () => { var v = _buffer[0]; });
-
- AssertHelper.ThrowsExact<ObjectDisposedException>(
- () => { _buffer[0] = 1; });
- }
- }
-}
+++ /dev/null
-using System;
-using TestFramework;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.MediaPacketVideoPlane class")]
- public static class MediaPacketVideoPlaneTests
- {
- [Test]
- [Category(TestCategories.Negative)]
- [Description("Any operation throws if the MediaPacket that owns the buffer has been disposed of")]
- [Property("SPEC", "Tizen.Multimedia.MediaPacketVideoPlane M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", TestCriteria.MethodException)]
- [Property("AUTHOR", "JungHo Kim, jhyo.kim@samsung.com")]
- public static void Disposed()
- {
- MediaPacket packet = MediaPacket.Create(
- new VideoMediaFormat(MediaFormatVideoMimeType.I420, 352, 288));
-
- var videoPlane = packet.VideoPlanes[0];
-
- packet.Dispose();
-
- AssertHelper.ThrowsExact<ObjectDisposedException>(
- () => { var buf = videoPlane.Buffer; });
-
- AssertHelper.ThrowsExact<ObjectDisposedException>(
- () => { var width = videoPlane.StrideWidth; });
-
- AssertHelper.ThrowsExact<ObjectDisposedException>(
- () => { var height = videoPlane.StrideHeight; });
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.MediaSource Tests")]
- public static class MediaSourceTests
- {
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P0")]
- [Description("Test MediaSource class")]
- [Property("SPEC", "Tizen.Multimedia.MediaSource.MediaSource C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void MediaSource_INIT()
- {
- // This is abstract class without any methods or properties
- Assert.True(true, "Abstract class");
- }
-
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Tizen.Multimedia.MediaStreamConfiguration Tests")]
- public static class MediaStreamConfigurationTests
- {
- static private Player TestPlayer;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test MediaStreamConfiguration BufferMaxSize")]
- [Property("SPEC", "Tizen.Multimedia.MediaStreamConfiguration.BufferMaxSize A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void BufferMaxSize_READ_WRITE()
- {
- // PRECONDITION: Set media stream source to player
- MediaSource src = new MediaStreamSource();
- TestPlayer.SetSource(src);
-
- // TEST: Set and check BufferMaxSize property
- ((MediaStreamSource)src).AudioConfiguration.BufferMaxSize = 5000;
- Assert.AreEqual((int)((MediaStreamSource)src).AudioConfiguration.BufferMaxSize, 5000, "Incorrect BufferMaxSize");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test MediaStreamConfiguration BufferMaxSize")]
- [Property("SPEC", "Tizen.Multimedia.MediaStreamConfiguration.BufferMaxSize A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void BufferMaxSize_CHECK_BUFFERING_STATUS()
- {
- // PRECONDITION: Set media stream source to player
- MediaSource src = new MediaStreamSource();
- TestPlayer.SetSource(src);
-
- // TEST: Set and check BufferMaxSize property and check buffering status event
- ((MediaStreamSource)src).AudioConfiguration.BufferMaxSize = 5000;
-
- Assert.True(false, "[NA] Trigger buffering status events, after discussion with FW team");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test MediaStreamConfiguration BufferMinThreshold")]
- [Property("SPEC", "Tizen.Multimedia.MediaStreamSource.BufferMinThreshold A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void BufferMinThreshold_READ_WRITE()
- {
- // PRECONDITION: Set media stream source to player
- MediaSource src = new MediaStreamSource();
- TestPlayer.SetSource(src);
-
- // TEST: Set and check BufferMinThreshold property
- ((MediaStreamSource)src).AudioConfiguration.BufferMinThreshold = 60;
- Assert.AreEqual((int)((MediaStreamSource)src).AudioConfiguration.BufferMinThreshold, 60, "Incorrect BufferMinThreshold");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test MediaStreamConfiguration BufferMinThreshold")]
- [Property("SPEC", "Tizen.Multimedia.MediaStreamSource.BufferMinThreshold A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void BufferMinThreshold_CHECK_BUFFERING_STATUS()
- {
- // PRECONDITION: Set media stream source to player
- MediaSource src = new MediaStreamSource();
- TestPlayer.SetSource(src);
-
- // TEST: Set and check BufferMinThreshold property and check buffering status
- ((MediaStreamSource)src).AudioConfiguration.BufferMinThreshold = 60;
-
- Assert.True(false, "[NA] Trigger buffering status events, discussing with FW team");
- }
-
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.MediaStreamSource tests")]
- public static class MediaStreamSourceTests
- {
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P0")]
- [Description("Test MediaStreamSource instantiation")]
- [Property("SPEC", "Tizen.Multimedia.MediaStreamSource.MediaStreamSource C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void MediaStreamSource_INIT()
- {
- MediaSource src = new MediaStreamSource();
- Assert.IsInstanceOf<MediaStreamSource>(src, "Should return MediaStreamSource instance");
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test MediaStreamSource AudioConfiguration")]
- [Property("SPEC", "Tizen.Multimedia.MediaStreamSource.AudioConfiguration A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void AudioConfiguration_PROPERTY_READ_ONLY()
- {
- //TODO: Fill this when MediaFormat is implemented
- Assert.True(false, "[NA] MediaFormat class not available yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test MediaStreamSource VideoConfiguration")]
- [Property("SPEC", "Tizen.Multimedia.MediaStreamSource.VideoConfiguration A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void VideoConfiguration_PROPERTY_READ_ONLY()
- {
- //TODO: Fill this when MediaFormat is implemented
- Assert.True(false, "[NA] MediaFormat class not available yet");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.MediaUriSource tests")]
- public static class MediaUriSourceTests
- {
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test MediaUriSource instantiation")]
- [Property("SPEC", "Tizen.Multimedia.MediaUriSource.MediaUriSource C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void MediaUriSource_INIT()
- {
- // TEST: Instantiate MediaUriSource object and check
- MediaSource src = new MediaUriSource("");
- Assert.IsInstanceOf<MediaUriSource>(src, "Should return MediaUriSource instance");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.IO;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.MetadataExtractor class")]
- public static class MetadataExtractorTests
- {
- public const string LogTag = "TizenTest.Multimedia.MetadataExtractor";
- private static MetadataExtractor _metadataExtractor;
- private static String mediaPath = "/opt/usr/home/owner/share/res/test_meta.mp4";
- private static String mediaPathForArtwork = "/opt/usr/home/owner/share/res/test_meta.mp3";
-
- [SetUp]
- public static void Init()
- {
- Log.Info(LogTag, "MetadataExtractor Test Init");
- _metadataExtractor = new MetadataExtractor(mediaPath);
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "MetadataExtractor Test Destroy");
- }
-
- [Test]
- [Category("P1")]
- [Description("Create Metadata instance with media path parameter")]
- [Property("SPEC", "Tizen.Multimedia.MetadataExtractor.MetadataExtractor C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Minje Ahn, minje.ahn@samsung.com")]
- public static void MetadataExtractor_CHECK_CREATE_CONSTRUCTOR_WITH_PATH()
- {
- MetadataExtractor testConstructor;
-
- testConstructor = new MetadataExtractor(mediaPath);
- Assert.IsNotNull(testConstructor, "The object should not be Null");
- Assert.IsInstanceOf<MetadataExtractor>(testConstructor, "The object should be of MetadataExtractor");
- }
-
- [Test]
- [Category("P2")]
- [Description("Try to create Metadata instance with Nonexistent path parameter and check returned error type")]
- [Property("SPEC", "Tizen.Multimedia.MetadataExtractor.MetadataExtractor C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Minje Ahn, minje.ahn@samsung.com")]
- public static void MetadataExtractor_CHECK_CREATE_CONSTRUCTOR_WITH_NONEXISTENT_PATH()
- {
- MetadataExtractor testConstructor;
- try
- {
- testConstructor = new MetadataExtractor("/opt/usr/home/owner/share/res/no_exists.mp4");
- }
- catch (Exception ex)
- {
- Assert.IsTrue(ex.GetType().Name.Equals("InvalidOperationException"), "Returned error type should be [InvalidOperationException]");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Create Metadata instance with media buffer parameter")]
- [Property("SPEC", "Tizen.Multimedia.MetadataExtractor.MetadataExtractor C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Minje Ahn, minje.ahn@samsung.com")]
- public static void MetadataExtractor_CHECK_CREATE_CONSTRUCTOR_WITH_BUFFER()
- {
- MetadataExtractor testConstructor;
- byte[] readMediaBuffer;
-
- using (var fs = File.Open(mediaPath, FileMode.Open))
- {
- readMediaBuffer = new byte[fs.Length];
- fs.Read(readMediaBuffer, 0, (int)fs.Length);
- }
-
- testConstructor = new MetadataExtractor(readMediaBuffer);
- Assert.IsNotNull(testConstructor, "The object should not be Null");
- Assert.IsInstanceOf<MetadataExtractor>(testConstructor, "The object should be of MetadataExtractor");
- }
-
- [Test]
- [Category("P1")]
- [Description("Get Metadata information and compare with real data in file")]
- [Property("SPEC", "Tizen.Multimedia.MetadataExtractor.Metadata M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Minje Ahn, minje.ahn@samsung.com")]
- public static void GetMetadata_CHECK_RETURNED_METADATA()
- {
- Metadata _metadata;
- Log.Info(LogTag, "MetadataExtractor Test Metadata starting");
- _metadata = _metadataExtractor.GetMetadata();
-
- Assert.AreEqual(_metadata.Duration, "11883", "Get Duration test failed");
- Assert.AreEqual(_metadata.VideoBitrate, "909428", "Get VideoBitrate test failed");
- Assert.AreEqual(_metadata.VideoFPS, "30", "Get VideoFPS test failed");
- Assert.AreEqual(_metadata.VideoWidth, "320", "Get VideoWidth test failed");
- Assert.AreEqual(_metadata.VideoHeight, "240", "Get VideoHeight test failed");
- Assert.AreEqual(_metadata.AudioBitrate, "44512", "Get AudioBitrate test failed");
- Assert.AreEqual(_metadata.AudioChannels, "2", "Get AudioChannels test failed");
- Assert.AreEqual(_metadata.AudioSamplerate, "48000", "Get AudioSamplerate test failed");
- Assert.AreEqual(_metadata.AudioBitPerSample, "16", "Get Audiobitpersample test failed");
- Assert.AreEqual(_metadata.Artist, "Test", "Get Artist test failed");
- Assert.AreEqual(_metadata.Title, "Test", "Get Title test failed");
- Assert.AreEqual(_metadata.Album, "Test", "Get Album test failed");
- Assert.AreEqual(_metadata.Genre, "Test", "Get Genre test failed");
- Assert.AreEqual(_metadata.Author, "Test", "Get Author test failed");
- Assert.AreEqual(_metadata.Copyright, "Test", "Get Copyright test failed");
- Assert.AreEqual(_metadata.Date, "2001-1-1", "Get Date test failed");
- Assert.AreEqual(_metadata.Description, "Test", "Get Description test failed");
- Assert.AreEqual(_metadata.Comment, "Test", "Get Comment test failed");
- Assert.AreEqual(_metadata.TrackNumber, "1/31144", "Get Tracknumber test failed");
- Assert.AreEqual(_metadata.Longitude, "0.000000", "Get Longitude test failed");
- Assert.AreEqual(_metadata.Latitude, "0.000000", "Get Latitude test failed");
- Assert.AreEqual(_metadata.Altitude, "0.000000", "Get Altitude test failed");
- Assert.AreEqual(_metadata.SyncLyricNumber, "0", "Get SyncLyricNumber test failed");
- Assert.AreEqual(_metadata.RecordingDate, "2014-01-01 09:01:11", "Get Recordingdate test failed");
- Assert.AreEqual(_metadata.Rotate, "90", "Get Rotate test failed");
- Assert.AreEqual(_metadata.VideoCodec, "MPEG4", "Get VideoCodec test failed");
- Assert.AreEqual(_metadata.AudioCodec, "AAC", "Get AudioCodec test failed");
- Assert.AreEqual(_metadata.Content360, "0", "Get content360 test failed");
-
- Log.Info(LogTag, "MetadataExtractor Test Metadata finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Get Artwork information and check existence")]
- [Property("SPEC", "Tizen.Multimedia.MetadataExtractor.Artwork M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Minje Ahn, minje.ahn@samsung.com")]
- public static void GetArtwork_CHECK_RETURNED_ARTWORK()
- {
- MetadataExtractor testConstructor;
- Artwork _artwork;
-
- testConstructor = new MetadataExtractor(mediaPathForArtwork);
- Assert.IsInstanceOf<MetadataExtractor>(testConstructor, "The object should be of MetadataExtractor");
-
- Log.Info(LogTag, "MetadataExtractor Test Artwork starting");
- _artwork = testConstructor.GetArtwork();
-
- Assert.IsNotNull(_artwork.ArtworkData, "Get artworkData test failed");
- Log.Info(LogTag, "MetadataExtractor Test Artwork finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Get Frame data and check created frame")]
- [Property("SPEC", "Tizen.Multimedia.MetadataExtractor.Frame M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Minje Ahn, minje.ahn@samsung.com")]
- public static void GetFrame_CHECK_RETURNED_FRAME()
- {
- Frame _frame;
- Log.Info(LogTag, "MetadataExtractor Test Frame starting");
- _frame = _metadataExtractor.GetFrame();
-
- Assert.IsNotNull(_frame.FrameData, "Get FrameData test failed");
- Log.Info(LogTag, "MetadataExtractor Test Frame finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Get Frame data of specified time and check created frame")]
- [Property("SPEC", "Tizen.Multimedia.MetadataExtractor.FrameAtTime M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Minje Ahn, minje.ahn@samsung.com")]
- public static void GetFrameAtTime_CHECK_RETURNED_FRAMEATTIME()
- {
- Frame _frame;
- Log.Info(LogTag, "MetadataExtractor Test FrameAtTime starting");
- _frame = _metadataExtractor.GetFrameAtTime(1, true);
-
- Assert.IsNotNull(_frame.FrameData, "Get FrameData test failed");
- Log.Info(LogTag, "MetadataExtractor Test FrameAtTime finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Get Synchronized lyrics information and check existence")]
- [Property("SPEC", "Tizen.Multimedia.MetadataExtractor.Synclyrics M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Minje Ahn, minje.ahn@samsung.com")]
- public static void GetSynclyrics_CHECK_RETURNED_SYNCLYRICS()
- {
- Synclyrics _synclyrics;
- Log.Info(LogTag, "MetadataExtractor Test Synclyrics starting");
- _synclyrics = _metadataExtractor.GetSynclyrics(1);
-
- Assert.IsNull(_synclyrics.Lyrics, "Get Lyrics test failed");
- Log.Info(LogTag, "MetadataExtractor Test Synclyrics finished");
- }
-
- [Test]
- [Category("P2")]
- [Description("Get Synchronized lyrics information with wrong input parameter and check result")]
- [Property("SPEC", "Tizen.Multimedia.MetadataExtractor.Synclyrics M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Minje Ahn, minje.ahn@samsung.com")]
- public static void GetSynclyrics_CHECK_RETURNED_SYNCLYRICS_ERROR_TYPE()
- {
- Synclyrics _synclyrics;
- Log.Info(LogTag, "MetadataExtractor Test Synclyrics Invalid error case starting");
- try
- {
- _synclyrics = _metadataExtractor.GetSynclyrics(-1);
- }
- catch (Exception ex)
- {
- Assert.IsTrue(ex.GetType().Name.Equals("InvalidParameter"), "Returned error type should be [InvalidParameter]");
- }
-
- Log.Info(LogTag, "MetadataExtractor Test Synclyrics Invalid error case finished");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.PlaybackErrorEventArgs tests")]
- public static class PlaybackErrorEventArgsTests
- {
-
- static private int PlaybackError;
- private const string InvalidSource = "http://aaa.bbb.ccc/fake.mp4";
-
- static private Player TestPlayer;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Playback ErrorCode")]
- [Property("SPEC", "Tizen.Multimedia.PlaybackErrorEventArgs.ErrorCode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task ErrorCode_INVALID_URI()
- {
- /*
-............ * PRECONDITION:
-............ * Set invalid source to player
-............ * prepare player
-............ */
- PlaybackError = 0;
- TestPlayer.PlaybackErrorOccured += EventHandlerPlaybackError;
- MediaSource src = new MediaUriSource(InvalidSource);
- TestPlayer.SetSource(src);
- TestPlayer.PrepareAsync();
-
- /*
- * TEST:
- * Wait for 5 seconds and check if Playback error event is triggered.
- */
- await Task.Delay(5000);
- Assert.AreEqual(PlaybackError, -38, "Player Error event not triggered");
- }
-
- static void EventHandlerPlaybackError(object sender, PlaybackErrorEventArgs e)
- {
- PlaybackError = e.ErrorCode;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Playback ErrorCode")]
- [Property("SPEC", "Tizen.Multimedia.PlaybackErrorEventArgs.ErrorCode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void ErrorCode_INVALID_OPERATION()
- {
- Assert.True(false, "[NA] Implement after discussion with FW team");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Playback ErrorCode")]
- [Property("SPEC", "Tizen.Multimedia.PlaybackErrorEventArgs.ErrorCode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void ErrorCode_INVALID_STATE()
- {
- Assert.True(false, "[NA] Implement after discussion with FW team");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Playback ErrorCode")]
- [Property("SPEC", "Tizen.Multimedia.PlaybackErrorEventArgs.ErrorCode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void ErrorCode_CONNECTION_FAILED()
- {
- Assert.True(false, "[NA] Implement after discussion with FW team");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Playback ErrorCode")]
- [Property("SPEC", "Tizen.Multimedia.PlaybackErrorEventArgs.ErrorCode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void ErrorCode_DRM_NOT_PERMITTED()
- {
- Assert.True(false, "[NA] Implement after discussion with FW team");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Playback ErrorCode")]
- [Property("SPEC", "Tizen.Multimedia.PlaybackErrorEventArgs.ErrorCode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void ErrorCode_FILE_NOT_SUPPORTED()
- {
- Assert.True(false, "[NA] Implement after discussion with FW team");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Playback ErrorCode")]
- [Property("SPEC", "Tizen.Multimedia.PlaybackErrorEventArgs.ErrorCode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void ErrorCode_SEEK_FAILED()
- {
- Assert.True(false, "[NA] Implement after discussion with FW team");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Playback ErrorCode")]
- [Property("SPEC", "Tizen.Multimedia.PlaybackErrorEventArgs.ErrorCode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void ErrorCode_SERVICE_DISCONNECTED()
- {
- Assert.True(false, "[NA] Implement after discussion with FW team");
- }
-
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.PlaybackInterruptedEventArgs tests")]
- public static class PlaybackInterruptedEventArgsTests
- {
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test InterruptedCode")]
- [Property("SPEC", "Tizen.Multimedia.PlaybackInterruptedEventArgs.InterruptedCode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void InterruptedCode_PROPERTY_READ_ONLY()
- {
- //TODO: Fill this when we know how to trigger this event
- Assert.True(false, "[NA] Trigger RESOURCE_CONFLICT event");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.IO;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.Player tests")]
- public static class PlayerTests
- {
- private const string TestSource = "/opt/usr/home/owner/share/res/test.mp3";
- private const string InvalidSource = "http://aaa.bbb.ccc/fake.mp4";
- private const string TestSrt = "/opt/usr/home/owner/share/res/test.srt";
-
- static private Player TestPlayer;
- static private bool PlaybackCompletedFlag;
- static private bool PlaybackErrorFlag;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- TestPlayer = null;
- GC.Collect();
- }
-
- static async Task PlayerSrcPrepare(MediaSource src)
- {
- TestPlayer.SetSource(src);
- await TestPlayer.PrepareAsync();
- }
-
- static void PlayerOperations(bool start, bool pause, bool stop, bool unprep)
- {
- if(start == true)
- TestPlayer.Start();
-
- if(pause == true)
- TestPlayer.Pause();
-
- if(stop == true)
- TestPlayer.Stop();
-
- if(unprep == true)
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P0")]
- [Description("Test Player instantiation")]
- [Property("SPEC", "Tizen.Multimedia.Player.Player C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Player_INIT()
- {
- // TEST: Instantiate Player object and check
- var p = new Player();
- Assert.IsInstanceOf<Player>(p, "Should return Player instance");
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test property Mute")]
- [Property("SPEC", "Tizen.Multimedia.Player.Mute A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Mute_READ_WRITE()
- {
- // TEST: Set mute and verify
- TestPlayer.Mute = true;
- Assert.True(TestPlayer.Mute, "Could not mute player");
- TestPlayer.Mute = false;
- Assert.False(TestPlayer.Mute, "Could not unmute player");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property IsLooping")]
- [Property("SPEC", "Tizen.Multimedia.Player.IsLooping A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void IsLooping_READ_WRITE()
- {
- // TEST: Set IsLooping and verify
- TestPlayer.IsLooping = true;
- Assert.True(TestPlayer.IsLooping, "Could not set loop playback");
- TestPlayer.IsLooping = false;
- Assert.False(TestPlayer.IsLooping, "Could not unset loop playback");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property AudioLatencyMode")]
- [Property("SPEC", "Tizen.Multimedia.Player.AudioLatencyMode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void AudioLatencyMode_SET_ENUM_ALL()
- {
- // TEST: Set AudioLatencyMode and verify
- TestPlayer.AudioLatencyMode = AudioLatencyMode.High;
- Assert.AreEqual((int)TestPlayer.AudioLatencyMode, (int)AudioLatencyMode.High, "Could not set Audio latency mode to High");
-
- TestPlayer.AudioLatencyMode = AudioLatencyMode.Low;
- Assert.AreEqual((int)TestPlayer.AudioLatencyMode, (int)AudioLatencyMode.Low, "Could not set Audio latency mode to Low");
-
- TestPlayer.AudioLatencyMode = AudioLatencyMode.Mid;
- Assert.AreEqual((int)TestPlayer.AudioLatencyMode, (int)AudioLatencyMode.Mid, "Could not set Audio latency mode to Mid");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property AudioLatencyMode")]
- [Property("SPEC", "Tizen.Multimedia.Player.AudioLatencyMode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void AudioLatencyMode_CHECK_HIGH()
- {
- Assert.True(false, "[NA] Checking for the usage with fw team.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property AudioLatencyMode")]
- [Property("SPEC", "Tizen.Multimedia.Player.AudioLatencyMode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void AudioLatencyMode_CHECK_MID()
- {
- Assert.True(false, "[NA] Checking for the usage with fw team.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property AudioLatencyMode")]
- [Property("SPEC", "Tizen.Multimedia.Player.AudioLatencyMode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void AudioLatencyMode_CHECK_LOW()
- {
- Assert.True(false, "[NA] Checking for the usage with fw team.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property LeftVolume")]
- [Property("SPEC", "Tizen.Multimedia.Player.LeftVolume A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void LeftVolume_READ_WRITE()
- {
- // TEST: Set and verify left volume level
- TestPlayer.LeftVolume = 0.5f;
- Assert.AreEqual(TestPlayer.LeftVolume, 0.5f, "Could not set left volume to 0.5f");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property LeftVolume MIN")]
- [Property("SPEC", "Tizen.Multimedia.Player.LeftVolume A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PMIN")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void LeftVolume_READ_WRITE_MIN()
- {
- // TEST: Set and verify left volume min level
- TestPlayer.LeftVolume = 0.0f;
- Assert.AreEqual(TestPlayer.LeftVolume, 0.0f, "Could not set left volume to 0.0f");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property LeftVolume MAX")]
- [Property("SPEC", "Tizen.Multimedia.Player.LeftVolume A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PMAX")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void LeftVolume_READ_WRITE_MAX()
- {
- // TEST: Set and verify left volume max level
- TestPlayer.LeftVolume = 1.0f;
- Assert.AreEqual(TestPlayer.LeftVolume, 1.0f, "Could not set left volume to 1.0f");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property LeftVolume Above MAX")]
- [Property("SPEC", "Tizen.Multimedia.Player.LeftVolume A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PAM")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void LeftVolume_READ_WRITE_ABOVE_MAX()
- {
- // TEST: Set and verify left volume above max level
- try
- {
- TestPlayer.LeftVolume = 1.1f;
- } catch(Exception e)
- {
- Assert.True(e.GetType().Name.Equals("ArgumentException"), "Invalid result");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property LeftVolume Below MIN")]
- [Property("SPEC", "Tizen.Multimedia.Player.LeftVolume A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PBM")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void LeftVolume_READ_WRITE_BELOW_MIN()
- {
- // TEST: Set and verify left volume below min level
- try
- {
- TestPlayer.LeftVolume = -0.1f;
- } catch(Exception e)
- {
- Assert.True(e.GetType().Name.Equals("ArgumentException"), "Invalid result");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property RightVolume")]
- [Property("SPEC", "Tizen.Multimedia.Player.RightVolume A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void RightVolume_READ_WRITE()
- {
- // TEST: Set and verify right volume level
- TestPlayer.RightVolume = 0.5f;
- Assert.AreEqual(TestPlayer.RightVolume, 0.5f, "Could not set right volume to 0.5f");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property RightVolume MAX")]
- [Property("SPEC", "Tizen.Multimedia.Player.RightVolume A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PMAX")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void RightVolume_READ_WRITE_MAX()
- {
- // TEST: Set and verify right max volume level
- TestPlayer.RightVolume = 1.0f;
- Assert.AreEqual(TestPlayer.RightVolume, 1.0f, "Could not set right volume to 1.0f");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property RightVolume MIN")]
- [Property("SPEC", "Tizen.Multimedia.Player.RightVolume A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PMIN")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void RightVolume_READ_WRITE_MIN()
- {
- // TEST: Set and verify right min volume level
- TestPlayer.RightVolume = 0.0f;
- Assert.AreEqual(TestPlayer.RightVolume, 0.0f, "Could not set right volume to 0.0f");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property RightVolume Above MAX")]
- [Property("SPEC", "Tizen.Multimedia.Player.RightVolume A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PAM")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void RightVolume_READ_WRITE_ABOVE_MAX()
- {
- // TEST: Set and verify right volume level above max
- try
- {
- TestPlayer.RightVolume = 1.1f;
- } catch(Exception e)
- {
- Assert.True(e.GetType().Name.Equals("ArgumentException"), "Invalid result");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property RightVolume Below MIN")]
- [Property("SPEC", "Tizen.Multimedia.Player.RightVolume A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PBM")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void RightVolume_READ_WRITE_BELOW_MIN()
- {
- // TEST: Set and verify right volume level below min
- try
- {
- TestPlayer.RightVolume = -0.1f;
- } catch(Exception e)
- {
- Assert.True(e.GetType().Name.Equals("ArgumentException"), "Invalid result");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property AudioEffect")]
- [Property("SPEC", "Tizen.Multimedia.Player.AudioEffect A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void AudioEffect_PROPERTY_READ_ONLY()
- {
- // TEST: Check if player has AudioEffect object
- Assert.IsNotNull(TestPlayer.AudioEffect, "Invalid audio effect");
- Assert.IsInstanceOf<AudioEffect>(TestPlayer.AudioEffect, "Object should be of type AudioEffect");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property StreamInformation")]
- [Property("SPEC", "Tizen.Multimedia.Player.StreamInformation A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void StreamInformation_PROPERTY_READ_ONLY()
- {
- // TEST: Check if player has StreamInformation object
- Assert.IsNotNull(TestPlayer.StreamInformation, "Invalid stream information");
- Assert.IsInstanceOf<StreamInformation>(TestPlayer.StreamInformation, "Object should be of type StreamInformation");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property StreamingConfiguration")]
- [Property("SPEC", "Tizen.Multimedia.Player.StreamingConfiguration A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void StreamingConfiguration_PROPERTY_READ_ONLY()
- {
- // TEST: Check if player has StreamingConfiguration object
- Assert.IsNotNull(TestPlayer.StreamingConfiguration, "Invalid streaming configuration");
- Assert.IsInstanceOf<StreamingConfiguration>(TestPlayer.StreamingConfiguration, "Object should be of type StreamingConfiguration");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property Subtitle")]
- [Property("SPEC", "Tizen.Multimedia.Player.Subtitle A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PDV")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Subtitle_CHECK_DEFAULT_VALUE()
- {
- // TEST: Test default value
- Assert.IsNull(TestPlayer.Subtitle, "Expects null as the default value, but it is not null");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property Subtitle")]
- [Property("SPEC", "Tizen.Multimedia.Player.Subtitle A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PEX")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Subtitle_CHECK_EXCEPTION()
- {
- bool pass = false;
- // TEST: Test invalid subtitle path
- Subtitle s = new Subtitle("");
- try
- {
- TestPlayer.Subtitle = s;
- } catch(Exception e)
- {
- pass = e.GetType().Name.Equals("ArgumentException");
- }
- Assert.True(pass, "Expects ArgumentException, but wasn't thrown");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property Subtitle")]
- [Property("SPEC", "Tizen.Multimedia.Player.Subtitle A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Subtitle_READ_WRITE()
- {
- bool pass = true;
- // TEST: Set and verify if player has Subtitle object
- Subtitle s = new Subtitle(TestSrt);
- try
- {
- TestPlayer.Subtitle = s;
- } catch(Exception)
- {
- pass = false;
- }
- Assert.IsNotNull(TestPlayer.Subtitle, "Should be a valid subtitle");
- Assert.True(pass, "Couldn't set subtitle to player");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property Display")]
- [Property("SPEC", "Tizen.Multimedia.Player.Display A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Display_READ_WRITE()
- {
- // TEST: Set and verify if player has display object
- Display d = new Display(DisplayType.None);
- TestPlayer.Display = d;
- Assert.IsNotNull(TestPlayer.Display, "Invalid Display");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property PlayPosition")]
- [Property("SPEC", "Tizen.Multimedia.Player.PlayPosition A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task PlayPosition_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION :
- * Set source and prepare Player
- * Set play position
- */
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
-
- /*
- * TEST CODE
- * Check current position of the media file.
- */
- Assert.AreEqual(TestPlayer.PlayPosition, 0, "Wrong initial play position");
- await TestPlayer.SetPlayPositionAsync(5000, false); // Non accurate seek
- Assert.AreEqual(TestPlayer.PlayPosition, 5000, "Could not seek to 5000ms");
- await TestPlayer.SetPlayPositionAsync(15000, false);
- Assert.AreEqual(TestPlayer.PlayPosition, 15000, "Could not seek to 15000ms");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test property state")]
- [Property("SPEC", "Tizen.Multimedia.Player.State A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task State_READ_PLAYER_STATE()
- {
- // Initial state Idle
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Idle, "Player is not in Idle state");
-
- // Test Ready state
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Ready, "Player is not in Ready state");
-
- // Test Playing State
- TestPlayer.Start();
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Playing, "Player is not in Playing state");
-
- // Test Paused State
- TestPlayer.Pause();
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Paused, "Player is not in Paused state");
-
- // Test Ready State
- TestPlayer.Stop();
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Ready, "Player is not in Ready state");
-
- // Test Idle State
- TestPlayer.Unprepare();
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Idle, "Player is not in Idle state");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test CaptureVideoAsync method")]
- [Property("SPEC", "Tizen.Multimedia.Player.CaptureVideoAsync M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void CaptureVideoAsync_RETURN_VIDEO_FRAME()
- {
- // TODO: Can be tested after VideoView is implemented
- Assert.True(false, "[NA] VideoView is unavailable yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test PrepareAsync method")]
- [Property("SPEC", "Tizen.Multimedia.Player.PrepareAsync M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR, MCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task PrepareAsync_CHANGE_STATUS()
- {
- /*
- * PRECONDITION :
- * Set media source
- */
- MediaSource src = new MediaUriSource(TestSource);
- TestPlayer.SetSource(src);
-
- /*
- * TEST :
- * Prepare player and check if player state is "Ready"
- */
- Task<bool> t = TestPlayer.PrepareAsync();
- bool res = await t;
- Assert.True(res, "Invalid result");
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Ready, "Player is not in Ready state");
-
- /*
- * POSTCONDITION :
- * cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Unprepare method")]
- [Property("SPEC", "Tizen.Multimedia.Player.Unprepare M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Unprepare_CHANGE_STATUS()
- {
- /*
- * PRECONDITION :
- * Set media source
- * Prepare player
- */
-
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
-
- /*
- * TEST :
- * Unprepare player and check if player state is "Idle"
- */
- TestPlayer.Unprepare();
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Idle, "Player is not in Idle state");
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Unprepare method")]
- [Property("SPEC", "Tizen.Multimedia.Player.Unprepare M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MEX")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Unprepare_CHECK_EXCEPTION()
- {
- /*
- * PRECONDITION :
- * Set media source
- * Prepare player
- * Unprepare player and check if player state is "Idle"
- */
-
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
- TestPlayer.Unprepare();
-
- /*
- * TEST :
- * Play again and check if player throws InvalidOperation exception.
- */
- bool pass = false;
- try
- {
- TestPlayer.Start();
- } catch(Exception e)
- {
- pass = e.GetType().Name.Equals("InvalidOperation");
- }
- Assert.True(pass, "Exception not thrown");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Start method")]
- [Property("SPEC", "Tizen.Multimedia.Player.Start M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Start_CHECK_STATUS()
- {
- /*
- * PRECONDITION :
- * Set media source
- * Prepare player
- */
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
-
- /*
- * TEST :
- * Start player and check if player state is "Playing"
- */
- TestPlayer.Start();
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Playing, "Player is not in Playing state");
-
- /*
- * POSTCONDITION :
- * cleanup player
- */
- PlayerOperations(false, false, true, true);
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test Pause method")]
- [Property("SPEC", "Tizen.Multimedia.Player.Pause M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Pause_CHECK_STATUS()
- {
- /*
- * PRECONDITION :
- * Set media source
- * Prepare player
- * Start player
- */
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
- TestPlayer.Start();
-
- /*
- * TEST :
- * Pause player and check if player state is "Paused"
- */
- TestPlayer.Pause();
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Paused, "Player is not in Paused state");
-
- /*
- * POSTCONDITION :
- * cleanup player
- */
- PlayerOperations(false, false, true, true);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Stop method")]
- [Property("SPEC", "Tizen.Multimedia.Player.Stop M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Stop_CHECK_STATUS()
- {
- /*
- * PRECONDITION :
- * Set media source
- * Prepare player
- * Start player
- */
-
- MediaSource src = new MediaUriSource(TestSource);
- TestPlayer.SetSource(src);
- await TestPlayer.PrepareAsync();
- TestPlayer.Start();
-
- /*
- * TEST :
- * Stop player and check if player state is "Ready"
- */
- TestPlayer.Stop();
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Ready, "Player is not in Ready state");
-
- /*
- * POSTCONDITION :
- * cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetPlaybackRate fast playback (2x) method")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetPlaybackRate M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task SetPlaybackRate_Fast_CHECK_STATUS()
- {
- /*
- * PRECONDITION :
- * Register PlaybackCompleted event handler
- * Set playback rate as 2.0x
- * start playback
- */
- PlaybackCompletedFlag = false;
- MediaSource src = new MediaUriSource(TestSource);
- TestPlayer.PlaybackCompleted += EventHandlerPlaybackCompleted;
- await PlayerSrcPrepare(src);
- TestPlayer.SetPlaybackRate(2.0f);
- TestPlayer.Start();
-
- /*
- * TEST CODE
- * 1. wait for HALF the duration of the test media file (NOTE: Current test.mp3 duration is 33 seconds)
- * 2. Check for playback completed flag.
- */
- await Task.Delay(18000);
- Assert.True(PlaybackCompletedFlag, "PlabackCompleted Event not triggered");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- PlayerOperations(false, false, true, true);
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetPlaybackRate slow playback (0.5x) method")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetPlaybackRate M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task SetPlaybackRate_Slow_CHECK_STATUS()
- {
- /*
- * PRECONDITION :
- * Register PlaybackCompleted event handler
- * Set playback rate as 0.5x
- * start playback
- */
- PlaybackCompletedFlag = false;
- MediaSource src = new MediaUriSource(TestSource);
- TestPlayer.PlaybackCompleted += EventHandlerPlaybackCompleted;
- await PlayerSrcPrepare(src);
- TestPlayer.SetPlaybackRate(0.5f);
- TestPlayer.Start();
-
- /*
- * TEST CODE
- * 1. wait for DOUBLE the duration of the test media file (NOTE: Current test.mp3 duration is 33 seconds)
- * 2. Check for playback completed flag.
- */
-
- await Task.Delay(33000);
- Assert.False(PlaybackCompletedFlag, "PlabackCompleted Event triggered too soon");
-
- await Task.Delay(33000);
- Assert.True(PlaybackCompletedFlag, "PlabackCompleted Event not triggered");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- PlayerOperations(false, false, true, true);
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetPlaybackRate method")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetPlaybackRate M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MAR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task SetPlaybackRate_IN_RANGE()
- {
- /*
- * PRECONDITION :
- * Set source and prepare player
- */
- bool res = true;
- PlaybackCompletedFlag = false;
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
-
- /*
- * TESTS: Set playback rate within allowed range and check
- */
- try
- {
- TestPlayer.SetPlaybackRate(5.0f);
- TestPlayer.SetPlaybackRate(0.0f);
- TestPlayer.SetPlaybackRate(1.0f);
- TestPlayer.SetPlaybackRate(-5.0f);
- } catch(Exception ex)
- {
- res = false;
- Assert.True(res, "Exception thrown while setting SetPlaybackRate. Exception message " + ex.Message);
- }
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetPlaybackRate method")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetPlaybackRate M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MAR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task SetPlaybackRate_OUT_OF_RANGE_POS()
- {
- /*
- * PRECONDITION :
- * Set source and prepare player
- */
- bool res = false;
- PlaybackCompletedFlag = false;
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
-
- /*
- * TESTS: Set playback rate out side allowed range and check
- */
- try
- {
- TestPlayer.SetPlaybackRate(5.1f);
- } catch(Exception e)
- {
- res = e.GetType().Name.Equals("ArgumentException");
- }
-
- Assert.True(res, "Invalid result");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetPlaybackRate method")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetPlaybackRate M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MAR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task SetPlaybackRate_OUT_OF_RANGE_NEG()
- {
- /*
- * PRECONDITION :
- * Set source and prepare player
- */
- bool res = false;
- PlaybackCompletedFlag = false;
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
-
- /*
- * TESTS: Set playback rate out side allowed range and check
- */
- try
- {
- TestPlayer.SetPlaybackRate(-5.1f);
- } catch(Exception e)
- {
- res = e.GetType().Name.Equals("ArgumentException");
- }
-
- Assert.True(res, "Invalid result");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetPlayPositionAsync method")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionAsync M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR, MAC")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task SetPlayPositionAsync_FAST_SEEK()
- {
- /*
- * PRECONDITION :
- * start playback
- */
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
- Assert.AreEqual(TestPlayer.PlayPosition, 0, "Wrong initial play position");
- //TestPlayer.Start();
-
- /*
- * TEST CODE
- * 1. Set play positions
- * 2. Check current position of the media file.
- */
- Task<bool> t;
- bool res;
- t = TestPlayer.SetPlayPositionAsync(5000, false); // Non accurate seek
- res = await t;
- Assert.True(res, "Invalid result");
- Assert.AreEqual(TestPlayer.PlayPosition, 5000, "Could not seek to 5000ms");
-
- t = TestPlayer.SetPlayPositionAsync(15000, false);
- res = await t;
- Assert.True(res, "Invalid result");
- Assert.AreEqual(TestPlayer.PlayPosition, 15000, "Could not seek to 15000ms");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetPlayPositionAsync method")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionAsync M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR, MAR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task SetPlayPositionAsync_IN_RANGE()
- {
- /*
- * PRECONDITION :
- * start playback
- */
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
- Assert.AreEqual(TestPlayer.PlayPosition, 0, "Wrong initial play position");
- //TestPlayer.Start();
-
- /*
- * TEST CODE
- * 1. Set play positions
- * 2. Check current position of the media file.
- */
- Task<bool> t;
- bool res;
- t = TestPlayer.SetPlayPositionAsync(5000, false);
- res = await t;
- Assert.True(res, "Invalid result");
- Assert.AreEqual(TestPlayer.PlayPosition, 5000, "Could not seek to 5000ms");
-
- t = TestPlayer.SetPlayPositionAsync(32000, false);
- res = await t;
- Assert.True(res, "Invalid result");
- Assert.AreEqual(TestPlayer.PlayPosition, 32000, "Could not seek to 15000ms");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetPlayPositionAsync method")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionAsync M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR, MAR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task SetPlayPositionAsync_OUT_OF_RANGE()
- {
- /*
- * PRECONDITION :
- * start playback
- */
- MediaSource src = new MediaUriSource(TestSource);
- await PlayerSrcPrepare(src);
- Assert.AreEqual(TestPlayer.PlayPosition, 0, "Wrong initial play position");
- //TestPlayer.Start();
-
- /*
- * TEST CODE
- * 1. Set invlid play positions
- * 2. Check for return value
- */
-
- Task<bool> t;
- bool res;
- t = TestPlayer.SetPlayPositionAsync(-1, false);
- res = await t;
- Assert.False(res, "Should return false when negative value input for PlayPosition");
-
- t = TestPlayer.SetPlayPositionAsync(40000, false);
- res = await t;
- Assert.False(res, "Should return false when positive out-of-range value input for PlayPosition");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetPlayPositionAsync method")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetPlayPositionAsync M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MAC")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void SetPlayPositionAsync_ACCURATE_SEEK()
- {
- //TODO: Check non-accurate seek when VideoView is implemented.
- Assert.True(false, "[NA] Implement after VideoView is ready.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetAudioStreamPolicy")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetAudioStreamPolicy M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void SetAudioStreamPolicy_NO_EXCEPTION()
- {
- bool pass = true;
- // TEST: Check if AudioStreamPolicy is set without exception
- try
- {
- TestPlayer.SetAudioStreamPolicy(new AudioStreamPolicy(AudioStreamType.Media));
- } catch(Exception)
- {
- pass = false;
- }
- Assert.True(pass, "SetAudioStreamPolicy failed.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetAudioStreamPolicy")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetAudioStreamPolicy M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void SetAudioStreamPolicy_CHECK_STATUS()
- {
- Assert.True(false, "[NA] Implement after checking with FW team");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetSource")]
- [Property("SPEC", "Tizen.Multimedia.Player.SetSource M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task SetSource_Buffer_CHECK_STATUS()
- {
- // PRECONDITION:
- // Read mediafile to a buffer and set buffer to player.
- // Prepare Player
- byte[] memBuff = File.ReadAllBytes(TestSource);
- MediaSource src = new MediaBufferSource(memBuff);
- TestPlayer.SetSource(src);
- await TestPlayer.PrepareAsync();
-
- // TEST: Check if prepare is successful.
- Assert.AreEqual((int)TestPlayer.State, (int)PlayerState.Ready, "SetSource(MediaBufferSource) failed");
-
- // POSTCONDITION: Clean up player
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test PlaybackCompleted event")]
- [Property("SPEC", "Tizen.Multimedia.Player.PlaybackCompleted E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task PlaybackCompleted_CHECK_EVENT()
- {
- /*
- * PRECONDITION :
- * Register PlaybackCompleted event handler
- * start playback
- */
- PlaybackCompletedFlag = false;
- MediaSource src = new MediaUriSource(TestSource);
- TestPlayer.PlaybackCompleted += EventHandlerPlaybackCompleted;
- await PlayerSrcPrepare(src);
- TestPlayer.Start();
-
- /*
- * TEST CODE
- * 1. wait for duration of the test media file (NOTE: Current test.mp3 duration is 33 seconds)
- * 2. Check for playback completed flag.
- */
- await Task.Delay(35000);
- Assert.True(PlaybackCompletedFlag, "PlabackCompleted Event not triggered");
-
- /*
- * POST CONDITION:
- * Cleanup state
- */
- PlayerOperations(false, false, true, true);
-
- }
-
- static void EventHandlerPlaybackCompleted(object sender, EventArgs e)
- {
- PlaybackCompletedFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test PlaybackErrorOccured event")]
- [Property("SPEC", "Tizen.Multimedia.Player.PlaybackErrorOccured E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task PlaybackErrorOccured_CHECK_EVENT()
- {
- /*
-............ * PRECONDITION:
-............ * Set invalid source to player
-............ * prepare player
-............ */
- EventHandler<PlaybackErrorEventArgs> handler = (s, e) =>
- {
- PlaybackErrorFlag = true;
- };
-
- PlaybackErrorFlag = false;
- TestPlayer.PlaybackErrorOccured += handler;
- MediaSource src = new MediaUriSource(InvalidSource);
- TestPlayer.SetSource(src);
- TestPlayer.PrepareAsync();
-
- /*
- * TEST:
- * Wait for 5 seconds and check if Playback error event is triggered.
- */
- await Task.Delay(5000);
- Assert.True(PlaybackErrorFlag, "Player Error event not triggered");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test PlaybackInterruped event")]
- [Property("SPEC", "Tizen.Multimedia.Player.PlaybackInterruped E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void PlaybackInterruped_CHECK_EVENT()
- {
- //TODO: Fill this when we know how to trigger this event
- Assert.True(false, "[NA] Trigger RESOURCE_CONFLICT event");
- }
-
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.PlayerContentInfo tests")]
- public static class PlayerContentInfoTests
- {
- private const string TestSource = "/opt/usr/home/owner/share/res/test.mp3";
- static private Player TestPlayer;
- static private bool Ready = false;
-
- [TestFixtureSetUp]
- public static void Init()
- {
- }
-
- [TestFixtureTearDown]
- public static void Destroy()
- {
- // Cleanup player after all tests
- if(Ready)
- TestPlayer.Unprepare();
- }
-
- private static async Task Initialize()
- {
- if(Ready)
- return;
- TestPlayer = new Player();
- MediaSource src = new MediaUriSource(TestSource);
- TestPlayer.SetSource(src);
- await TestPlayer.PrepareAsync();
- Ready = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata - Album")]
- [Property("SPEC", "Tizen.Multimedia.ContentInfo.Album A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Album_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
-
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check metadata
- */
- Assert.AreEqual(TestPlayer.StreamInformation.ContentInfo.Album, "Tizen Album", "Incorrect Album");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata - Artist")]
- [Property("SPEC", "Tizen.Multimedia.ContentInfo.Artist A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Artist_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
-
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check metadata
- */
- Assert.AreEqual(TestPlayer.StreamInformation.ContentInfo.Artist, "Tizen Artist", "Incorrect Artist");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata - Author")]
- [Property("SPEC", "Tizen.Multimedia.ContentInfo.Author A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Author_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
-
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check metadata
- */
- Assert.AreEqual(TestPlayer.StreamInformation.ContentInfo.Author, "Tizen Composer", "Incorrect Author");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata - Genre")]
- [Property("SPEC", "Tizen.Multimedia.ContentInfo.Genre A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Genre_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check metadata
- */
- Assert.AreEqual(TestPlayer.StreamInformation.ContentInfo.Genre, "Rock", "Incorrect Genre");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata - Title")]
- [Property("SPEC", "Tizen.Multimedia.ContentInfo.Title A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Title_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check metadata
- */
- Assert.AreEqual(TestPlayer.StreamInformation.ContentInfo.Title, "Enchantment", "Incorrect Title");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata - Year")]
- [Property("SPEC", "Tizen.Multimedia.ContentInfo.Year A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Year_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check metadata
- */
- Assert.AreEqual(TestPlayer.StreamInformation.ContentInfo.Year, "2016", "Expected 2016, but got " + TestPlayer.StreamInformation.ContentInfo.Year);
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.ProgressiveDownloadMessageEventArgs tests")]
- public static class ProgressiveDownloadMessageEventArgsTests
- {
- private const string PdPath = "/opt/usr/home/owner/share/res/pd";
- private const string UrlPath = "http://content.bitsontherun.com/videos/ntPYsD4L-1ahmry41.mp4";
- private const string UrlPath2 = "http://download.wavetlan.com/SVV/Media/HTTP/RIMSample.mp3";
- static private Player TestPlayer;
- static private int PdMessage;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Message")]
- [Property("SPEC", "Tizen.Multimedia.ProgressiveDownloadMessageEventArgs.Message A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Message_CHECK_ENUM_STARTED()
- {
- /*
- * PRECONDITION:
- * Set remote url source to player
- * Set Progressive download path
- * Register ProgressiveDownloadMessageChanged event handler
- * prepare and start player
- */
- PdMessage = -1;
- MediaSource src = new MediaUriSource(UrlPath);
- TestPlayer.SetSource(src);
-
- EventHandler<ProgressiveDownloadMessageEventArgs> handler = (s, e) =>
- {
- PdMessage = (int)e.Message;
- };
-
- TestPlayer.StreamingConfiguration.ProgressiveDownloadPath = PdPath;
- TestPlayer.StreamingConfiguration.ProgressiveDownloadMessageChanged += handler;
- await TestPlayer.PrepareAsync();
- TestPlayer.Start();
-
- /*
- * TEST:
- * Wait for 3 seconds and check the progressive download message
- */
- await Task.Delay(3000);
- Assert.AreEqual(PdMessage, (int)ProgressiveDownloadMessage.Started, "Progressive download message (started) event not received");
-
- /*
- * POST CONDITION
- * Cleanup player
- */
- TestPlayer.Stop();
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Message")]
- [Property("SPEC", "Tizen.Multimedia.ProgressiveDownloadMessageEventArgs.Message A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Message_CHECK_ENUM_COMPLETED()
- {
- /*
- * PRECONDITION:
- * Set remote url source to player
- * Set Progressive download path
- * Register ProgressiveDownloadMessageChanged event handler
- * prepare and start player
- */
- PdMessage = -1;
- MediaSource src = new MediaUriSource(UrlPath2);
- TestPlayer.SetSource(src);
-
- EventHandler<ProgressiveDownloadMessageEventArgs> handler = (s, e) =>
- {
- PdMessage = (int)e.Message;
- };
-
- TestPlayer.StreamingConfiguration.ProgressiveDownloadPath = PdPath;
- TestPlayer.StreamingConfiguration.ProgressiveDownloadMessageChanged += handler;
- await TestPlayer.PrepareAsync();
- TestPlayer.Start();
-
- /*
- * TEST:
- * Wait for 5 seconds and check the progressive download message
- */
- await Task.Delay(5000);
- Assert.AreEqual(PdMessage, (int)ProgressiveDownloadMessage.Completed, "Progressive download message (completed) event not received");
-
- /*
- * POST CONDITION
- * Cleanup player
- */
- TestPlayer.Stop();
- TestPlayer.Unprepare();
- }
-
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.ProgressiveDownloadStatus tests")]
- public static class ProgressiveDownloadStatusTests
- {
- private const string PdPath = "/opt/usr/home/owner/share/res/pd";
- private const string UrlPath = "http://content.bitsontherun.com/videos/ntPYsD4L-1ahmry41.mp4";
- static private Player TestPlayer;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- private static async Task Initialize()
- {
- MediaSource src = new MediaUriSource(UrlPath);
- TestPlayer.SetSource(src);
- TestPlayer.StreamingConfiguration.ProgressiveDownloadPath = PdPath;
- await TestPlayer.PrepareAsync();
- TestPlayer.Start();
- }
-
- private static void Cleanup()
- {
- TestPlayer.Stop();
- TestPlayer.Unprepare();
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test progressive download status Current")]
- [Property("SPEC", "Tizen.Multimedia.ProgressiveDownloadStatus.Current A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Current_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION:
- * Set remote url source to player
- * Set progressive downlaod path
- * Start player
- */
- await Initialize();
-
- /*
- * TEST:
- * Wait for 5 seconds and check the Progressive download status
- */
- await Task.Delay(5000);
- Assert.IsNotNull(TestPlayer.StreamingConfiguration.ProgressiveDownloadStatus, "Expected object");
- //Assuming good connection, atleast 100000 bytes should be downloaded
- Assert.Greater((int)TestPlayer.StreamingConfiguration.ProgressiveDownloadStatus.Current, 100000, "Unexpected current value");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- Cleanup();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test progressive download status TotalSize")]
- [Property("SPEC", "Tizen.Multimedia.ProgressiveDownloadStatus.TotalSize A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task TotalSize_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION:
- * Set remote url source to player
- * Set progressive downlaod path
- * Start player
- */
- await Initialize();
-
- /*
- * TEST:
- * Wait for 5 seconds and check the Progressive download status
- */
- await Task.Delay(5000);
- Assert.IsNotNull(TestPlayer.StreamingConfiguration.ProgressiveDownloadStatus, "Expected object");
- Assert.AreEqual((int)TestPlayer.StreamingConfiguration.ProgressiveDownloadStatus.TotalSize, 57876499, "Unexpected total size");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- Cleanup();
- }
- }
-}
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Runtime.CompilerServices;
-using System.Diagnostics;
-using TestFramework;
-using Tizen;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Tizen.Multimedia.Recorder Test class for Audio and Video recording.")]
- public static class RecorderTests
- {
- private static Tizen.Multimedia.Recorder _recorder;
- private static string _filePath = "/opt/usr/home/owner/share/res/audiosample.3gp";
- private static string _dirPath = "/opt/usr/home/owner/share/res";
- private static RecorderFileFormat _fileFormat = RecorderFileFormat.ThreeGp;
- private static RecorderAudioCodec _audioCodec = RecorderAudioCodec.Aac;
- private static RecorderState _state = RecorderState.Created;
- private static int _timeLimit = 3;
- private static int _sizeLimit = 1024;
- private static int _audioBitRate = 28800;
- private static int _videoBitRate = 28800;
- private static int _audioSampleRate = 44100;
- private static bool _mute = false;
- private static int _audioChannel = 2;
- private static IList _formats;
- private static IList _audioEncodings;
- private static IList _videoEncodings;
- private static IList _videoResolutions;
- private static bool _limitFlag = false;
- private static bool _stateFlag = false;
- private static bool _statusFlag = false;
- private static bool _streamFlag = false;
- private static bool _errorFlag = false;
- public const string LogTag = "Tizen.Multimedia.Recorder";
- static private Player TestPlayer;
- private const string TestSource = "/opt/usr/home/owner/share/res/test.mp3";
-
- [SetUp]
- public static void Init()
- {
- _recorder = new Tizen.Multimedia.Recorder();
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- _recorder = null;
- GC.Collect();
- }
-
- private static void InitRecorder()
- {
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Audio Recorder Constructor - Object should not be null after initializing")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Recorder C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Recorder_INIT()
- {
- /* TEST CODE
- * Check for audio recorder Instance
- */
- Assert.IsNotNull(_recorder, "Object should not be null after initializing");
- Assert.IsInstanceOf<Recorder>(_recorder, "Should return recorder instance");
- Log.Info(LogTag, "******fileformat = " + _recorder.FileFormat);
- Log.Info(LogTag, "******audio codec = " + _recorder.AudioCodec);
- Log.Info(LogTag, "******video codec = " + _recorder.VideoCodec);
- Log.Info(LogTag, "******size limit = " + _recorder.SizeLimit);
- Log.Info(LogTag, "******time limit = " + _recorder.TimeLimit);
- Log.Info(LogTag, "******audio device = " + _recorder.AudioDevice);
- Log.Info(LogTag, "*****audio bitrate = " + _recorder.AudioBitRate);
- Log.Info(LogTag, "*******videobitrate = " + _recorder.VideoBitRate);
- Log.Info(LogTag, "********audio samplerate = " + _recorder.AudioSampleRate);
- Log.Info(LogTag, "******audio channel = " + _recorder.AudioChannel);
- }
-
- [Test]
- [Category("P1")]
- [Description("Test : Video Recorder Constructor - Object should not be null after initializing")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Recorder C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Recorder_Video_INIT()
- {
- /* TEST CODE
- * Constructor is for VideoRecorder. so not testing it
- */
- Log.Info(LogTag, "Recorder Test VideoRecorder starting");
- Assert.IsFalse(true, "[NA] VideoRecorder is not testable yet.");
- Log.Info(LogTag, "Recorder Test Videorecorder finished");
-
- // Camera camera = new Tizen.Multimedia.Camera();
- // Recorder r = new Recorder(camera);
- /* TEST CODE
- * Check for video recorder Instance
- */
- // Assert.IsNotNull(r, "Object should not be null after initializing");
- // Assert.IsInstanceOf<Recorder>(r, "Should return recorder instance");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder state.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.State A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void State_GET_ENUM_ALL()
- {
- /* TEST CODE
- * Test created state
- */
- Log.Info(LogTag, "Recorder Test State starting");
- Assert.AreEqual((int)RecorderState.Created, (int)_recorder.State, "Recorder should be in created state");
-
- /* TEST CODE
- * Test ready state
- */
- InitRecorder();
- _recorder.Prepare();
- Assert.AreEqual((int)RecorderState.Ready, (int)_recorder.State, "Recorder should be in ready state");
-
- /* TEST CODE
- * Test recording state
- */
- _recorder.Start();
- Assert.AreEqual((int)RecorderState.Recording, (int)_recorder.State, "Recorder should be in recording state");
-
- /* TEST CODE
- * Test paused state
- */
- _recorder.Pause();
- Assert.AreEqual((int)RecorderState.Paused, (int)_recorder.State, "Recorder should be in paused state");
- Log.Info(LogTag, "Recorder Test State finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Prepare method")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Prepare M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Prepare_CHECK_STATE()
- {
- /*
- * PRECONDITION
- * Set Audiocode, fileformat, filepath
- */
- Log.Info(LogTag, "Recorder Test Prepare starting");
- InitRecorder();
-
- /* TEST CODE
- * Check recorder state.
- */
- _recorder.Prepare();
- Assert.AreEqual((int)RecorderState.Ready, (int)_recorder.State, "Recorder should be in ready state");
-
- /* POSTCONDITION
- * Cleanup recorder
- */
- _recorder.Unprepare();
- Log.Info(LogTag, "Recorder Test Prepare finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Start method")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Start M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Start_CHECK_STATE()
- {
- /*
- * PRECONDITION
- * Set Audiocode, fileformat, filepath
- */
- Log.Info(LogTag, "Recorder Test Start starting");
- InitRecorder();
-
- /* TEST CODE
- * Test recorder is in recording state
- */
- _recorder.Prepare();
- _recorder.Start();
- Assert.AreEqual((int)RecorderState.Recording, (int)_recorder.State, "Recorder should be in recording state");
-
- /* POSTCONDITION
- * Cleanup recorder
- */
- _recorder.Commit();
- _recorder.Unprepare();
- Log.Info(LogTag, "Recorder Test Start finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Pause method")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Pause M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Pause_CHECK_STATE()
- {
- /*
- * PRECONDITION
- * Set Audiocode, fileformat, filepath
- */
- Log.Info(LogTag, "Recorder Test Pause starting");
- InitRecorder();
-
- /* TEST CODE
- * Test recorder is in pause state.
- */
- _recorder.Prepare();
- _recorder.Start();
- _recorder.Pause();
- Assert.AreEqual((int)RecorderState.Paused, (int)_recorder.State, "Recorder should be in paused state");
-
- /* POSTCONDITION
- * Cleanup recorder
- */
- _recorder.Commit();
- _recorder.Unprepare();
- Log.Info(LogTag, "Recorder Test Pause finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Commit method")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Commit M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Commit_CHECK_STATE()
- {
- /*
- * PRECONDITION
- * Set Audiocode, fileformat, filepath
- */
- Log.Info(LogTag, "Recorder Test Commit starting");
- InitRecorder();
-
- /* TEST CODE
- * Test recorder is in ready state.
- */
- _recorder.Prepare();
- _recorder.Start();
- _recorder.Commit();
- Assert.AreEqual<int>((int)RecorderState.Ready, (int)_recorder.State, "Recorder should be in ready state");
- Assert.True(File.Exists(_filePath), "Recorded file does not exist");
-
- /* POSTCONDITION
- * Cleanup recorder
- */
- _recorder.Unprepare();
- Log.Info(LogTag, "Recorder Test Commit finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test whether invoking Cancel method transfers state to ready state, and does not save file")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Cancel M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Cancel_CHECK_STATE()
- {
- /*
- * PRECONDITION
- * Set Audiocode, fileformat, filepath
- */
- Log.Info(LogTag, "Recorder Test Cancel starting");
- InitRecorder();
-
- /* TEST CODE
- * Test recorder is in ready state.
- */
- File.Delete(_filePath);
- _recorder.Prepare();
- _recorder.Start();
- _recorder.Cancel();
-
- Assert.AreEqual((int)RecorderState.Ready, (int)_recorder.State, "Recorder should be in ready state");
- Assert.IsFalse(File.Exists(_filePath), "Recording File should not exist");
-
- /* POSTCONDITION
- * Cleanup recorder
- */
- _recorder.Unprepare();
- Log.Info(LogTag, "Recorder Test Cancel finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Unprepare method")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Unprepare M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MCST")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Unprepare_CHECK_STATE()
- {
- /*
- * PRECONDITION
- * Set Audiocode, fileformat, filepath
- */
- Log.Info(LogTag, "Recorder Test Unprepare starting");
- InitRecorder();
-
- /* TEST CODE
- * Test recorder is in created state.
- */
- _recorder.Prepare();
- _recorder.Start();
- _recorder.Commit();
- _recorder.Unprepare();
- Assert.AreEqual((int)RecorderState.Created, (int)_recorder.State, "Recorder should be in created state");
- Log.Info(LogTag, "Recorder Test Unprepare finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Filepath property.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.FilePath A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void FilePath_READ_WRITE()
- {
- /* TEST CODE
- * Check whether FilePath is readable and writable
- */
- Log.Info(LogTag, "Recorder Test Filepath starting");
- _recorder.FilePath = _filePath;
- Assert.AreEqual(_filePath, _recorder.FilePath, "Filepath is not correct");
- Log.Info(LogTag, "Recorder Test Filepath finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Fileformat property.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.FileFormat A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PDV")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void FileFormat_GET_ENUM_DEFAULT()
- {
- /* TEST CODE
- * Test Default format.
- */
- Log.Info(LogTag, "Recorder Test FileFormat starting");
- Assert.AreEqual((int)RecorderFileFormat.Mp4, (int)_recorder.FileFormat, "Default file format should be Mp4");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Fileformat property.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.FileFormat A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void FileFormat_SET_ENUM_ALL()
- {
- /* TEST CODE
- * Test Adts format.
- */
- Log.Info(LogTag, "Recorder Test FileFormat starting");
- _recorder.FileFormat = RecorderFileFormat.Adts;
- Assert.AreEqual((int)RecorderFileFormat.Adts, (int)_recorder.FileFormat, "Cannot set file format to Adts");
-
- /* TEST CODE
- * Test Amr format.
- */
- _recorder.FileFormat = RecorderFileFormat.Amr;
- Assert.AreEqual((int)RecorderFileFormat.Amr, (int)_recorder.FileFormat, "Cannot set file format to Amr");
-
- /* TEST CODE
- * Test M2ts format.
- */
- _recorder.FileFormat = RecorderFileFormat.M2ts;
- Assert.AreEqual((int)RecorderFileFormat.M2ts, (int)_recorder.FileFormat, "Cannot set file format to M2ts");
-
- /* TEST CODE
- * Test Mp4 format.
- */
- _recorder.FileFormat = RecorderFileFormat.Mp4;
- Assert.AreEqual((int)RecorderFileFormat.Mp4, (int)_recorder.FileFormat, "Cannot set file format to Mp4");
-
- /* TEST CODE
- * Test Ogg format.
- */
- _recorder.FileFormat = RecorderFileFormat.Ogg;
- Assert.AreEqual((int)RecorderFileFormat.Ogg, (int)_recorder.FileFormat, "Cannot set file format to Ogg");
-
- /* TEST CODE
- * Test ThreeGp format.
- */
- _recorder.FileFormat = RecorderFileFormat.ThreeGp;
- Assert.AreEqual((int)RecorderFileFormat.ThreeGp, (int)_recorder.FileFormat, "Cannot set file format to 3gp format");
-
- /* TEST CODE
- * Test Wav format.
- */
- _recorder.FileFormat = RecorderFileFormat.Wav;
- Assert.AreEqual((int)RecorderFileFormat.Wav, (int)_recorder.FileFormat, "Cannot set file format to Wav format");
- Log.Info(LogTag, "Recorder Test Fileformat finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Audiocodec property.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioCodec A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PDV")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void AudioCodec_GET_ENUM_DEFAULT()
- {
- /* TEST CODE
- * Test default Audiocodec.
- */
- Assert.AreEqual((int)RecorderAudioCodec.Amr, (int)_recorder.AudioCodec, "Default Audiocodec should be Amr codec.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Audiocodec property.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioCodec A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void AudioCodec_SET_ENUM_ALL()
- {
- /* TEST CODE
- * Test Aac codec.
- */
- Log.Info(LogTag, "Recorder Test Audiocodec Starting");
- _recorder.AudioCodec = RecorderAudioCodec.Aac;
- Assert.AreEqual((int)RecorderAudioCodec.Aac, (int)_recorder.AudioCodec, "Cannot set Audiocodec to Aac format");
-
- /* TEST CODE
- * Test Amr codec.
- */
- _recorder.AudioCodec = RecorderAudioCodec.Amr;
- Assert.AreEqual((int)RecorderAudioCodec.Amr, (int)_recorder.AudioCodec, "Cannot set Audiocodec to Amr format");
-
- /* TEST CODE
- * Test Disabled.
- */
- _recorder.AudioCodec = RecorderAudioCodec.Disable;
- Assert.AreEqual((int)RecorderAudioCodec.Disable, (int)_recorder.AudioCodec, "Cannot set Audiocodec to disable format");
-
- /* TEST CODE
- * Test Mp3 codec.
- */
- _recorder.AudioCodec = RecorderAudioCodec.Mp3;
- Assert.AreEqual((int)RecorderAudioCodec.Mp3, (int)_recorder.AudioCodec, "Cannot set Audiocodec to Mp3 format");
-
- /* TEST CODE
- * Test Pcm codec.
- */
- _recorder.AudioCodec = RecorderAudioCodec.Pcm;
- Assert.AreEqual((int)RecorderAudioCodec.Pcm, (int)_recorder.AudioCodec, "Cannot set Audiocodec to pcm format");
-
- /* TEST CODE
- * Test Vorbis codec.
- */
- _recorder.AudioCodec = RecorderAudioCodec.Vorbis;
- Assert.AreEqual((int)RecorderAudioCodec.Vorbis, (int)_recorder.AudioCodec, "Cannot set Audiocodec to Vorbis format");
- Log.Info(LogTag, "Recorder Test audiocodec finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Videocodec property.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Videocodec A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PDV")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void VideoCodec_GET_ENUM_DEFAULT()
- {
- /* TEST CODE
- * Test default Videocodec.
- */
- Assert.AreEqual((int)RecorderVideoCodec.Mpeg4, (int)_recorder.VideoCodec, "Cannot set Videocodec to Mpeg4 codec");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Videocodec property.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Videocodec A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void VideoCodec_SET_ENUM_ALL()
- {
- /* TEST CODE
- * Test H263 codec.
- */
- _recorder.VideoCodec = RecorderVideoCodec.H263;
- Assert.AreEqual((int)RecorderVideoCodec.H263, (int)_recorder.VideoCodec, "Cannot set Videocodec to H263 codec");
-
- /* TEST CODE
- * Test H264 codec.
- */
- _recorder.VideoCodec = RecorderVideoCodec.H264;
- Assert.AreEqual((int)RecorderVideoCodec.H264, (int)_recorder.VideoCodec, "Cannot set Videocodec to H264 codec");
-
- /* TEST CODE
- * Test Mpeg4 codec.
- */
- _recorder.VideoCodec = RecorderVideoCodec.Mpeg4;
- Assert.AreEqual((int)RecorderVideoCodec.Mpeg4, (int)_recorder.VideoCodec, "Cannot set Videocodec to Mpeg4 codec");
-
- /* TEST CODE
- * Test Theora codec.
- */
- _recorder.VideoCodec = RecorderVideoCodec.Theora;
- Assert.AreEqual((int)RecorderVideoCodec.Theora, (int)_recorder.VideoCodec, "Cannot set Videocodec to Theora codec");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder file format capability")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.SupportedFileFormats A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void SupportedFileFormats_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "Recorder Test SupportedFileFormats starting");
- _formats = _recorder.SupportedFileFormats.ToList();
-
- /* TEST CODE
- * Check fileformats supported by recorder.
- */
- Assert.IsNotEmpty(_formats, "file format list cannot be empty");
- Assert.Greater(_formats.Count, 0, "Fileformat count should not be 0");
- Log.Info(LogTag, "Recorder Test SupportedFileFormats finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder audio encoding capability")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.SupportedAudioEncodings A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void SupportedAudioEncodings_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "Recorder Test SupportedAudioEncodings starting");
- _audioEncodings = _recorder.SupportedAudioEncodings.ToList();
-
- /* TEST CODE
- * Check audioencodings supported by recorder.
- */
- Assert.IsNotEmpty(_audioEncodings, "audio encoding list cannot be empty");
- Assert.Greater(_audioEncodings.Count, 0, "audio encoding count should not be 0");
- Log.Info(LogTag, "Recorder Test SupportedAudioEncodings finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder video encoding capability")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.SupportedVideoEncodings A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void SupportedVideoEncodings_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "Recorder Test SupportedVideoEncodings starting");
- _videoEncodings = _recorder.SupportedVideoEncodings.ToList();
-
- /* TEST CODE
- * Check videoencodings supported by recorder.
- */
- Assert.IsNotEmpty(_videoEncodings, "video encoding list cannot be empty");
- Assert.Greater(_videoEncodings.Count, 0, "video encoding count should not be 0");
- Log.Info(LogTag, "Recorder Test SupportedVideoEncodings finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder video resolutions capability.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.SupportedVideoResolutions A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void SupportedVideoResolutions_PROPERTY_READ_ONLY()
- {
- /* TEST CODE
- * SupportedVideoResolutions is for VideoRecorder. so not testing it
- */
- Log.Info(LogTag, "Recorder Test SupportedVideoResolutions starting");
- Assert.IsFalse(true, "[NA] SupportedVideoResolutions is not testable yet.");
- Log.Info(LogTag, "Recorder Test SupportedVidoeResolutions finished");
-// _videoResolutions = _recorder.SupportedVideoResolutions.ToList();
-//
-// /* TEST CODE
-// * Check videoresolutions supported by recorder.
-// */
-// Assert.IsNotEmpty(_videoResolutions, "video resolutions cannot be empty");
-// Assert.Greater(_videoResolutions.Count, 0, "video resolutions count cannot be 0.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Size limit property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.SizeLimit A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PDV")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void SizeLimit_READ_DEFAULT()
- {
- /* TEST CODE
- * Test default sizelimit value.
- */
- Assert.AreEqual(0, _recorder.SizeLimit, "sizelimit should not be zero");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Size limit property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.SizeLimit A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void SizeLimit_READ_WRITE()
- {
- Log.Info(LogTag, "Recorder Test SizeLimit starting");
- _recorder.SizeLimit = _sizeLimit;
-
- /* TEST CODE
- * Test if sizelimit property is readable/writable.
- */
- Assert.AreNotEqual(0, _recorder.SizeLimit, "sizelimit should not be zero");
- Assert.AreEqual(_sizeLimit, _recorder.SizeLimit, "sizelimit is not same as set value");
-
- Log.Info(LogTag, "Recorder Test SizeLimit finished");
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Size limit property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.SizeLimit A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PBM")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void SizeLimit_PROPERTY_BELOW_MIN()
- {
- Log.Info(LogTag, "Recorder Test SizeLimit starting");
-
-
- /* TEST CODE
- * Test if sizelimit property is readable/writable.
- */
- try {
- _recorder.SizeLimit = -1;
- } catch(Exception e) {
- Log.Info(LogTag, "***************size limit exception *****************");
- Assert.IsTrue(e is ArgumentException, "Exception should be argument exception");
- }
- Log.Info(LogTag, "Recorder Test SizeLimit finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Time Limit property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.TimeLimit A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PDV")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void TimeLimit_READ_DEFAULT()
- {
- /* TEST CODE
- * Test default timelimit value.
- */
- Assert.AreEqual(0, _recorder.TimeLimit, "Timelimit should be zero by default.");
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Time Limit property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.TimeLimit A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void TimeLimit_READ_WRITE()
- {
- Log.Info(LogTag, "Recorder Test Timelimit starting");
- _recorder.TimeLimit = _timeLimit;
-
- /* TEST CODE
- * Test if timelimit property is readable/writable.
- */
- Assert.AreNotEqual(0, _recorder.TimeLimit, "timelimit should not be zero");
- Assert.AreEqual(_timeLimit, _recorder.TimeLimit, "Timelimit is not same as set value");
- Log.Info(LogTag, "Recorder Test Timelimit finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Time Limit property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.TimeLimit A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PBM")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void TimeLimit_PROPERTY_BELOW_MIN()
- {
- Log.Info(LogTag, "Recorder Test Timelimit starting");
-
- /* TEST CODE
- * Test if timelimit property is readable/writable.
- */
- try {
- _recorder.TimeLimit = -1;
- } catch(Exception e) {
- Log.Info(LogTag, "***************time limit exception *****************");
- Assert.IsTrue(e is ArgumentException, "Exception should be argument exception");
- }
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder AudioDevice property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioDevice A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void AudioDevice_SET_ENUM_ALL()
- {
- /* TEST CODE
- * Test Mic audiodevice.
- */
- Log.Info(LogTag, "Recorder Test AudioDevice starting");
- Assert.AreEqual((int)RecorderAudioDevice.Mic, (int)_recorder.AudioDevice, "Could not set Audiodevice to Mic");
-
- /* TEST CODE
- * Test Modem audiodevice.
- */
- _recorder.AudioDevice = RecorderAudioDevice.Modem;
- Assert.AreEqual((int)RecorderAudioDevice.Modem, (int)_recorder.AudioDevice, "Could not set Audiodevice to Modem");
- Log.Info(LogTag, "Recorder Test AudioDevice finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder AudioSampleRate property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioSampleRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PDV")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void AudioSampleRate_READ_DEFAULT()
- {
- /* TEST CODE
- * Check default value of audiosamplerate.
- */
- Assert.AreEqual(8000, _recorder.AudioSampleRate, "Audio samplerate should be 8000 by default.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder AudioSampleRate property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioSampleRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void AudioSampleRate_READ_WRITE()
- {
- Log.Info(LogTag, "Recorder Test AudioSampleRate starting");
- _recorder.AudioSampleRate = _audioSampleRate;
-
- /* TEST CODE
- * Check if audiosamplerate is readable/writable.
- */
- Assert.AreNotEqual(0, _recorder.AudioSampleRate, "Audiosamplerate should not be 0");
- Assert.AreEqual(_audioSampleRate, _recorder.AudioSampleRate, "Audio samplerate is not same as set value");
- Log.Info(LogTag, "Recorder Test AudioSampleRate finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder AudioSampleRate property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioSampleRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PBM")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void AudioSampleRate_PROPERTY_BELOW_MIN()
- {
- Log.Info(LogTag, "Recorder Test AudioSampleRate starting");
-
-
- /* TEST CODE
- * Check if audiosamplerate is readable/writable.
- */
- try {
- _recorder.AudioSampleRate = -1;
- } catch(Exception e) {
- Log.Info(LogTag, "******* audiosamplerate exception ***********");
- Assert.IsTrue(e is ArgumentException, "Exception should be of type argument exception");
- }
- Log.Info(LogTag, "Recorder Test AudioSampleRate finished");
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder AudioChannel property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioChannel A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void AudioChannel_READ_WRITE()
- {
- Log.Info(LogTag, "Recorder Test AudioChannel starting");
-
-
- /* TEST CODE
- * Test if audiochannel property is readable/writable.
- */
- Assert.AreEqual(2, _recorder.AudioChannel, "AudioChannel value should not be 0");
- _recorder.AudioChannel = _audioChannel;
- Assert.AreEqual(_audioChannel, _recorder.AudioChannel, "Audio channel value is not same as set value");
- Log.Info(LogTag, "Recorder Test AudioChannel finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder AudioChannel property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioChannel A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PBM")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void AudioChannel_PROPERTY_BELOW_MIN()
- {
- Log.Info(LogTag, "Recorder Test AudioChannel starting");
-
- /* TEST CODE
- * Test if audiochannel property is readable/writable.
- */
- try {
- _recorder.AudioChannel = 0;
- } catch(Exception e) {
- Log.Info(LogTag, "************** audiochannel exception **************");
- Assert.IsTrue(e is ArgumentException, "Exception type should be argument exception");
- }
- Log.Info(LogTag, "Recorder Test AudioChannel finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Audio bitrate property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioBitRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void AudioBitRate_READ_WRITE()
- {
- Log.Info(LogTag, "Recorder Test AudioBitRate starting");
- _recorder.AudioBitRate = _audioBitRate;
-
- /* TEST CODE
- * Check if audiobitrate property is readable/writable.
- */
- Assert.AreNotEqual(0, _recorder.AudioBitRate, "AudioBitrate value should not be 0");
- Assert.AreEqual<int>((int)_audioBitRate, (int)_recorder.AudioBitRate, "Audio bitrate is not same as set value");
- Log.Info(LogTag, "Recorder Test AudioBitRate finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Audio bitrate property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioBitRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PBM")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void AudioBitRate_PROPERTY_BELOW_MIN()
- {
- Log.Info(LogTag, "Recorder Test AudioBitRate starting");
- _recorder.AudioBitRate = _audioBitRate;
-
- /* TEST CODE
- * Check if audiobitrate property is readable/writable.
- */
- try {
- _recorder.AudioBitRate = -1;
- } catch(Exception e) {
- Log.Info(LogTag, "************** audiobitrate exception **************");
- Assert.IsTrue(e is ArgumentException, "Exception type should be argument exception");
- }
- Log.Info(LogTag, "Recorder Test AudioBitRate finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Video bitrate property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.VideoBitRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void VideoBitRate_READ_WRITE()
- {
- /* TEST CODE
- * VideoBitRate is for VideoRecorder. so not testing it
- */
- Log.Info(LogTag, "Recorder Test VideoBitRate starting");
- Assert.IsFalse(true, "[NA] VideoBitRate is not testable yet.");
- Log.Info(LogTag, "Recorder Test VideoBitRate finished");
-// _recorder.VideoBitRate = _videoBitRate;
-//
-// /* TEST CODE
-// * Check if videobitrate property is readable/writable.
-// */
-// Assert.AreNotEqual(0, _videoBitRate, "VideoBitrate value should not be 0");
-// Assert.AreEqual(_videoBitRate, _recorder.VideoBitRate, "Video bitrate is not same as set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Recorder Mute property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Mute A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Mute_READ_WRITE()
- {
- Log.Info(LogTag, "Recorder Test Mute starting");
- /* TEST CODE
- * Check for Unmuted state.
- */
- _recorder.Mute = false;
- Assert.IsFalse(_recorder.Mute, "Mute value is not same as set value");
-
- /* TEST CODE
- * Check for muted state.
- */
- _recorder.Mute = true;
- Assert.IsTrue(_recorder.Mute, "Mute value is not same as set value");
- Log.Info(LogTag, "Recorder Test Mute finished");
- }
-
- public static void LimitReached(object sender, RecordingLimitReachedEventArgs e)
- {
- if(e.Type == RecordingLimitType.Time)
- _limitFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Videoresolution property.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.Resolution A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Resolution_READ_WRITE()
- {
- /* TEST CODE
- * Resolution is for VideoRecorder. so not testing it
- */
- Log.Info(LogTag, "Recorder Test Resolution starting");
- Assert.IsFalse(true, "[NA] Resolution is not testable yet.");
- Log.Info(LogTag, "Recorder Test Resolution finished");
-// int width = 640;
-// int height = 480;
-//
-// /* TEST CODE
-// * Check for width and height property.
-// */
-// _recorder.Resolution.Width = width;
-// _recorder.Resolution.Height = height;
-// Assert.AreEqual(width, (int)_recorder.Resolution.Width, "Video resolution width should be same as set value");
-// Assert.AreEqual(height, (int)_recorder.Resolution.Height, "Video resolution height should be same as set value");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test AudioLevel property")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioLevel A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void AudioLevel_PROPERTY_READ_ONLY()
- {
- object level = _recorder.AudioLevel;
-
- Log.Info(LogTag, "Recorder Test AudioLevel starting");
- /* TEST CODE
- * Test audiolevel value.
- */
- Assert.IsNotNull(level, "audiolevel should not be null");
- Log.Info(LogTag, "Recorder Test AudioLevel finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test MotionRate property.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.MotionRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PMIN")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void MotionRate_READ_WRITE()
- {
- /* TEST CODE
- * MotionRate is for VideoRecorder. so not testing it
- */
- Log.Info(LogTag, "Recorder Test MotionRate starting");
- Assert.IsFalse(true, "[NA] MotionRate is not testable yet.");
- Log.Info(LogTag, "Recorder Test MotionRate finished");
-// double motionRate = 0;
-//
-// /* TEST CODE
-// * Check motion rate for videorecorder.
-// */
-// _recorder.MotionRate = motionRate;
-// Assert.IsInstanceOf<double>(_recorder.MotionRate);
-// Assert.AreEqual(motionRate, _recorder.MotionRate, "MotionRate should be same as set value.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test MotionRate property for below minimum value.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.MotionRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PBM")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void MotionRate_Min_READ_WRITE()
- {
- /* TEST CODE
- * MotionRate is for VideoRecorder. so not testing it
- */
- Log.Info(LogTag, "Recorder Test MotionRate starting");
- Assert.IsFalse(true, "[NA] MotionRate is not testable yet.");
- Log.Info(LogTag, "Recorder Test MotionRate finished");
-// double motionRate = -1;
-//
-// /* TEST CODE
-// * Check motion rate for videorecorder.
-// */
-// _recorder.MotionRate = motionRate;
-// Assert.IsInstanceOf<double>(_recorder.MotionRate);
-// Assert.AreEqual(0, _recorder.MotionRate, "MotionRate should be same as set value.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test OrientationTag property.")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.OrientationTag A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void OrientationTag_SET_ENUM_ALL()
- {
- /* TEST CODE
- * OrientationTag is for VideoRecorder. so not testing it
- */
- Log.Info(LogTag, "Recorder Test OrientationTag starting");
- Assert.IsFalse(true, "[NA] OrientationTag is not testable yet.");
- Log.Info(LogTag, "Recorder Test OrientationTag finished");
-
-
-// /* TEST CODE
-// * Check Rotation180 enum value.
-// */
-// _recorder.OrientationTag = RecorderOrientation.Rotation180;
-// Assert.AreEqual((int)RecorderOrientation.Rotation180, _recorder.OrientationTag, "Could not set recorder orientation to 180 degree");
-//
-// /* TEST CODE
-// * Check Rotation270 enum value.
-// */
-// _recorder.OrientationTag = RecorderOrientation.Rotation270;
-// Assert.AreEqual((int)RecorderOrientation.Rotation270, _recorder.OrientationTag, "Could not set recorder orientation to 270 degree");
-//
-// /* TEST CODE
-// * Check Rotation90 enum value.
-// */
-// _recorder.OrientationTag = RecorderOrientation.Rotation90;
-// Assert.AreEqual((int)RecorderOrientation.Rotation90, _recorder.OrientationTag, "Could not set recorder orientation to 90 degree");
-//
-// /* TEST CODE
-// * Check RotationNone enum value.
-// */
-// _recorder.OrientationTag = RecorderOrientation.RotationNone;
-// Assert.AreEqual((int)RecorderOrientation.RotationNone, _recorder.OrientationTag, "Could not set recorder orientation");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SetAudioStreamPolicy Method")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.SetAudioStreamPolicy M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void SetAudioStreamPolicy_NO_EXCEPTION()
- {
- Log.Info(LogTag, "Recorder Test setaudiostreampolicy starting");
- /* TEST CODE
- * Check setting AudioStreamPolicy for recorder.
- */
- try {
- AudioStreamPolicy policy = new AudioStreamPolicy(AudioStreamType.Media);
- _recorder.SetAudioStreamPolicy(policy);
- } catch(Exception ex) {
- Assert.IsFalse(true, "SetAudioStreamPolicy for recorder failed");
- }
- Log.Info(LogTag, "Recorder Test setaudiostreampolicy finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.RecordingLimitReached E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task RecordingLimitReached_CHECK_EVENT()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath and timelimit
- */
- Log.Info(LogTag, "Recorder Test RecordingLimitReached starting");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = _timeLimit;
-
- _recorder.RecordingLimitReached += LimitReached;
-
- /* TEST CODE
- * Test for Limit Reached event.
- */
- _recorder.Prepare();
- _recorder.Start();
- await Task.Delay(5000);
- Assert.IsTrue(_limitFlag, "Limit reached should be occured");
-
- /* POSTCONDITION
- * Cleanup recorder
- */
- _recorder.Commit();
- _recorder.Unprepare();
- Log.Info(LogTag, "Recorder Test RecordingLimitReached finished");
- }
-
- public static void StateChanged(object sender, RecorderStateChangedEventArgs e)
- {
- if(e.Previous != e.Current)
- _stateFlag = true;
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.RecorderStateChanged E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task RecorderStateChanged_CHECK_EVENT()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath and timelimit
- */
- Log.Info(LogTag, "Recorder Test RecorderStateChanged starting");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = _timeLimit;
- _recorder.RecorderStateChanged += StateChanged;
-
- /* TEST CODE
- * Test for State changed event.
- */
- _recorder.Prepare();
- _recorder.Start();
- await Task.Delay(3000);
- Assert.IsTrue(_stateFlag, "state change should be occured");
-
- /* POSTCONDITION
- * Cleanup recorder
- */
- _recorder.Commit();
- _recorder.Unprepare();
- Log.Info(LogTag, "Recorder Test RecorderStateChanged finished");
- }
-
- public static void StatusChanged(object sender, RecordingStatusChangedEventArgs e)
- {
- if(e.ElapsedTime > 0)
- _statusFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.RecordingStatusChanged E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task RecordingStatusChanged_CHECK_EVENT()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath and timelimit
- */
- Log.Info(LogTag, "Recorder Test RecordingStatusChanged starting");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = _timeLimit;
-
- _recorder.RecordingStatusChanged += StatusChanged;
-
- /* TEST CODE
- * Test for Status changed event.
- */
- _recorder.Prepare();
- _recorder.Start();
- await Task.Delay(3000);
- Assert.IsTrue(_statusFlag, "status change should be occured");
-
- /* POSTCONDITION
- * Cleanup recorder.
- */
- _recorder.Commit();
- _recorder.Unprepare();
- Log.Info(LogTag, "Recorder Test RecordingStatusChanged finished");
- }
-
- public static void StreamDelivered(object sender, AudioStreamDeliveredEventArgs e)
- {
- if(e.Stream.Length > 0)
- _streamFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.AudioStreamDelivered E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task AudioStreamDelivered_CHECK_EVENT()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath and timelimit
- */
- Log.Info(LogTag, "Recorder Test AudioStreamDelivered starting");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = _timeLimit;
-
- _recorder.AudioStreamDelivered += StreamDelivered;
-
- /* TEST CODE
- * Test for Status changed event.
- */
- _recorder.Prepare();
- _recorder.Start();
- await Task.Delay(3000);
- Assert.IsTrue(_streamFlag, "stream deliver callback should be occured");
-
- /* POSTCONDITION
- * Cleanup recorder.
- */
- _recorder.Commit();
- _recorder.Unprepare();
- Log.Info(LogTag, "Recorder Test AudioStreamDelivered finished");
- }
-
- public static void ErrorOccured(object sender, RecordingErrorOccurredEventArgs e)
- {
- _errorFlag = true;
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.RecordingErrorOccured E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task RecordingErrorOccurred_CHECK_EVENT()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath and timelimit
- */
- Log.Info(LogTag, "Recorder Test RecordingErrorOccurred starting");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _filePath = "/opt/usr/home/owner/share/res/test.3gp";
- _dirPath = "/opt/usr/home/owner/share/res";
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = 15;
-
- /* TEST CODE
- * Test for Status changed event.
- */
- Directory.CreateDirectory(_dirPath);
- _recorder.RecordingErrorOccurred += ErrorOccured;
- _recorder.Prepare();
- _recorder.Start();
- _recorder.Pause();
- File.Delete(_filePath);
- Directory.Delete(_dirPath);
- await Task.Delay(4000);
- _recorder.Start();
- await Task.Delay(4000);
- Assert.IsTrue(_errorFlag, "recording error callback should be occured");
- Log.Info(LogTag, "Recorder Test RecordingErrorOccurred finished");
- }
-
- static async Task PlayerSrcPrepare(MediaSource src)
- {
- TestPlayer.SetSource(src);
- await TestPlayer.PrepareAsync();
- }
-
- public static void InterruptOccurred(object sender, RecorderInterruptedEventArgs e)
- {
- Log.Info(LogTag, "**************** Interrupted ************");
- _errorFlag = true;
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ")]
- [Property("SPEC", " Tizen.Multimedia.Recorder.RecorderInterrupted E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task RecorderInterrupted_CHECK_EVENT()
- {
- Assert.IsTrue(false, "Recorder Interrupted should be occurred.");
-// Log.Info(LogTag, "Recorder Test RecorderInterrupted starting");
-// _recorder.AudioCodec = _audioCodec;
-// _recorder.FileFormat = _fileFormat;
-// _recorder.FilePath = _filePath;
-// _recorder.TimeLimit = 100;
-//
-// _recorder.RecorderInterrupted += InterruptOccurred;
-// /* TEST CODE
-// * Test for Status changed event.
-// */
-// Log.Info(LogTag, "Recorder Test RecorderInterrupted recorderprepare");
-// _recorder.Prepare();
-// Log.Info(LogTag, "Recorder Test RecorderInterrupted recorderstart");
-//
-// _recorder.Start();
-// _recorder.Pause();
-// await Task.Delay(10000);
-// _recorder.Start();
-// await Task.Delay(5000);
-// //Todo
-// // Add test case for RecorderInterrupted event after knowing
-// // how to test the event.
-// Assert.IsTrue(false, "Recorder Interrupted should be occurred.");
-// Log.Info(LogTag, "Recorder Test RecorderInterrupted recorder commit");
-// _recorder.Commit();
-// Log.Info(LogTag, "Recorder Test RecorderInterrupted recorder unprepare");
-// _recorder.Unprepare();
-// Log.Info(LogTag, "Recorder Test RecorderInterrupted finished");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Runtime.CompilerServices;
-using System.Diagnostics;
-using TestFramework;
-using Tizen;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Tizen.Multimedia.RecorderInterruptedEventArgs Tests")]
- public static class RecorderInterruptedEventArgsTests
- {
- public const string LogTag = "Tizen.Multimedia.RecorderInterruptedEventArgs";
-
- [SetUp]
- public static void Init()
- {
- }
-
- [TearDown]
- public static void Destroy()
- {
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecorderInterruptedEventArgs Current property.")]
- [Property("SPEC", " Tizen.Multimedia.RecorderInterruptedEventArgs.Current A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Current_PROPERTY_READ_ONLY()
- {
- // Todo
- // Need to add test case for Current property after knowing how
- // to test the RecorderInterrupted event.
- Assert.IsTrue(false, "status change should be occured");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecorderInterruptedEventArgs Previous property.")]
- [Property("SPEC", " Tizen.Multimedia.RecorderInterruptedEventArgs.Previous A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Previous_PROPERTY_READ_ONLY()
- {
- // Todo
- // Need to add test case for previous property after knowing how
- // to test the RecorderInterrupted event.
- Assert.IsTrue(false, "status change should be occured");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecorderInterruptedEventArgs Policy property.")]
- [Property("SPEC", " Tizen.Multimedia.RecorderInterruptedEventArgs.Policy A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Policy_PROPERTY_READ_ONLY()
- {
- // Todo
- // Need to add test case for policy property after knowing how
- // to test the RecorderInterrupted event.
- Assert.IsTrue(false, "status change should be occured");
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Runtime.CompilerServices;
-using System.Diagnostics;
-using TestFramework;
-using Tizen;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Tizen.Multimedia.RecorderStateChangedEventArgs Tests")]
- public static class RecorderStateChangedEventArgsTests
- {
- private static Recorder _recorder;
- private static bool _stateFlag = false;
- private static bool _policyFlag = false;
- private static RecorderFileFormat _fileFormat = RecorderFileFormat.ThreeGp;
- private static RecorderAudioCodec _audioCodec = RecorderAudioCodec.Aac;
- private static int _timeLimit = 3;
- private static string _filePath = "/opt/usr/home/owner/share/res/audiosample.3gp";
- public const string LogTag = "Tizen.Multimedia.RecorderStateChangedEventArgs";
-
- [SetUp]
- public static void Init()
- {
- _recorder = new Tizen.Multimedia.Recorder();
- _stateFlag = false;
- _policyFlag = false;
- }
-
- [TearDown]
- public static void Destroy()
- {
- }
-
- public static void StateChanged(object sender, RecorderStateChangedEventArgs e)
- {
- if(e.Previous == RecorderState.Ready && e.Current == RecorderState.Recording)
- _stateFlag = true;
- }
-
- public static void PolicyChanged(object sender, RecorderStateChangedEventArgs e)
- {
- if(e.ByPolicy == false)
- _policyFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecorderStateChangedEventArgs ByPolicy property")]
- [Property("SPEC", " Tizen.Multimedia.RecorderStateChangedEventArgs.ByPolicy A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task ByPolicy_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "Test ByPolicy property starting");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = _timeLimit;
-
- _recorder.RecorderStateChanged += PolicyChanged;
-
- /* TEST CODE
- * Test ByPolicy property of RecorderStateChangedEventArgs.
- */
- _recorder.Prepare();
- _recorder.Start();
- await Task.Delay(3000);
- Assert.IsTrue(_policyFlag, "Bypolicy should be false");
-
- /* POSTCONDITION
- * Cleanup recorder.
- */
- _stateFlag = false;
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.RecorderStateChanged -= PolicyChanged;
- Log.Info(LogTag, "Test ByPolicy property Ended");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecorderStateChangedEventArgs Previous property.")]
- [Property("SPEC", " Tizen.Multimedia.RecorderStateChangedEventArgs.Previous A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task Previous_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath and timelimit
- */
- Log.Info(LogTag, "Test Previous property starting");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = _timeLimit;
-
- _recorder.RecorderStateChanged += StateChanged;
-
- /* TEST CODE
- * Test Previous property of RecorderStateChangedEventArgs.
- */
- _recorder.Prepare();
- _recorder.Start();
- await Task.Delay(3000);
- Assert.IsTrue(_stateFlag, "Previous state of recorder should be in ready state.");
-
- /* POSTCONDITION
- * Cleanup recorder.
- */
- _stateFlag = false;
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.RecorderStateChanged -= StateChanged;
- Log.Info(LogTag, "Test Previous property Ended");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecorderStateChangedEventArgs Current property.")]
- [Property("SPEC", " Tizen.Multimedia.RecorderStateChangedEventArgs.Current A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task Current_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath and timelimit
- */
- Log.Info(LogTag, "Test Current property starting");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = _timeLimit;
-
- _recorder.RecorderStateChanged += StateChanged;
-
- /* TEST CODE
- * Test Current property of RecorderStateChangedEventArgs.
- */
- _recorder.Prepare();
- _recorder.Start();
- await Task.Delay(3000);
- Assert.IsTrue(_stateFlag, "Current state of recorder should be in recording state.");
-
- /* POSTCONDITION
- * Cleanup recorder.
- */
- _stateFlag = false;
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.RecorderStateChanged -= StateChanged;
- Log.Info(LogTag, "Test Current property ended");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Runtime.CompilerServices;
-using System.Diagnostics;
-using TestFramework;
-using Tizen;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Tizen.Multimedia.RecorderVideoResolution Tests")]
- public static class RecorderVideoResolutionTests
- {
- private static Recorder _recorder;
- public const string LogTag = "Tizen.Multimedia.RecorderVideoResolution";
-
- [SetUp]
- public static void Init()
- {
- _recorder = new Tizen.Multimedia.Recorder();
- }
-
- [TearDown]
- public static void Destroy()
- {
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Width property of RecorderVideoResolution class.")]
- [Property("SPEC", " Tizen.Multimedia.RecorderVideoResolution.Width A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Width_SET_GET()
- {
- int width = 640;
- int height = 480;
-
- /* TEST CODE
- * Test Width property of RecorderVideoResolution class.
- */
- Assert.IsTrue(false, "Video resolution height should be same as set value");
- /*_recorder.Resolution.Width = width;
- _recorder.Resolution.Height = height;
- Assert.AreEqual(width, (int)_recorder.Resolution.Width, "Video resolution width should be same as set value");*/
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Height property of RecorderVideoResolution class.")]
- [Property("SPEC", " Tizen.Multimedia.RecorderVideoResolution.Height A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static void Height_SET_GET()
- {
- int width = 640;
- int height = 480;
-
- /* TEST CODE
- * Test Height property of RecorderVideoResolution class.
- */
- Assert.IsTrue(false, "Video resolution height should be same as set value");
- /*_recorder.Resolution.Width = width;
- _recorder.Resolution.Height = height;
- Assert.AreEqual(height, (int)_recorder.Resolution.Height, "Video resolution height should be same as set value");*/
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Runtime.CompilerServices;
-using System.Diagnostics;
-using TestFramework;
-using Tizen;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Tizen.Multimedia.RecordingErrorOccurredEventArgs Tests")]
- public static class RecordingErrorOccurredEventArgsTest
- {
- private static Recorder _recorder;
- private static bool _errorFlag = false;
- private static RecorderFileFormat _fileFormat = RecorderFileFormat.ThreeGp;
- private static RecorderAudioCodec _audioCodec = RecorderAudioCodec.Aac;
- private static string _filePath = "/opt/usr/home/owner/share/res/audiosample.3gp";
- private static string _dirPath;
- public const string LogTag = "Tizen.Multimedia.RecordingErrorOccurredEventArgs";
-
- [SetUp]
- public static void Init()
- {
- _recorder = new Tizen.Multimedia.Recorder();
- _errorFlag = false;
- }
-
- [TearDown]
- public static void Destroy()
- {
- }
-
- public static void ErrorOccured(object sender, RecordingErrorOccurredEventArgs e)
- {
- if(e.Error == RecorderErrorCode.InvalidOperation)
- _errorFlag = true;
- }
-
- public static void StateChanged(object sender, RecordingErrorOccurredEventArgs e)
- {
- if(e.State == RecorderState.Recording)
- _errorFlag = true;
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ")]
- [Property("SPEC", " Tizen.Multimedia.RecordingErrorOccurredEventArgs.Error A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task Error_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath
- * directory path and timelimit
- */
- Log.Info(LogTag, "Test Error property starting.");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _filePath = "/opt/usr/home/owner/share/temp/test.mp3";
- _dirPath = "/opt/usr/home/owner/share/temp";
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = 12;
-
- /* TEST CODE
- * Test Error property of RecordingErrorOccurredEventArgs class.
- */
- Directory.CreateDirectory(_dirPath);
- _recorder.RecordingErrorOccurred += ErrorOccured;
- _recorder.Prepare();
- _recorder.Start();
- _recorder.Pause();
- File.Delete(_filePath);
- Directory.Delete(_dirPath);
- await Task.Delay(4000);
- _recorder.Start();
- await Task.Delay(4000);
- Assert.IsTrue(_errorFlag, "recording error callback should be occured");
-
- /* POSTCONDITION
- * Cleanup recorder.
- */
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.RecordingErrorOccurred -= ErrorOccured;
- Log.Info(LogTag, "Test Error property finished.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ")]
- [Property("SPEC", " Tizen.Multimedia.RecordingErrorOccurredEventArgs.Error A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task State_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath
- * directory path and timelimit
- */
- Log.Info(LogTag, "Test State property starting.");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _filePath = "/opt/usr/home/owner/share/temp/test.mp3";
- _dirPath = "/opt/usr/home/owner/share/temp";
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = 12;
-
- /* TEST CODE
- * Test State property of RecordingErrorOccurredEventArgs class.
- */
- Directory.CreateDirectory(_dirPath);
- _recorder.RecordingErrorOccurred += StateChanged;
- _recorder.Prepare();
- _recorder.Start();
- _recorder.Pause();
- File.Delete(_filePath);
- Directory.Delete(_dirPath);
- await Task.Delay(4000);
- _recorder.Start();
- await Task.Delay(4000);
- Assert.IsTrue(_errorFlag, "recording error callback should be occured");
-
- /* POSTCONDITION
- * Cleanup recorder.
- */
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.RecordingErrorOccurred -= StateChanged;
- Log.Info(LogTag, "Test state property finished.");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Runtime.CompilerServices;
-using System.Diagnostics;
-using TestFramework;
-using Tizen;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Tizen.Multimedia.RecordingLimitReachedEventArgs Tests")]
- public static class RecordingLimitReachedEventArgsTests
- {
- private static Recorder _recorder;
- private static bool _limitFlag = false;
- private static RecorderFileFormat _fileFormat = RecorderFileFormat.ThreeGp;
- private static RecorderAudioCodec _audioCodec = RecorderAudioCodec.Aac;
- private static int _timeLimit = 3;
- private static string _filePath = "/opt/usr/home/owner/share/res/audiosample.3gp";
- public const string LogTag = "Tizen.Multimedia.RecordingLimitReachedEventArgs";
-
- [SetUp]
- public static void Init()
- {
- _recorder = new Tizen.Multimedia.Recorder();
- _limitFlag = false;
- }
-
- [TearDown]
- public static void Destroy()
- {
- }
-
- public static void TimeLimitReached(object sender, RecordingLimitReachedEventArgs e)
- {
- if(e.Type == RecordingLimitType.Time)
- _limitFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecordingLimitReachedEventArgs Type property.")]
- [Property("SPEC", " Tizen.Multimedia.RecordingLimitReachedEventArgs.Type A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task Type_Time_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath and timelimit
- */
- Log.Info(LogTag, "Test Time type property starting");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = _timeLimit;
-
- _recorder.RecordingLimitReached += TimeLimitReached;
-
- /* TEST CODE
- * Test timelimit property of RecordingLimitReachedEventArgs class.
- */
- _recorder.Prepare();
- _recorder.Start();
- await Task.Delay(5000);
- Assert.IsTrue(_limitFlag, "Limit reached should be occured");
-
- /* POSTCONDITION
- * Cleanup recorder.
- */
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.RecordingLimitReached -= TimeLimitReached;
- Log.Info(LogTag, "Test Time type property finished");
- }
-
- public static void SizeLimitReached(object sender, RecordingLimitReachedEventArgs e)
- {
- if(e.Type == RecordingLimitType.Size)
- _limitFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecordingLimitReachedEventArgs Type property.")]
- [Property("SPEC", " Tizen.Multimedia.RecordingLimitReachedEventArgs.Type A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRE")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task Type_Size_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath and timelimit
- */
- Log.Info(LogTag, "Test Size type property starting");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.SizeLimit = 100;
-
- _recorder.RecordingLimitReached += SizeLimitReached;
-
- /* TEST CODE
- * Test timelimit property of RecordingLimitReachedEventArgs class.
- */
- _recorder.Prepare();
- _recorder.Start();
- await Task.Delay(5000);
- Assert.IsTrue(_limitFlag, "Limit reached should be occured");
-
- /* POSTCONDITION
- * Cleanup recorder.
- */
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.RecordingLimitReached -= SizeLimitReached;
- Log.Info(LogTag, "Test Size type property finished.");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Reflection;
-using System.Collections;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Runtime.CompilerServices;
-using System.Diagnostics;
-using TestFramework;
-using Tizen;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Tizen.Multimedia.RecordingStatusChangedEventArgs Tests")]
- public static class RecordingStatusChangedEventArgsTests
- {
- private static Recorder _recorder;
- private static bool _statusFlag = false;
- private static RecorderFileFormat _fileFormat = RecorderFileFormat.ThreeGp;
- private static RecorderAudioCodec _audioCodec = RecorderAudioCodec.Aac;
- private static int _timeLimit = 3;
- private static string _filePath = "/opt/usr/home/owner/share/res/audiosample.3gp";
- private static string _dirPath;
- public const string LogTag = "Tizen.Multimedia.RecordingStatusChangedEventArgs";
-
- [SetUp]
- public static void Init()
- {
- _recorder = new Tizen.Multimedia.Recorder();
- _statusFlag = false;
- }
-
- [TearDown]
- public static void Destroy()
- {
- }
-
- public static void CheckElapsedTime(object sender, RecordingStatusChangedEventArgs e)
- {
- if(e.ElapsedTime > 0)
- _statusFlag = true;
- }
-
- public static void CheckFileSize(object sender, RecordingStatusChangedEventArgs e)
- {
- if(e.FileSize > 0)
- _statusFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecordingStatusChangedEventArgs ElapsedTime property.")]
- [Property("SPEC", " Tizen.Multimedia.RecordingStatusChanged.ElapsedTime A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task ElapsedTime_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath and timelimit
- */
- Log.Info(LogTag, "Test ElapsedTime property starting.");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = _timeLimit;
-
- _recorder.RecordingStatusChanged += CheckElapsedTime;
-
- /* TEST CODE
- * Test ElapsedTime property of RecordingStatusChangedEventArgs class.
- */
- _recorder.Prepare();
- _recorder.Start();
- await Task.Delay(3000);
- Assert.IsTrue(_statusFlag, "status change should be occured");
- _statusFlag = false;
-
- /* POSTCONDITION
- * Cleanup recorder.
- */
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.RecordingStatusChanged -= CheckElapsedTime;
- Log.Info(LogTag, "Test ElapsedTime property finished.");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test RecordingStatusChangedEventArgs FileSize property.")]
- [Property("SPEC", " Tizen.Multimedia.RecordingStatusChanged.FileSize A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Vivek ellur, vivek.ellur@samsung.com")]
- public static async Task FileSize_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION
- * Set Audiocodec, fileformat, filepath and timelimit
- */
- Log.Info(LogTag, "Test FileSize property starting.");
- _recorder.AudioCodec = _audioCodec;
- _recorder.FileFormat = _fileFormat;
- _recorder.FilePath = _filePath;
- _recorder.TimeLimit = _timeLimit;
-
- _recorder.RecordingStatusChanged += CheckFileSize;
-
- /* TEST CODE
- * Test FileSize property of RecordingStatusChangedEventArgs class.
- */
- _recorder.Prepare();
- _recorder.Start();
- await Task.Delay(3000);
- Assert.IsTrue(_statusFlag, "status change should be occured");
- _statusFlag = false;
-
- /* POSTCONDITION
- * Cleanup recorder.
- */
- _recorder.Commit();
- _recorder.Unprepare();
- _recorder.RecordingStatusChanged -= CheckFileSize;
- Log.Info(LogTag, "Test FileSize property finished.");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.SeekOffsetEventArgs tests")]
- public static class SeekOffsetEventArgsTests
- {
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SeekOffsetEventArgs Offset")]
- [Property("SPEC", "Tizen.Multimedia.SeekOffsetEventArgs.Offset A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Offset_PROPERTY_READ_ONLY()
- {
- // TODO: to be filled when MediaPacket class is implemented
- Assert.True(false, "[NA] MediaPacket class unavailable yet");
- }
-
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using TestFramework;
-using Tizen;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.StreamFocusStateChangedEventArgs class")]
- public static class StreamFocusStateChangedEventArgsTests
- {
- private const string LogTag = "TizenTest.Multimedia.StreamFocusStateChangedEventArgs";
- private static bool playbackFlag = false;
-
- [SetUp]
- public static void Init()
- {
- Log.Info(LogTag, "StreamFocusStateChangedEventArgs Test Init");
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "StreamFocusStateChangedEventArgs Test Destroy");
- }
-
- public static void StreamFocusStateChangedCallback2(object sender, StreamFocusStateChangedEventArgs args)
- {
- Log.Info(LogTag, "reason = " + args.FocusChangedReason + " comp = " + AudioStreamFocusChangedReason.Media);
- if(args.FocusChangedReason == AudioStreamFocusChangedReason.Media)
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamFocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.StreamFocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task FocusChangedReason_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "StreamFocusStateChangedEventArgs Test FocusChangedReason read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- AudioStreamPolicy asp2 = new AudioStreamPolicy(AudioStreamType.Media);
-
- asp.StreamFocusStateChanged += StreamFocusStateChangedCallback2;
-
- /* TEST CODE
- * Test FocusChangedReason property of StreamFocusStateChangedEventArgs class.
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- asp2.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- //asp2.ReleaseFocus(AudioStreamFocusOptions.Playback, "");
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackStreamFocusStateWatch CB not called");
- Log.Info(LogTag, "StreamFocusStateChangedEventArgs Test FocusChangedReason read finished");
- }
-
- public static void StreamFocusStateChangedCallback3(object sender, StreamFocusStateChangedEventArgs args)
- {
- string ret = args.ExtraInfoformation;
- Log.Info(LogTag, "ret = [" + args.ExtraInfoformation + "]");
- if (ret.Equals("ExtraInfo"))
- playbackFlag = true;
- }
-
- [Test]
- [Category("P1")]
- [Description("StreamFocusStateChangedEventArgs Reason")]
- [Property("SPEC", "Tizen.Multimedia.StreamFocusStateChangedEventArgs.Reason A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task ExtraInformation_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "StreamFocusStateChangedEventArgs Test ExtraInfoformation read starting");
- playbackFlag = false;
- AudioStreamPolicy asp = new AudioStreamPolicy(AudioStreamType.Media);
- AudioStreamPolicy asp2 = new AudioStreamPolicy(AudioStreamType.Media);
-
- asp.StreamFocusStateChanged += StreamFocusStateChangedCallback3;
-
- /* TEST CODE
- * Test ExtraInformation property of StreamFocusStateChangedEventArgs class.
- */
- asp.AcquireFocus(AudioStreamFocusOptions.Playback, "");
- asp2.AcquireFocus(AudioStreamFocusOptions.Playback, "ExtraInfo");
-
- await Task.Delay(2000);
- Assert.True(playbackFlag, "PlaybackStreamFocusStateWatch CB not called");
- Log.Info(LogTag, "StreamFocusStateChangedEventArgs Test ExtraInfoformation read finished");
- }
- }
-}
-
-
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.StreamInformation tests")]
- public static class StreamInformationTests
- {
- private const string TestSource = "/opt/usr/home/owner/share/res/test.mp3";
- static private Player TestPlayer;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- private static async Task Initialize()
- {
- MediaSource src = new MediaUriSource(TestSource);
- TestPlayer.SetSource(src);
- await TestPlayer.PrepareAsync();
- }
-
- [Test]
- [Category("P0")]
- [Description("Test ContentInfo")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.ContentInfo A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task ContentInfo_PROPERTY_READ_ONLY()
- {
- await Initialize();
-
- // Actual Metadata data tested in ContentInfoTests
- Assert.IsNotNull(TestPlayer.StreamInformation.ContentInfo, "ContentInfo shouldn't be null");
-
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata for Album Art")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.AlbumArt A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task AlbumArt_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
-
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check album art length
- */
- byte[] art = TestPlayer.StreamInformation.AlbumArt;
- Assert.AreEqual(art.Length, 7729, "Incorrect album art size");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata AudioCodec")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.AudioCodec A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task AudioCodec_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check AudioCodec
- */
- Assert.AreEqual(TestPlayer.StreamInformation.AudioCodec, "MPEG-1 Layer 3 (MP3)", "Incorrect codec string. Expected MPEG-1 Layer 3 (MP3), but got " + TestPlayer.StreamInformation.AudioCodec);
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata Duration")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.Duration A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Duration_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
-
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check Duration
- */
- Assert.AreEqual(TestPlayer.StreamInformation.Duration, 33224, "Incorrect duration");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata AudioSampleRate")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.AudioSampleRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task AudioSampleRate_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check AudioSampleRate
- */
- Assert.AreEqual(TestPlayer.StreamInformation.AudioSampleRate, 22050, "Incorrect Audio sample rate");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata AudioChannels")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.AudioChannels A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task AudioChannels_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check AudioChannels
- */
- Assert.AreEqual(TestPlayer.StreamInformation.AudioChannels, 2, "Incorrect number of channels");
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata AudioBitRate")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.AudioBitRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task AudioBitRate_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
- /*
- * PRECONDITION:
- * Set test source to player
- * Prepare player
- */
- await Initialize();
-
- /*
- * TEST:
- * Check AudioBitrate
- */
- Assert.AreEqual(TestPlayer.StreamInformation.AudioBitRate, 128000, "Incorrect bitrate. Expected 128000, but got " + TestPlayer.StreamInformation.AudioBitRate);
-
- /*
- * POST CONDITION:
- * Cleanup player
- */
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata VideoCodec")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.VideoCodec A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void VideoCodec_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
-
- // TODO: Fill this when VideoView class is implemented
- Assert.True(false, "[NA] VideoView class is unavailable yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata VideoFps")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.VideoFps A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void VideoFps_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
-
- // TODO: Fill this when VideoView class is implemented
- Assert.True(false, "[NA] VideoView class is unavailable yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata VideoBitRate")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.VideoBitRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void VideoBitRate_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
-
- // TODO: Fill this when VideoView class is implemented
- Assert.True(false, "[NA] VideoView class is unavailable yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata VideoHeight")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.VideoHeight A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void VideoHeight_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
-
- // TODO: Fill this when VideoView class is implemented
- Assert.True(false, "[NA] VideoView class is unavailable yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Metadata VideoWidth")]
- [Property("SPEC", "Tizen.Multimedia.StreamInformation.VideoWidth A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void VideoWidth_PROPERTY_READ_ONLY()
- {
- /*
- * NOTE: Values of the metadata are checked wrt currently set mediafile (test.mp3)
- */
-
- // TODO: Fill this when VideoView class is implemented
- Assert.True(false, "[NA] VideoView class is unavailable yet");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.IO;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.StreamingConfiguration tests")]
- public static class StreamingConfigurationTests
- {
- private const string CookieString = "name=Tizen; expires=Sun, 02 Dec 2016 GMT";
- private const string UserAgentString = "Test User Agent";
- private const string PdPath = "/opt/usr/home/owner/share/res/pd";
- private const string UrlPath = "http://content.bitsontherun.com/videos/ntPYsD4L-1ahmry41.mp4";
- static private bool flag;
- static private Player TestPlayer;
-
-
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test StreamingConfiguration cookie")]
- [Property("SPEC", "Tizen.Multimedia.StreamingConfiguration.Cookie A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Cookie_READ_WRITE()
- {
- TestPlayer.StreamingConfiguration.Cookie = CookieString;
- Assert.AreEqual(TestPlayer.StreamingConfiguration.Cookie, CookieString, "Cookie was not set");
-
- Assert.True(false, "[NA] Verify cookie when we know how to");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test StreamingConfiguration useragent")]
- [Property("SPEC", "Tizen.Multimedia.StreamingConfiguration.UserAgent A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void UserAgent_READ_WRITE()
- {
- TestPlayer.StreamingConfiguration.UserAgent = UserAgentString;
- Assert.AreEqual(TestPlayer.StreamingConfiguration.UserAgent, UserAgentString, "User agent was not set");
-
- Assert.True(false, "[NA] Verify user-agent when we know how to");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Progressive download path")]
- [Property("SPEC", "Tizen.Multimedia.StreamingConfiguration.ProgressiveDownloadPath A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void ProgressiveDownloadPath_READ_WRITE()
- {
- TestPlayer.StreamingConfiguration.ProgressiveDownloadPath = PdPath;
- Assert.AreEqual(TestPlayer.StreamingConfiguration.ProgressiveDownloadPath, PdPath, "progressive download path not set");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Progressive download path")]
- [Property("SPEC", "Tizen.Multimedia.StreamingConfiguration.ProgressiveDownloadPath A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PCST")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task ProgressiveDownloadPath_CHECK_DOWNLOAD_FILE()
- {
- // PRECONDITION: Start progressive download
-
- if(File.Exists(PdPath))
- File.Delete(PdPath);
-
- MediaSource src = new MediaUriSource(UrlPath);
- TestPlayer.SetSource(src);
- TestPlayer.StreamingConfiguration.ProgressiveDownloadPath = PdPath;
- await TestPlayer.PrepareAsync();
- TestPlayer.Start();
- await Task.Delay(2000);
- TestPlayer.Stop();
- TestPlayer.Unprepare();
-
- // TEST: Check if the progressive download file exists
- Assert.True(File.Exists(PdPath), "Download file doesn't exist");
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test StreamingConfiguration download progress")]
- [Property("SPEC", "Tizen.Multimedia.StreamingConfiguration.DownloadProgress A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void DownloadProgress_PROPERTY_READ_ONLY()
- {
- // DownloadProgress object is created only after Start(), null until then
- Assert.IsNull(TestPlayer.StreamingConfiguration.DownloadProgress, "Unexpected object");
- //Actual values are tested in DownloadProgressTests
- }
-
- [Test]
- [Category("P1")]
- [Description("Test StreamingConfiguration progressive download status")]
- [Property("SPEC", "Tizen.Multimedia.StreamingConfiguration.ProgressiveDownloadStatus A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void ProgressiveDownloadStatus_PROPERTY_READ_ONLY()
- {
- // ProgressiveDownloadStatus object is created only after Start(), null until then
- Assert.IsNull(TestPlayer.StreamingConfiguration.ProgressiveDownloadStatus, "Unexpected object");
- // Actual values are tested in ProgressiveDownloadStatusTests
- }
-
- [Test]
- [Category("P1")]
- [Description("Test BufferingProgressChanged event")]
- [Property("SPEC", "Tizen.Multimedia.StreamingConfiguration.BufferingProgressChanged E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task BufferingProgressChanged_CHECK_EVENT()
- {
- // NOTE: Percent Attribute tested in BufferingProgressEventArgsTests
-
- EventHandler<BufferingProgressEventArgs> handler = (s, e) =>
- {
- flag = true;
- };
-
- // PRECONDITION: Register event handler and start url playback
- flag = false;
- MediaSource src = new MediaUriSource(UrlPath);
- TestPlayer.SetSource(src);
- TestPlayer.StreamingConfiguration.BufferingProgressChanged += handler;
- await TestPlayer.PrepareAsync();
- TestPlayer.Start();
- await Task.Delay(5000);
-
- // TEST: Check if the event was triggered
- Assert.True(flag, "Event wasn't triggered");
-
- // POSTCONDITION: Cleanup player
- TestPlayer.Stop();
- TestPlayer.Unprepare();
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test ProgressiveDownloadMessageChanged event")]
- [Property("SPEC", "Tizen.Multimedia.StreamingConfiguration.ProgressiveDownloadMessageChanged E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task ProgressiveDownloadMessageChanged_CHECK_EVENT()
- {
- // NOTE: Message attribute tested in ProgressiveDownloadMessageEventArgsTests
- EventHandler<ProgressiveDownloadMessageEventArgs> handler = (s, e) =>
- {
- flag = true;
- };
-
- // PRECONDITION: Register event handler and start url playback
- flag = false;
- MediaSource src = new MediaUriSource(UrlPath);
- TestPlayer.SetSource(src);
- TestPlayer.StreamingConfiguration.ProgressiveDownloadPath = PdPath;
- TestPlayer.StreamingConfiguration.ProgressiveDownloadMessageChanged += handler;
- await TestPlayer.PrepareAsync();
- TestPlayer.Start();
- await Task.Delay(5000);
-
- // TEST: Check if the event was triggered
- Assert.True(flag, "Event wasn't triggered");
-
- // POSTCONDITION: Cleanup player
- TestPlayer.Stop();
- TestPlayer.Unprepare();
-
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test VideoStreamChanged event")]
- [Property("SPEC", "Tizen.Multimedia.StreamingConfiguration.VideoStreamChanged E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void VideoStreamChanged_CHECK_EVENT()
- {
- // TODO: Fill this when VideoView is implemented
- Assert.True(false, "[NA] VideoView unavailable yet");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.Subtitle tests")]
- public static class SubtitleTests
- {
- private const string TestSource = "/opt/usr/home/owner/share/res/test.mp3";
- private const string TestSrt = "/opt/usr/home/owner/share/res/test.srt";
- private const string TestSmi = "/opt/usr/home/owner/share/res/test.smi";
-
- static private Player TestPlayer;
- static private int PlayPosition;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- TestPlayer = null;
- //GC.Collect();
- }
-
- private static async Task Initialize(Subtitle sub)
- {
- MediaSource src = new MediaUriSource(TestSource);
- TestPlayer.SetSource(src);
- await TestPlayer.PrepareAsync();
- //Subtitle sub = new Subtitle(TestSmi);
- TestPlayer.Subtitle = sub;
- }
-
- private static void Cleanup()
- {
- TestPlayer.Stop();
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P0")]
- [Description("Test Subtitle instantiation")]
- [Property("SPEC", "Tizen.Multimedia.Subtitle.Subtitle C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Subtitle_INIT()
- {
- Subtitle s = new Subtitle("TestSrt");
- Assert.IsInstanceOf<Subtitle>(s, "should return Subtitle instance");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Subtitle Updated event")]
- [Property("SPEC", "Tizen.Multimedia.Subtitle.Updated E")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "EVL")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Updated_CHECK_EVENT()
- {
- /*
- * PRECONDITION :
- * Set subtitle path
- * Set subtitle object to player instance
- * Register Updated event handler
- * Start player
- */
- Subtitle sub = new Subtitle(TestSrt);
- await Initialize(sub);
- PlayPosition = 0;
- TestPlayer.Subtitle.Updated += EventHandlerUpdated;
- TestPlayer.Start();
-
- /*
- * TEST CODE
- * test subtitle update positions
- */
- await Task.Delay(1000);
- Assert.AreEqual((int)(PlayPosition / 1000), 0, "First subtitle event was not triggered");
-
- await Task.Delay(10000);
- Assert.AreEqual((int)(PlayPosition / 1000), 10, "Second subtitle event was not triggered");
-
- await Task.Delay(5000);
- Assert.AreEqual((int)(PlayPosition / 1000), 15, "Third subtitle event was not triggered");
-
- /*
- * POST CONDITION :
- * Cleanup player
- */
- Cleanup();
-
- }
-
- static void EventHandlerUpdated(object sender, SubtitleUpdatedEventArgs e)
- {
- PlayPosition = TestPlayer.PlayPosition;
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test Subtitle Position")]
- [Property("SPEC", "Tizen.Multimedia.Subtitle.Position A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Position_OFFSET_WRITE()
- {
- /*
- * PRECONDITION :
- * Set subtitle path
- * Set subtitle object to player instance
- * Register Updated event handler
- * Start player
- */
- Subtitle sub = new Subtitle(TestSrt);
- await Initialize(sub);
- PlayPosition = 0;
- TestPlayer.Subtitle.Updated += EventHandlerUpdated;
- TestPlayer.Start();
-
- /*
- * TEST CODE
- * Set position offset and check subtitle.
- * Since position is changed to 6 seconds, subtitle at sec 1.5 is skipped
- */
- await TestPlayer.SetPlayPositionAsync(6000, false);
- TestPlayer.Subtitle.Position = 6000;
-
- await Task.Delay(4500);
- Assert.AreEqual((int)(PlayPosition / 1000), 10, "Second subtitle event was not triggered");
-
- /*
- * POST CONDITION :
- * Cleanup player
- */
- Cleanup();
-
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Subtitle TextTrack")]
- [Property("SPEC", "Tizen.Multimedia.Subtitle.TextTrack A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task TextTrack_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION :
- * Set subtitle path
- * Set subtitle object to player instance
- * Start player
- */
- Subtitle sub = new Subtitle(TestSmi);
- await Initialize(sub);
- TestPlayer.Start();
-
- /*
- * TEST CODE
- * test track count, Language code and Activated
- */
- await Task.Delay(500);
- List<SubtitleTrack> st = TestPlayer.Subtitle.TextTrack.ToList();
- Assert.AreEqual(st.Count, 2, "Incorrect text subtracks");
- Assert.True(st.ElementAt(0).LanguageCode.Equals(" e"), "Invalid Language code");
- Assert.True(st.ElementAt(0).Activated, "Invalid activated value");
- Assert.True(st.ElementAt(1).LanguageCode.Equals(" f"), "Invalid Language code");
- Assert.False(st.ElementAt(1).Activated, "Invalid activated value");
-
- /*
- * POST CONDITION :
- * Cleanup player
- */
- Cleanup();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Subtitle audioTrack")]
- [Property("SPEC", "Tizen.Multimedia.Subtitle.AudioTrack A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task AudioTrack_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION :
- * Set subtitle path
- * Set subtitle object to player instance
- * Start player
- */
- Subtitle sub = new Subtitle(TestSrt);
- await Initialize(sub);
- TestPlayer.Start();
-
- /*
- * TEST CODE
- * test tracks
- */
- List<SubtitleTrack> st = TestPlayer.Subtitle.AudioTrack.ToList();
- Assert.AreEqual(st.Count, 1, "Incorrect audio subtracks");
- Assert.AreEqual(st.ElementAt(0).LanguageCode, "un", "Invalid language code");
- Assert.True(st.ElementAt(0).Activated, "Invalid activated value");
-
- /*
- * POST CONDITION :
- * Cleanup player
- */
- Cleanup();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test Subtitle videoTrack")]
- [Property("SPEC", "Tizen.Multimedia.Subtitle.VideoTrack A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void VideoTrack_PROPERTY_READ_ONLY()
- {
- //TODO: Test video subtitles (.sub) when VideoView is implemented
- Assert.True(false, "[NA] VideoView is unavailable yet");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.SubtitleTrack Tests")]
- public static class SubtitleTrackTests
- {
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P0")]
- [Description("Test SubtitleTrack instantiation")]
- [Property("SPEC", "Tizen.Multimedia.SubtitleTrack.SubtitleTrack C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void SubtitleTrack_INIT()
- {
- SubtitleTrack s = new SubtitleTrack("", true);
- Assert.IsInstanceOf<SubtitleTrack>(s, "should return SubtitleTrack instance");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SubtitleTrack LanguageCode")]
- [Property("SPEC", "Tizen.Multimedia.SubtitleTrack.LanguageCode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void LanguageCode_PROPERTY_READ_WRITE()
- {
- SubtitleTrack s = new SubtitleTrack("EN", true);
- Assert.AreEqual(s.LanguageCode, "EN", "Incorrect language code");
-
- s.LanguageCode = "un";
- Assert.AreEqual(s.LanguageCode, "un", "Incorrect language code");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SubtitleTrack Activated")]
- [Property("SPEC", "Tizen.Multimedia.SubtitleTrack.Activated A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Activated_PROPERTY_READ_WRITE()
- {
- SubtitleTrack s = new SubtitleTrack("EN", true);
- Assert.True(s.Activated, "Incorrect Activated value");
-
- s.Activated = false;
- Assert.False(s.Activated, "Incorrect Activated value");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.SubtitleUpdatedEventArgs Tests")]
- public static class SubtitleUpdatedEventArgsTests
- {
-
- private const string TestSource = "/opt/usr/home/owner/share/res/test.mp3";
- private const string TestSrt = "/opt/usr/home/owner/share/res/test.srt";
-
- static private Player TestPlayer;
- static private uint Duration;
- static private string Text;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- TestPlayer = new Player();
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- TestPlayer = null;
- }
-
- private static async Task Initialize()
- {
- MediaSource src = new MediaUriSource(TestSource);
- TestPlayer.SetSource(src);
- await TestPlayer.PrepareAsync();
- Subtitle sub = new Subtitle(TestSrt);
- TestPlayer.Subtitle = sub;
- }
-
- private static void Cleanup()
- {
- TestPlayer.Stop();
- TestPlayer.Unprepare();
- }
-
- [Test]
- [Category("P1")]
- [Description("Test SubtitleUpdatedEventArgs Duration")]
- [Property("SPEC", "Tizen.Multimedia.SubtitleUpdatedEventArgs.Duration A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Duration_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION :
- * Set subtitle object to player instance
- * Set subtitle path
- * Start player
- */
- await Initialize();
- TestPlayer.Subtitle.Updated += SubtitleEventDuration;
- TestPlayer.Start();
-
- /*
- * TEST CODE
- * Test subtitle duration
- */
- await Task.Delay(2000);
- Assert.AreEqual((int)Duration, 4000, "Incorrect subtitle duration");
-
- await Task.Delay(10000);
- Assert.AreEqual((int)Duration, 5100, "Incorrect subtitle duration");
-
- await Task.Delay(5000);
- Assert.AreEqual((int)Duration, 2700, "Incorrect subtitle duration");
-
- /*
- * POST CONDITION :
- * Clean up player resource
- */
- Cleanup();
- }
-
- static void SubtitleEventDuration(object sender, SubtitleUpdatedEventArgs e)
- {
- Duration = e.Duration;
- }
-
-
- [Test]
- [Category("P1")]
- [Description("Test SubtitleUpdatedEventArgs Text ")]
- [Property("SPEC", "Tizen.Multimedia.SubtitleUpdatedEventArgs.Text A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static async Task Text_PROPERTY_READ_ONLY()
- {
- /*
- * PRECONDITION :
- * Set subtitle object to player instance
- * Set subtitle path
- * Start player
- */
- await Initialize();
- TestPlayer.Subtitle.Updated += SubtitleEventText;
- TestPlayer.Start();
-
- /*
- * TEST CODE
- * Test subtitle text
- */
- await Task.Delay(2000);
- Assert.AreEqual(Text, "SUB 1, test", "Incorrect subtitle text");
-
- await Task.Delay(10000);
- Assert.AreEqual(Text, "SUB 2", "Incorrect subtitle text");
-
- await Task.Delay(5000);
- Assert.AreEqual(Text, "SUB 3", "Incorrect subtitle text");
-
- /*
- * POST CONDITION :
- * Clean up player resource
- */
- Cleanup();
- }
-
- static void SubtitleEventText(object sender, SubtitleUpdatedEventArgs e)
- {
- Text = e.Text;
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.VideoFrameCapture tests")]
- public static class VideoFrameCaptureTests
- {
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test VideoFrameCapture ImageBuffer")]
- [Property("SPEC", "Tizen.Multimedia.VideoFrameCapture.ImageBuffer A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PR0")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void ImageBuffer_PROPERTY_READ_ONLY()
- {
- // TODO: Fill this when VideoView class is implemented
- Assert.True(false, "[NA] VideoView is unavailable yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test VideoFrameCapture Width")]
- [Property("SPEC", "Tizen.Multimedia.VideoFrameCapture.Width A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Width_PROPERTY_READ_ONLY()
- {
- // TODO: Fill this when VideoView class is implemented
- Assert.True(false, "[NA] VideoView is unavailable yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test VideoFrameCapture Height")]
- [Property("SPEC", "Tizen.Multimedia.VideoFrameCapture.Height A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Height_PROPERTY_READ_ONLY()
- {
- // TODO: Fill this when VideoView class is implemented
- Assert.True(false, "[NA] VideoView is unavailable yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test VideoFrameCapture Size")]
- [Property("SPEC", "Tizen.Multimedia.VideoFrameCapture.Size A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Size_PROPERTY_READ_ONLY()
- {
- // TODO: Fill this when VideoView class is implemented
- Assert.True(false, "[NA] VideoView is unavailable yet");
- }
- }
-}
+++ /dev/null
-using TestFramework;
-using System;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Tizen.Multimedia.Tests
-{
-
- [TestFixture]
- [Description("Tizen.Multimedia.VideoStreamEventArgs tests")]
- public static class VideoStreamEventArgsTests
- {
- [SetUp]
- public static void Init()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test VideoStreamEventArgs Height")]
- [Property("SPEC", "Tizen.Multimedia.VideoStreamEventArgs.Height A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Height_PROPERTY_READ_ONLY()
- {
- //TODO: Fill this when VideoView is implemented
- Assert.True(false, "[NA] VideoView is unavailable yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test VideoStreamEventArgs Width")]
- [Property("SPEC", "Tizen.Multimedia.VideoStreamEventArgs.Width A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Width_PROPERTY_READ_ONLY()
- {
- //TODO: Fill this when VideoView is implemented
- Assert.True(false, "[NA] VideoView is unavailable yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test VideoStreamEventArgs Fps")]
- [Property("SPEC", "Tizen.Multimedia.VideoStreamEventArgs.Fps A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void Fps_PROPERTY_READ_ONLY()
- {
- //TODO: Fill this when VideoView is implemented
- Assert.True(false, "[NA] VideoView is unavailable yet");
- }
-
- [Test]
- [Category("P1")]
- [Description("Test VideoStreamEventArgs BitRate")]
- [Property("SPEC", "Tizen.Multimedia.VideoStreamEventArgs.BitRate A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ravi Kiran K N, ravi.kiran@samsung.com")]
- public static void BitRate_PROPERTY_READ_ONLY()
- {
- //TODO: Fill this when VideoView is implemented
- Assert.True(false, "[NA] VideoView is unavailable yet");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using TestFramework;
-using Tizen;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.VolumeChangedEventArgs class")]
- public static class VolumeChangedEventArgsTests
- {
- private const string LogTag = "TizenTest.Multimedia.VolumeChangedEventArgs";
- private static AudioVolume _volume;
- private static bool _vFlag = false;
-
- [SetUp]
- public static void Init()
- {
- _volume = AudioManager.VolumeController;
- Log.Info(LogTag, "VolumeChangedEventArgs Test Init");
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "VolumeChangedEventArgs Test Destroy");
- }
-
- public static void VolumeChangedCallback(object sender, VolumeChangedEventArgs args)
- {
- if(args.Type == AudioVolumeType.Ringtone)
- _vFlag = true;
- else
- Log.Info(LogTag, "Volume level Type not same as the one changed");
- }
-
- [Test]
- [Category("P1")]
- [Description("VolumeChangedEventArgs Type")]
- [Property("SPEC", "Tizen.Multimedia.VolumeChangedEventArgs.Type A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task Type_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "VolumeChangedEventArgs Test Type read starting");
- _volume.Level[AudioVolumeType.Ringtone] = 4;
- _volume.Changed += VolumeChangedCallback;
-
- /* TEST CODE
- * Test volume type property of VolumeChangedEventArgs class.
- */
- _volume.Level[AudioVolumeType.Ringtone] = 5;
- await Task.Delay(3000);
- Assert.True(_vFlag, "Volume Changed Callback should have been called");
- Log.Info(LogTag, "VolumeChangedEventArgs Test Type read finished");
- }
-
- public static void VolumeChangedCallback2(object sender, VolumeChangedEventArgs args)
- {
- if(args.Level == 5)
- _vFlag = true;
- else
- Log.Info(LogTag, "Volume level Type not same as the one changed");
- }
-
- [Test]
- [Category("P1")]
- [Description("VolumeChangedEventArgs Level")]
- [Property("SPEC", "Tizen.Multimedia.VolumeChangedEventArgs.Level A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static async Task Level_PROPERTY_READ_ONLY()
- {
- Log.Info(LogTag, "VolumeChangedEventArgs Test Level read starting");
- _volume.Level[AudioVolumeType.Ringtone] = 4;
- _volume.Changed += VolumeChangedCallback;
-
- /* TEST CODE
- * Test Level Property of VolumeChangedEventArgs class.
- */
- _volume.Level[AudioVolumeType.Ringtone] = 5;
- await Task.Delay(3000);
- Assert.True(_vFlag, "Volume Changed Callback should have been called");
- Log.Info(LogTag, "VolumeChangedEventArgs Test Level read finished");
- }
- }
-}
+++ /dev/null
-using System;
-using System.Linq;
-using System.Collections.Generic;
-using System.Threading;
-using System.Threading.Tasks;
-using Tizen.Multimedia;
-using TestFramework;
-using Tizen;
-
-namespace Tizen.Multimedia.Tests
-{
- [TestFixture]
- [Description("Testing Tizen.Multimedia.VolumeLevel class")]
- public static class VolumeLevelTests
- {
- private const string LogTag = "TizenTest.Multimedia.VolumeLevel";
-
- [SetUp]
- public static void Init()
- {
- Log.Info(LogTag, "VolumeLevel Test Init");
- }
-
- [TearDown]
- public static void Destroy()
- {
- Log.Info(LogTag, "VolumeLevel Test Destroy");
- }
-
- [Test]
- [Category("P1")]
- [Description("VolumeLevel VolumeLevel")]
- [Property("SPEC", "Tizen.Multimedia.VolumeLevel.VolumeLevel C")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "CONSTR")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void VolumeLevel_INIT()
- {
- Log.Info(LogTag, "VolumeLevel Test CONSTR starting");
- VolumeLevel v = new Tizen.Multimedia.VolumeLevel();
-
- /* TEST CODE
- * Test VolumeLevel constructor.
- */
- Assert.IsNotNull(v, "VolumeLevel should not be null");
- Assert.IsInstanceOf<VolumeLevel>(v, "Object should be of type VolumeLevel");
- Log.Info(LogTag, "VolumeLevel Test CONSTR finished");
- }
-
- [Test]
- [Category("P1")]
- [Description("VolumeLevel Item")]
- [Property("SPEC", "Tizen.Multimedia.VolumeLevel.Item A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Ankur Garg, ankur29.garg@samsung.com")]
- public static void Item_READ_WRITE()
- {
- Log.Info(LogTag, "VolumeLevel Test Item starting");
- AudioVolume volume = AudioManager.VolumeController;
-
- /* TEST CODE
- * Test the default property of VolumeLevel indexer class.
- */
- foreach(AudioVolumeType type in Enum.GetValues(typeof(AudioVolumeType))) {
- if (type != AudioVolumeType.None)
- {
- volume.Level[type] = 1;
- Assert.AreEqual(1, volume.Level[type], "Volume level should be same as the value set");
- }
- }
- Log.Info(LogTag, "VolumeLevel Test Item finished");
- }
- }
-}
+++ /dev/null
-using System;
-using TestFramework;
-
-internal abstract class TypeHelper
-{
- internal static TypeHelper Exact<T>()
- {
- return Exact(typeof(T));
- }
-
- internal static TypeHelper Exact(Type t)
- {
- return new ExactComparator(t);
- }
-
- internal static TypeHelper Derived<T>()
- {
- return Derived(typeof(T));
- }
-
- internal static TypeHelper Derived(Type t)
- {
- return (TypeHelper)Activator.CreateInstance(typeof(DerivedComparator<>).MakeGenericType(t));
- }
-
- internal static TypeHelper Any()
- {
- return new AnyComparator();
- }
-
- public abstract bool IsMatchedTo(object o);
-
- public abstract string Expected
- {
- get;
- }
-}
-
-internal class ExactComparator : TypeHelper
-{
- private readonly Type _type;
-
- public ExactComparator(Type t)
- {
- _type = t;
- }
-
- public override bool IsMatchedTo(object o)
- {
- return _type.Equals(o.GetType());
- }
-
- public override string Expected
- {
- get { return "Exact " + _type.Name; }
- }
-}
-
-internal class DerivedComparator<T> : TypeHelper
-{
- public override bool IsMatchedTo(object o)
- {
- return o is T;
- }
-
- public override string Expected
- {
- get { return "A sub type of " + typeof(T).Name; }
- }
-}
-
-internal class AnyComparator : TypeHelper
-{
- public override bool IsMatchedTo(object o)
- {
- return true;
- }
- public override string Expected
- {
- get { return "Any"; }
- }
-}
-
-internal static class AssertHelper
-{
- public delegate void TestDelegate();
-
- public static void Throws(Type exceptionType, TestDelegate d, string msg = null)
- {
- Throws(TypeHelper.Exact(exceptionType), d, msg);
- }
-
- public static void Throws<T>(TestDelegate d, string msg = null)
- {
- Throws(TypeHelper.Derived<T>(), d, msg);
- }
-
- public static void ThrowsExact<T>(TestDelegate d, string msg = null)
- {
- Throws(TypeHelper.Exact<T>(), d, msg);
- }
-
- public static void Throws(TypeHelper typeHelper, TestDelegate d, string msg = null)
- {
- try
- {
- d();
-
- Assert.Fail(msg ?? $"Expected exception : { typeHelper.Expected }, Actual : nothing.");
- }
- catch (Exception e)
- {
- if (!typeHelper.IsMatchedTo(e))
- {
- Assert.Fail(
- msg ?? $"Expected exception : { typeHelper.Expected }, Actual : { e.GetType().Name }.");
- }
- }
- }
-}
-
+++ /dev/null
-internal static class TestCriteria
-{
- /// <summary>
- /// Test whether the method returns a expected value.
- /// </summary>
- public const string MethodReturn = "MR";
-
- /// <summary>
- /// If the method takes Enum type parameter, test the method with all available values listed in Enum.
- /// </summary>
- public const string MethodArgumentEnum = "MAE";
-
- /// <summary>
- /// If the method is supposed to update the state of the object,
- /// check the result with either an opposite method capable of verifying the method call or an attribute.
- /// </summary>
- public const string MethodCheckStatus = "MCST";
-
- /// <summary>
- /// If the method has more than one argument, valid combination of parameters must be tested.
- /// </summary>
- public const string MethodArgumentRange = "MAR";
-
- /// <summary>
- /// Test whether the method throws exceptions as it specifies.
- /// </summary>
- public const string MethodException = "MEX";
-
- /// <summary>
- /// Invoke the constructor and check its return object.
- /// If the constructor under test takes any parameter, check whether value is correctly assigned.
- /// </summary>
- public const string Constructor = "CONSTR";
-
- public const string ConstructorWithNull = "CONSTN";
-
- /// <summary>
- /// Check whether default value of the property under test is as same as the value specified in the spec.
- /// </summary>
- public const string PropertyDefaultValue = "PDV";
-
- public const string PropertyCheckStatus = "PCST";
-
- public const string PropertyMax = "PMAX";
- public const string PropertyMin = "PMIN";
- public const string PropertyAboveMax = "PAM";
- public const string PropertyBelowMin = "PBM";
-
- public const string EventListen = "EVL";
-}
-
-internal static class TestCategories
-{
- public const string SanityCheck = "P0";
- public const string Normal = "P1";
- public const string Negative = "P2";
- public const string Other = "P3";
-}