+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.System;
-using Xamarin.Forms;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("BluetoothLeAdvertiser Tests")]
- public class BluetoothLeAdvertiserTests
- {
- static bool advertisingFlag = false;
- static BluetoothLeAdvertiseData advertiseData = null;
- static BluetoothLeAdvertiser advertiser = null;
- static bool isBluetoothLeSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for BT LE TEST");
-
- Information.TryGetValue("http://tizen.org/feature/network.bluetooth.le", out isBluetoothLeSupported);
-
- if(advertiser == null)
- advertiser = BluetoothAdapter.GetBluetoothLeAdvertiser();
- if (advertiseData == null)
- {
- advertiseData = new BluetoothLeAdvertiseData();
- advertiseData.AdvertisingMode = BluetoothLeAdvertisingMode.BluetoothLeAdvertisingBalancedMode;
- advertiseData.AdvertisingConnectable = true;
- advertiseData.Appearance = 192;
-
- BluetoothLePacketType packetType = BluetoothLePacketType.BluetoothLeAdvertisingPacket;
- string serviceUuid = "1805"; /*time_svc_uuid_16*/
- advertiseData.AddAdvertisingServiceUuid(packetType, serviceUuid);
-
- string serviceSolicitationUuid = "180d"; /*heart_rate_svc_uuid_16*/
- advertiseData.AddAdvertisingServiceSolicitationUuid(packetType, serviceSolicitationUuid);
-
- /*Add sample service Data for testing*/
- BluetoothServiceData serviceData = new BluetoothServiceData();
- serviceData.Uuid = "1805";
- serviceData.DataLength = 3;
- serviceData.Data = new byte[3] { 0x01, 0x02, 0x03 };
- advertiseData.AddAdvertisingServiceData(packetType, serviceData);
-
- advertiseData.IncludeDeviceName = true;
- advertiseData.IncludeTxPowerLevel = true;
-
- /*Add sample Manufacturer Data for testing*/
- packetType = BluetoothLePacketType.BluetoothLeScanResponsePacket;
- ManufacturerData manufData = new ManufacturerData();
- manufData.Data = new byte[5] { 0x01, 0x02, 0x03, 0x04, 0x05};
- manufData.Id = 117;
- manufData.DataLength = 5;
- advertiseData.AddAdvertisingManufacturerData(packetType, manufData);
- }
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
- }
-
- public static async Task WaitAdvertisingFlag()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Inside waitAdvertisingFlag");
- int count = 0;
- while (true)
- {
- await Task.Delay(1000);
- count++;
- if (advertisingFlag)
- break;
- if (count == 8)
- break;
- }
- }
-
- public static void AdvertisingChangedEventHandler(object sender, AdvertisingStateChangedEventArgs e)
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "advertising callback");
- if((int)e.State == (int)BluetoothLeAdvertisingState.BluetoothLeAdvertisingStarted)
- advertisingFlag = true;
- if ((int)e.State == (int)BluetoothLeAdvertisingState.BluetoothLeAdvertisingStopped)
- advertisingFlag = false;
- }
-
- public static async Task AdvertiseSetup()
- {
- // TEST CODE
- if (!advertisingFlag)
- {
- advertiser.StartAdvertising(advertiseData);
- await WaitAdvertisingFlag();
- }
- }
-
-// [Test]
- [Category("P1")]
- [Description("Start Advertising")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeAdvertiser.StartAdvertising M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
- [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")]
- [Step(1, "Tap the Run button")]
- [Postcondition(1, "NA")]
- public static async Task StartAdvertising_RETURN_START_ADVERTISING()
- {
- try
- {
- advertiser.AdvertisingStateChanged += AdvertisingChangedEventHandler;
-
- // TEST CODE
- await AdvertiseSetup();
- Assert.IsTrue(advertisingFlag, "[TestCase][StartAdvertising] Fail and callback is not invoked");
-
- // POSTCONDITION
- advertiser.AdvertisingStateChanged -= AdvertisingChangedEventHandler;
- }
- catch (NotSupportedException)
- {
- if (isBluetoothLeSupported == false)
- {
- BluetoothHelper.DisplayLabel("StartAdvertising_RETURN_START_ADVERTISING");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("StartAdvertising_RETURN_START_ADVERTISING");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using System.Linq;
-using System.Collections.Generic;
-using BluetoothNetworkUtils;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.System;
-using Xamarin.Forms;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("BluetoothLeServiceData Tests")]
- public class BluetoothLeServiceDataTests
- {
- static BluetoothLeDevice leDevice = null;
- static bool isFound = false;
- static bool isBluetoothLeSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Preconditions for BT LeServiceData TEST");
- Information.TryGetValue("http://tizen.org/feature/network.bluetooth.le", out isBluetoothLeSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Postconditions for each TEST");
- }
-
- public static void TestServiceData(BluetoothLePacketType type)
- {
- leDevice.PacketType = type;
- IEnumerable<BluetoothLeServiceData> serviceList = leDevice.GetServiceDataList();
- try
- {
- if (serviceList == null)
- {
- Assert.Fail("[TestCase][ServiceData_PROPERTY] - ServiceDataList is Empty in packet type " + type);
- }
- else
- {
- foreach (BluetoothLeServiceData data in serviceList)
- {
- Log.Info("TCT", "[TestCase][ServiceData_PROPERTY] PASS: Retrieved service data with : " + data.ServiceUuid + " length is " + data.ServiceDataLength);
- }
- isFound = true;
- }
- } catch (Exception ex)
- {
- Assert.Fail("[TestCase][ServiceData_PROPERTY] Exception caught with error : " + ex);
- }
- }
-
-// [Test]
- [Category("P1")]
- [Description("Test ServiceData property of BluetoothLeDevice")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeServiceData.ServiceData A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
- [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")]
- [Precondition(2, "Run StartAdvertising test case on another device")]
- [Step(1, "Tap the Run button")]
- [Postcondition(1, "NA")]
- public static async Task ServiceData_PROPERTY_READ_ONLY()
- {
- try
- {
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
-
- /* TEST CODE */
- // Test with enum value : BluetoothLePacketType.BluetoothLeAdvertisingPacket
- TestServiceData(BluetoothLePacketType.BluetoothLeAdvertisingPacket);
-
- if (!isFound)
- {
- // Test with enum value : BluetoothLePacketType.BluetoothLeScanResponsePacket
- TestServiceData(BluetoothLePacketType.BluetoothLeScanResponsePacket);
- if (!isFound)
- Assert.Fail("[TestCase][ServiceData_PROPERTY] - No ServiceDataList found in either packet type : FAIL ");
- }
-
- isFound = false;
- }
- catch (NotSupportedException)
- {
- if (isBluetoothLeSupported == false)
- {
- BluetoothHelper.DisplayLabel("ServiceData_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("ServiceData_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- public static void TestServiceDataLength(BluetoothLePacketType type)
- {
- leDevice.PacketType = type;
- IEnumerable<BluetoothLeServiceData> serviceList = leDevice.GetServiceDataList();
- try
- {
- if (serviceList == null)
- {
- Assert.Fail("[TestCase][ServiceDataLength_PROPERTY] - ServiceDataList is Empty in packet type " + type);
- }
- else
- {
- foreach (BluetoothLeServiceData data in serviceList)
- {
- Log.Info("TCT", "[TestCase][ServiceDataLength_PROPERTY] PASS: Retrieved service data with length : " + data.ServiceDataLength);
- Assert.IsInstanceOf<int>(data.ServiceDataLength, " Length is not of type int");
- }
- isFound = true;
- }
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][ServiceDataLength_PROPERTY]] Exception caught with error : " + ex);
- }
- }
-
-// [Test]
- [Category("P1")]
- [Description("Test ServiceDataLength property of BluetoothLeDevice")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeServiceData.ServiceDataLength A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
- [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")]
- [Precondition(2, "Run StartAdvertising test case on another device")]
- [Step(1, "Tap the Run button")]
- [Postcondition(1, "NA")]
- public static async Task ServiceDataLength_PROPERTY_READ_ONLY()
- {
- try
- {
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
-
- /* TEST CODE */
- // Test with enum value : BluetoothLePacketType.BluetoothLeAdvertisingPacket
- TestServiceDataLength(BluetoothLePacketType.BluetoothLeAdvertisingPacket);
-
- if (!isFound)
- {
- // Test with enum value : BluetoothLePacketType.BluetoothLeScanResponsePacket
- TestServiceDataLength(BluetoothLePacketType.BluetoothLeScanResponsePacket);
- if (!isFound)
- Assert.Fail("[TestCase][ServiceDataLength_PROPERTY] - No ServiceDataList found in either packet type : PASS ");
- }
-
- isFound = false;
- }
- catch (NotSupportedException)
- {
- if (isBluetoothLeSupported == false)
- {
- BluetoothHelper.DisplayLabel("ServiceDataLength_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("ServiceDataLength_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
-
- public static void TestServiceUuid(BluetoothLePacketType type)
- {
- leDevice.PacketType = type;
- IEnumerable<BluetoothLeServiceData> serviceList = leDevice.GetServiceDataList();
- try
- {
- if (serviceList == null)
- {
- Assert.Fail("[TestCase][ServiceUuid_PROPERTY] - ServiceDataList is Empty in packet type " + type);
- }
- else
- {
- foreach (BluetoothLeServiceData data in serviceList)
- {
- Log.Info("TCT", "[TestCase][ServiceUuid_PROPERTY] PASS: Retrieved service uuid : " + data.ServiceUuid);
- Assert.IsInstanceOf<string>(data.ServiceUuid, " Uuid should be of type string");
- Assert.IsNotNull(data.ServiceUuid, " Uuid should not be empty");
- }
- isFound = true;
- }
- }
- catch (Exception ex)
- {
- Assert.Fail("[TestCase][ServiceUuid_PROPERTY] Exception caught with error : " + ex);
- }
- }
-
-// [Test]
- [Category("P1")]
- [Description("Test ServiceUuid property of BluetoothLeDevice")]
- [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothLeServiceData.ServiceUuid A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
- [Precondition(1, "Open Bluetooth in Settings on test device and turn on Bluetooth")]
- [Precondition(2, "Run StartAdvertising test case on another device")]
- [Step(1, "Tap the Run button")]
- [Postcondition(1, "NA")]
- public static async Task ServiceUuid_PROPERTY_READ_ONLY()
- {
- try
- {
- leDevice = await BluetoothSetup.LeScanSetup();
- Assert.IsNotNull(leDevice, "Precondition failed: Le device instance should not be null");
-
- /* TEST CODE */
- // Test with enum value : BluetoothLePacketType.BluetoothLeAdvertisingPacket
- TestServiceUuid(BluetoothLePacketType.BluetoothLeAdvertisingPacket);
-
- if (!isFound)
- {
- // Test with enum value : BluetoothLePacketType.BluetoothLeScanResponsePacket
- TestServiceUuid(BluetoothLePacketType.BluetoothLeScanResponsePacket);
- if (!isFound)
- Assert.Fail("[TestCase][ServiceUuid_PROPERTY] - No ServiceDataList found in either packet type : FAIL ");
- }
-
- isFound = false;
- }
- catch (NotSupportedException)
- {
- if (isBluetoothLeSupported == false)
- {
- BluetoothHelper.DisplayLabel("ServiceUuid_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothLeSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("ServiceUuid_PROPERTY_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using BluetoothNetworkUtils;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.System;
-using Xamarin.Forms;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("EqualizerStateChangedEventArgs Tests")]
- public class EqualizerStateChangedEventArgsTests
- {
- static BluetoothAudio audioProfile;
- static BluetoothAvrcp avrcpProfile;
- static bool isBluetoothAudioControlSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("http://tizen.org/feature/network.bluetooth.audio.controller", out isBluetoothAudioControlSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- public static async Task Setup()
- {
- avrcpProfile = await BluetoothSetup.GetBluetoothAvrcpProfileUtil();
- audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.All);
- if (audioProfile == null)
- {
- BluetoothHelper.DisplayLabel("The Audio Profile Not Supported");
- Assert.True(true, "Audio Profile is not supported, skip the test case");
- return;
- }
- }
-
- public static void EventHandlerEqualizerStateChanged(object sender, EqualizerStateChangedEventArgs e)
- {
- if (Enum.IsDefined(typeof(EqualizerState), e.State))
- {
- Log.Debug("TCT", "[TestCase][EqualizerStateChanged][State_READ_ONLY] Pass");
- }
- else
- Assert.Fail("[TestCase][EqualizerStateChanged][State_READ_ONLY] Failed");
- }
-
-// [Test]
- [Category("P1")]
- [Description("Test State. Check if State has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.EqualizerStateChangedEventArgs.State A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(5, "Keep discoverable bluetooth headset device near the test device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Change the equalizer state in the connected bluetooth headset")]
- [Postcondition(1, "NA")]
- public static async Task State_READ_ONLY()
- {
- try {
- // PRECONDITION
- await Setup();
- Assert.IsNotNull(avrcpProfile, "Precondition failed: Avrcp Profile should not be null");
- Assert.IsNotNull(audioProfile, "Precondition failed: Audio Profile should not be null");
- audioProfile.Connect(BluetoothAudioProfileType.All);
-
- // TEST CODE
- avrcpProfile.EqualizerStateChanged += EventHandlerEqualizerStateChanged;
- await ManualTest.WaitForConfirm();
-
- // POSTCONDITION
- BluetoothSetup.RemoveBluetoothDeviceProfileUtil();
- avrcpProfile.EqualizerStateChanged -= EventHandlerEqualizerStateChanged;
- }
- catch (NotSupportedException)
- {
- if (isBluetoothAudioControlSupported == false)
- {
- BluetoothHelper.DisplayLabel("State_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothAudioControlSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("State_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using BluetoothNetworkUtils;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.System;
-using Xamarin.Forms;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("RepeatModeChangedEventArgs Tests")]
- public class RepeatModeChangedEventArgsTests
- {
- static BluetoothAvrcp avrcpProfile;
- static BluetoothAudio audioProfile;
- static bool isBluetoothAudioControlSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("http://tizen.org/feature/network.bluetooth.audio.controller", out isBluetoothAudioControlSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- public static async Task Setup()
- {
- avrcpProfile = await BluetoothSetup.GetBluetoothAvrcpProfileUtil();
- audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.All);
- if (audioProfile == null)
- {
- BluetoothHelper.DisplayLabel("The Audio Profile Not Supported");
- Assert.True(true, "Audio Profile is not supported, skip the test case");
- return;
- }
- }
-
- public static void EventHandlerRepeatModeChanged(object sender, RepeatModeChangedEventArgs e)
- {
- if (Enum.IsDefined(typeof(RepeatMode), e.Mode))
- {
- Log.Debug("TCT", "[TestCase][RepeatModeChanged][Mode_READ_ONLY] Pass");
- }
- else
- {
- Assert.Fail("[TestCase][RepeatModeChanged][Mode_READ_ONLY] Failed");
- }
- }
-
-// [Test]
- [Category("P1")]
- [Description("Test Mode. Check the Mode value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.RepeatModeChangedEventArgs.Mode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(5, "Keep discoverable bluetooth headset device near the test device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Change the repeat mode in the connected bluetooth headset")]
- [Postcondition(1, "NA")]
- public static async Task Mode_READ_ONLY()
- {
- try
- {
- // PRECONDITION
- await Setup();
- Assert.IsNotNull(avrcpProfile, "Precondition failed: Avrcp Profile should not be null");
- Assert.IsNotNull(audioProfile, "Precondition failed: Audio Profile should not be null");
- audioProfile.Connect(BluetoothAudioProfileType.All);
-
- // TEST CODE
- avrcpProfile.RepeatModeChanged += EventHandlerRepeatModeChanged;
- await ManualTest.WaitForConfirm();
-
- // POSTCONDITION
- BluetoothSetup.RemoveBluetoothDeviceProfileUtil();
- avrcpProfile.RepeatModeChanged -= EventHandlerRepeatModeChanged;
- }
- catch (NotSupportedException)
- {
- if (isBluetoothAudioControlSupported == false)
- {
- BluetoothHelper.DisplayLabel("Mode_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothAudioControlSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Mode_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using BluetoothNetworkUtils;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.System;
-using Xamarin.Forms;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("ScanModeChangedEventArgs Tests")]
- public class ScanModeChangedEventArgsTests
- {
- static BluetoothAvrcp avrcpProfile;
- static BluetoothAudio audioProfile;
- static bool isBluetoothAudioControlSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("http://tizen.org/feature/network.bluetooth.audio.controller", out isBluetoothAudioControlSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- public static async Task Setup()
- {
- avrcpProfile = await BluetoothSetup.GetBluetoothAvrcpProfileUtil();
- audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.All);
- if (audioProfile == null)
- {
- BluetoothHelper.DisplayLabel("The Audio Profile Not Supported");
- Assert.True(true, "Audio Profile is not supported, skip the test case");
- return;
- }
- }
-
- public static void EventHandlerScanModeChanged(object sender, ScanModeChangedEventArgs e)
- {
- if (Enum.IsDefined(typeof(ScanMode), e.Mode))
- {
- Log.Debug("TCT", "[TestCase][ScanModeChanged][Mode_READ_ONLY] Pass");
- }
- else
- {
- Assert.Fail("[TestCase][ScanModeChanged][Mode_READ_ONLY] Failed");
- }
- }
-
-// [Test]
- [Category("P1")]
- [Description("Test Mode. Check if Mode has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.ScanModeChangedEventArgs.Mode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(5, "Keep discoverable bluetooth headset device near the test device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Change the scan mode in the connected bluetooth headset")]
- [Postcondition(1, "NA")]
- public static async Task Mode_READ_ONLY()
- {
- try
- {
- // PRECONDITION
- await Setup();
- Assert.IsNotNull(avrcpProfile, "Precondition failed: Avrcp Profile should not be null");
- Assert.IsNotNull(audioProfile, "Precondition failed: Audio Profile should not be null");
- audioProfile.Connect(BluetoothAudioProfileType.All);
-
- // TEST CODE
- avrcpProfile.ScanModeChanged += EventHandlerScanModeChanged;
- await ManualTest.WaitForConfirm();
-
- // POSTCONDITION
- BluetoothSetup.RemoveBluetoothDeviceProfileUtil();
- avrcpProfile.ScanModeChanged += EventHandlerScanModeChanged;
- }
- catch (NotSupportedException)
- {
- if (isBluetoothAudioControlSupported == false)
- {
- BluetoothHelper.DisplayLabel("Mode_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothAudioControlSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Mode_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using BluetoothNetworkUtils;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.System;
-using Xamarin.Forms;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("ShuffleModeChangedeventArgs Tests")]
- public class ShuffleModeChangedeventArgsTests
- {
- static BluetoothAvrcp avrcpProfile;
- static BluetoothAudio audioProfile;
- static bool isBluetoothAudioControlSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("http://tizen.org/feature/network.bluetooth.audio.controller", out isBluetoothAudioControlSupported);
- }
-
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
- public static async Task Setup()
- {
- avrcpProfile = await BluetoothSetup.GetBluetoothAvrcpProfileUtil();
- audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.All);
- if (audioProfile == null)
- {
- BluetoothHelper.DisplayLabel("The Audio Profile Not Supported");
- Assert.True(true, "Audio Profile is not supported, skip the test case");
- return;
- }
- }
-
- public static void EventHandlerShuffleModeChanged(object sender, ShuffleModeChangedeventArgs e)
- {
- if (Enum.IsDefined(typeof(ShuffleMode), e.Mode))
- {
- Log.Debug("TCT", "[TestCase][ShuffleModeChanged][Mode_READ_ONLY] Pass");
- }
- else
- {
- Assert.Fail("[TestCase][ShuffleModeChanged][Mode_READ_ONLY] Failed");
- }
- }
-
-// [Test]
- [Category("P1")]
- [Description("Test Mode. Check if Mode has proper value")]
- [Property("SPEC", "Tizen.Network.Bluetooth.ShuffleModeChangedeventArgs.Mode A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRO")]
- [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(5, "Keep discoverable bluetooth headset device near the test device")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Change the shuffle mode in the connected bluetooth headset")]
- [Postcondition(1, "NA")]
- public static async Task Mode_READ_ONLY()
- {
- try
- {
- // PRECONDITION
- await Setup();
- Assert.IsNotNull(avrcpProfile, "Precondition failed: Avrcp Profile should not be null");
- Assert.IsNotNull(audioProfile, "Precondition failed: Audio Profile should not be null");
- audioProfile.Connect(BluetoothAudioProfileType.All);
-
- // TEST CODE
- avrcpProfile.ShuffleModeChanged += EventHandlerShuffleModeChanged;
- await ManualTest.WaitForConfirm();
-
- // POSTCONDITION
- BluetoothSetup.RemoveBluetoothDeviceProfileUtil();
- avrcpProfile.ShuffleModeChanged -= EventHandlerShuffleModeChanged;
- }
- catch (NotSupportedException)
- {
- if (isBluetoothAudioControlSupported == false)
- {
- BluetoothHelper.DisplayLabel("Mode_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothAudioControlSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("Mode_READ_ONLY");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}
+++ /dev/null
-using System;
-using System.Threading.Tasks;
-using BluetoothNetworkUtils;
-using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.System;
-using Xamarin.Forms;
-
-namespace Tizen.Network.Bluetooth.Tests
-{
- [TestFixture]
- [Description("Track Tests")]
- public class TrackTests
- {
- static BluetoothAvrcp avrcpProfile = null;
- static BluetoothAudio audioProfile = null;
- static bool isBluetoothAudioControlSupported = false;
-
- [SetUp]
- public static void Init()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Preconditions for each TEST");
- Information.TryGetValue("http://tizen.org/feature/network.bluetooth.audio.controller", out isBluetoothAudioControlSupported);
- }
- [TearDown]
- public static void Destroy()
- {
- LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST");
- }
-
-// [Test]
- [Category("P1")]
- [Description("Test TrackNum. Check whether TrackNum is readable and writable")]
- [Property("SPEC", "Tizen.Network.Bluetooth.Track.TrackNum A")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- [Property("AUTHOR", "Shikha, shikha.ta@samsung.com")]
- [Precondition(1, "Turn on the bluetooth")]
- [Precondition(2, "Keep discoverable bluetooth headset device near the test device.")]
- [Precondition(3, "Keep two or more tracks in the test device.")]
- [Step(1, "Tap the Run button")]
- [Step(2, "Check if the second track is being played in the device")]
- [Postcondition(1, "NA")]
- public static async Task TrackNum_READ_WRITE()
- {
- try
- {
- if (avrcpProfile == null || audioProfile == null)
- {
- avrcpProfile = await BluetoothSetup.GetBluetoothAvrcpProfileUtil();
- audioProfile = await BluetoothSetup.GetBluetoothAudioProfileUtil(BluetoothAudioProfileType.All);
- if (audioProfile == null)
- {
- BluetoothHelper.DisplayLabel("The Audio Profile Not Supported");
- Assert.True(true, "Audio Profile is not supported, skip the test case");
- return;
- }
- audioProfile.Connect(BluetoothAudioProfileType.HspHfp);
- await Task.Delay(5000);
- }
-
- Track trackInstance = new Track();
- trackInstance.TrackNum = 2;
- avrcpProfile.NotifyTrack(trackInstance);
- await ManualTest.WaitForConfirm();
-
- BluetoothSetup.RemoveBluetoothDeviceProfileUtil();
- }
- catch (NotSupportedException)
- {
- if (isBluetoothAudioControlSupported == false)
- {
- BluetoothHelper.DisplayLabel("TrackNum_READ_WRITE");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (TypeInitializationException e)
- {
- if (isBluetoothAudioControlSupported == false && e.InnerException.GetType() == typeof(NotSupportedException))
- {
- BluetoothHelper.DisplayLabel("TrackNum_READ_WRITE");
- await ManualTest.WaitForConfirm();
- }
- }
- catch (Exception ex)
- {
- Assert.True(false, "Exception occurs. Msg : " + ex.ToString());
- }
- }
- }
-}