From: DoHyun Pyun Date: Wed, 9 Dec 2020 02:58:10 +0000 (+0900) Subject: [Bluetooth][Manual][Non-ACR] Make combine TC for AvrcpControl X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F04%2F249304%2F1;p=test%2Ftct%2Fcsharp%2Fapi.git [Bluetooth][Manual][Non-ACR] Make combine TC for AvrcpControl Change-Id: Id142d4b037ea6e9159ced33987e9a2ef48f03409 Signed-off-by: DoHyun Pyun --- diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAvrcpControl.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAvrcpControl.cs deleted file mode 100644 index 7ddd22b..0000000 --- a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothAvrcpControl.cs +++ /dev/null @@ -1,1062 +0,0 @@ -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("BluetoothAvrcpControl Tests")] - public class BluetoothAvrcpControlTests - { - private BluetoothAvrcpControl _avrcpControlProfile = null; - private static bool _isBluetoothAudioControlSupported = false; - private static bool _isPositionPropertyReadPassed = false; - private static bool _isPlayStatePropertyReadPassed = false; - private static bool _isTrackDataPropertyReadPassed = false; - private static bool _isIsConnectedPropertyReadPassed = false; - private static bool _isRemoteAddressPropertyReadPassed = false; - - [SetUp] - public 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 void Destroy() - { - LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST"); - } - - [Test] - [Category("P1")] - [Description("Listen control connection state changed event")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ConnectionStateChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task ConnectionStateChanged_CHECK_EVENT() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("ConnectionStateChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - EventHandler ControlConnectionChanged = null; - - ControlConnectionChanged = (sender, e) => { - Assert.IsInstanceOf(e.IsConnected, "IsConnected value is not of type bool"); - Assert.AreEqual(e.IsConnected, true, "IsConnected should be true"); - _isIsConnectedPropertyReadPassed = true; - Assert.IsInstanceOf(e.RemoteAddress, "RemoteAddress value is not of type string"); - Assert.AreNotEqual(e.RemoteAddress, "", "RemoteAddress is invalid"); - _isRemoteAddressPropertyReadPassed = true; - BluetoothHelper.DisplayPassLabel("ConnectionStateChanged_CHECK_EVENT"); - }; - - _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; - await _avrcpControlProfile.ConnectAsync(); - await ManualTest.WaitForConfirm(); - _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Listen control connection state changed event")] - [Property("SPEC", "Tizen.Network.Bluetooth.AvrcpControlConnectionChangedEventArgs.IsConnected A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task IsConnected_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("IsConnected_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_isIsConnectedPropertyReadPassed == true) - { - BluetoothHelper.DisplayPassLabel("IsConnected_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - EventHandler ControlConnectionChanged = null; - - ControlConnectionChanged = (sender, e) => { - Assert.IsInstanceOf(e.IsConnected, "IsConnected value is not of type bool"); - Assert.AreEqual(e.IsConnected, true, "IsConnected should be true"); - BluetoothHelper.DisplayPassLabel("IsConnected_PROPERTY_READ_ONLY"); - }; - - _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; - await _avrcpControlProfile.ConnectAsync(); - await ManualTest.WaitForConfirm(); - _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Listen control connection state changed event")] - [Property("SPEC", "Tizen.Network.Bluetooth.AvrcpControlConnectionChangedEventArgs.RemoteAddress A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task RemoteAddress_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("RemoteAddress_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_isRemoteAddressPropertyReadPassed == true) - { - BluetoothHelper.DisplayPassLabel("RemoteAddress_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - EventHandler ControlConnectionChanged = null; - - ControlConnectionChanged = (sender, e) => { - Assert.IsInstanceOf(e.RemoteAddress, "RemoteAddress value is not of type string"); - Assert.AreNotEqual(e.RemoteAddress, "", "RemoteAddress is invalid"); - BluetoothHelper.DisplayPassLabel("RemoteAddress_PROPERTY_READ_ONLY"); - }; - - _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; - await _avrcpControlProfile.ConnectAsync(); - await ManualTest.WaitForConfirm(); - _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Listen Play Position Changed")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.PositionChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT headset.")] - [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] - [Step(1, "Tap the Run button")] - [Step(2, "Change play position of a track by dragging seek bar on the target")] - [Postcondition(1, "NA")] - public async Task PositionChanged_CHECK_EVENT() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("PositionChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - EventHandler PositionChanged = null; - - PositionChanged = (sender, e) => - { - Assert.IsInstanceOf(e.Position, "Position value is not of type uint"); - _isPositionPropertyReadPassed = true; - BluetoothHelper.DisplayPassLabel("PositionChanged_CHECK_EVENT"); - }; - - _avrcpControlProfile.PositionChanged += PositionChanged; - await _avrcpControlProfile.ConnectAsync(); - await ManualTest.WaitForConfirm(); - _avrcpControlProfile.PositionChanged -= PositionChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Listen Play Position Changed")] - [Property("SPEC", "Tizen.Network.Bluetooth.PositionChangedEventArgs.Position A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT headset.")] - [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] - [Step(1, "Tap the Run button")] - [Step(2, "Change play position of a track by dragging seek bar on the target")] - [Postcondition(1, "NA")] - public async Task Position_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("Position_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_isPositionPropertyReadPassed == true) - { - BluetoothHelper.DisplayPassLabel("Position_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - EventHandler PositionChanged = null; - - PositionChanged = (sender, e) => - { - Assert.IsInstanceOf(e.Position, "Position value is not of type uint"); - BluetoothHelper.DisplayPassLabel("Position_PROPERTY_READ_ONLY"); - }; - - _avrcpControlProfile.PositionChanged += PositionChanged; - await _avrcpControlProfile.ConnectAsync(); - await ManualTest.WaitForConfirm(); - _avrcpControlProfile.PositionChanged -= PositionChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Listen PlayState changed")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.PlayStateChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT headset.")] - [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] - [Step(1, "Tap the Run button")] - [Step(2, "Play/pause a track on the target")] - [Postcondition(1, "NA")] - public async Task PlayStateChanged_CHECK_EVENT() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("PlayStateChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - EventHandler PlayStateChanged = null; - - PlayStateChanged = (sender, e) => - { - Assert.IsInstanceOf(e.PlayState, "PlayState value is not of type PlayerState"); - _isPlayStatePropertyReadPassed = true; - BluetoothHelper.DisplayPassLabel("PlayStateChanged_CHECK_EVENT"); - }; - - _avrcpControlProfile.PlayStateChanged += PlayStateChanged; - await _avrcpControlProfile.ConnectAsync(); - await ManualTest.WaitForConfirm(); - _avrcpControlProfile.PlayStateChanged -= PlayStateChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Test Mode: Check if state has proper value")] - [Property("SPEC", "Tizen.Network.Bluetooth.PlayStateChangedEventArgs.PlayState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT headset.")] - [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] - [Step(1, "Tap the Run button")] - [Step(2, "Play/pause a track on the target")] - [Postcondition(1, "NA")] - public async Task PlayState_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("PlayState_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_isPlayStatePropertyReadPassed == true) - { - BluetoothHelper.DisplayPassLabel("PlayState_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - EventHandler PlayStateChanged = null; - - PlayStateChanged = (sender, e) => - { - Assert.IsInstanceOf(e.PlayState, "PlayState value is not of type PlayerState"); - BluetoothHelper.DisplayPassLabel("PlayState_PROPERTY_READ_ONLY"); - }; - - _avrcpControlProfile.PlayStateChanged += PlayStateChanged; - await _avrcpControlProfile.ConnectAsync(); - await ManualTest.WaitForConfirm(); - _avrcpControlProfile.PlayStateChanged -= PlayStateChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Listen Track Info changed")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.TrackInfoChanged E")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "EVL")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT headset.")] - [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] - [Step(1, "Tap the Run button")] - [Step(2, "Change track on the target")] - [Postcondition(1, "NA")] - public async Task TrackInfoChanged_CHECK_EVENT() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("TrackInfoChanged_CHECK_EVENT"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - EventHandler TrackInfoChanged = null; - - TrackInfoChanged = (sender, e) => - { - Assert.IsInstanceOf(e.TrackData, "TrackData value is not of type Track"); - _isTrackDataPropertyReadPassed = true; - BluetoothHelper.DisplayPassLabel("TrackInfoChanged_CHECK_EVENT"); - }; - - _avrcpControlProfile.TrackInfoChanged += TrackInfoChanged; - await _avrcpControlProfile.ConnectAsync(); - await ManualTest.WaitForConfirm(); - _avrcpControlProfile.TrackInfoChanged -= TrackInfoChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Listen Track Info changed")] - [Property("SPEC", "Tizen.Network.Bluetooth.TrackInfoChangedEventArgs.TrackData A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRO")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT headset.")] - [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] - [Step(1, "Tap the Run button")] - [Step(2, "Change track on the target")] - [Postcondition(1, "NA")] - public async Task TrackData_PROPERTY_READ_ONLY() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("TrackData_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_isTrackDataPropertyReadPassed == true) - { - BluetoothHelper.DisplayPassLabel("TrackData_PROPERTY_READ_ONLY"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - EventHandler TrackInfoChanged = null; - - TrackInfoChanged = (sender, e) => - { - Assert.IsInstanceOf(e.TrackData, "TrackData value is not of type Track"); - BluetoothHelper.DisplayPassLabel("TrackData_PROPERTY_READ_ONLY"); - }; - - _avrcpControlProfile.TrackInfoChanged += TrackInfoChanged; - await _avrcpControlProfile.ConnectAsync(); - await ManualTest.WaitForConfirm(); - _avrcpControlProfile.TrackInfoChanged -= TrackInfoChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Connect AVRCP Control")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ConnectAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - EventHandler ControlConnectionChanged = null; - - ControlConnectionChanged = (sender, e) => { - BluetoothHelper.DisplayPassLabel("ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST"); - }; - _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; - - await _avrcpControlProfile.ConnectAsync(); - await ManualTest.WaitForConfirm(); - _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Disconnect AVRCP Control")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.DisconnectAsync M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - EventHandler ControlConnectionChanged = null; - ControlConnectionChanged = (sender, e) => { - if (e.IsConnected == false) - { - BluetoothHelper.DisplayPassLabel("DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST"); - } - }; - _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; - - await _avrcpControlProfile.ConnectAsync(); - await Task.Delay(3000); - await _avrcpControlProfile.DisconnectAsync(); - await ManualTest.WaitForConfirm(); - _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - } - - [Test] - [Category("P1")] - [Description("Get Play Status")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.GetPlayStatus M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task GetPlayStatus_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("GetPlayStatus_READ_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - await _avrcpControlProfile.ConnectAsync(); - PlayerState state = _avrcpControlProfile.GetPlayStatus(); - bool result = Enum.IsDefined(typeof(PlayerState), state); - Assert.True(result, "State value is not defined in enum"); - Assert.IsInstanceOf(state, "State value is not of type PlayerState"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Get Play Progress Position")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.GetPosition M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task GetPosition_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("GetPosition_READ_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - await _avrcpControlProfile.ConnectAsync(); - uint state = _avrcpControlProfile.GetPosition(); - Assert.IsInstanceOf(state, "State value is not of type uint"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Check whether EqualizerState is readable and writable")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.EqualizerState A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task EqualizerState_READ_WRITE() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("EqualizerState_READ_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - await _avrcpControlProfile.ConnectAsync(); - _avrcpControlProfile.EqualizerState = EqualizerState.On; - EqualizerState state = _avrcpControlProfile.EqualizerState; - Assert.IsInstanceOf(state, "State value is not of type EqualizerState"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Check whether ShuffleMode is readable and writable")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ShuffleMode A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task ShuffleMode_READ_WRITE() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("ShuffleMode_READ_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - await _avrcpControlProfile.ConnectAsync(); - _avrcpControlProfile.ShuffleMode = ShuffleMode.AllTrack; - ShuffleMode state = _avrcpControlProfile.ShuffleMode; - Assert.IsInstanceOf(state, "Mode value is not of type ShuffleMode"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Check whether ScanMode is readable and writable")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ScanMode A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task ScanMode_READ_WRITE() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("ScanMode_READ_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - await _avrcpControlProfile.ConnectAsync(); - _avrcpControlProfile.ScanMode = ScanMode.AllTrack; - ScanMode state = _avrcpControlProfile.ScanMode; - Assert.IsInstanceOf(state, "Mode value is not of type ScanMode"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Check whether RepeatMode is readable and writable")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.RepeatMode A")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "PRW")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task RepeatMode_READ_WRITE() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("RepeatMode_READ_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - await _avrcpControlProfile.ConnectAsync(); - _avrcpControlProfile.RepeatMode = RepeatMode.AllTrack; - RepeatMode state = _avrcpControlProfile.RepeatMode; - Assert.IsInstanceOf(state, "Mode value is not of type RepeatMode"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Get Track Info")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.GetTrackInfo M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task GetTrackInfo_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("GetTrackInfo_READ_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); - } - - await _avrcpControlProfile.ConnectAsync(); - Track track = _avrcpControlProfile.GetTrackInfo(); - Assert.IsInstanceOf(track, "track value is not of type Track"); - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - - [Test] - [Category("P1")] - [Description("Send a specific player state command to the target")] - [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.SendPlayerCommand M")] - [Property("SPEC_URL", "-")] - [Property("CRITERIA", "MR")] - [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] - [Precondition(1, "Turn on the bluetooth")] - [Precondition(2, "Paired with BT target device (phone, watch, etc).")] - [Step(1, "Tap the Run button")] - [Postcondition(1, "NA")] - public async Task SendPlayerCommand_RETURN_VALUE() - { - try - { - /* We can't occupy the precondition, if AvrcpControl feature is not supported in Manual TC */ - if (_isBluetoothAudioControlSupported == false) - { - BluetoothHelper.DisplayLabel("SendPlayerCommand_WRITE_VALUE"); - await ManualTest.WaitForConfirm(); - return; - } - - if (_avrcpControlProfile == null) - { - _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); - Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: avrcpavrcpControlProfile Profile should not be null"); - } - - await _avrcpControlProfile.ConnectAsync(); - _avrcpControlProfile.SendPlayerCommand(PlayerCommand.Next); - //If there is no exception when method is called, the test is considered PASSED. - } - catch (Exception ex) - { - Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); - } - finally - { - if (_avrcpControlProfile != null) - { - await _avrcpControlProfile.DisconnectAsync(); - } - } - } - } -} diff --git a/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine5_AvrcpControl.cs b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine5_AvrcpControl.cs new file mode 100644 index 0000000..190882d --- /dev/null +++ b/tct-suite-vs/Tizen.Bluetooth.Manual.Tests/testcase/TSBluetoothCombine5_AvrcpControl.cs @@ -0,0 +1,745 @@ +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("BluetoothAvrcpControl Tests")] + public class BluetoothAvrcpControlTests + { + private BluetoothAvrcpControl _avrcpControlProfile = null; + private static bool _isBluetoothAudioControlSupported = false; + + /* PASS flag Variaibles for TCs */ + static bool pass_ConnectionStateChanged_CHECK_EVENT = false; + static bool pass_IsConnected_PROPERTY_READ_ONLY = false; + static bool pass_RemoteAddress_PROPERTY_READ_ONLY = false; + static bool pass_PositionChanged_CHECK_EVENT = false; + static bool pass_Position_PROPERTY_READ_ONLY = false; + static bool pass_PlayStateChanged_CHECK_EVENT = false; + static bool pass_PlayState_PROPERTY_READ_ONLY = false; + static bool pass_TrackInfoChanged_CHECK_EVENT = false; + static bool pass_TrackData_PROPERTY_READ_ONLY = false; + static bool pass_ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST = false; + static bool pass_DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST = false; + static bool pass_GetPlayStatus_RETURN_VALUE = false; + static bool pass_GetPosition_RETURN_VALUE = false; + static bool pass_EqualizerState_READ_WRITE = false; + static bool pass_ShuffleMode_READ_WRITE = false; + static bool pass_ScanMode_READ_WRITE = false; + static bool pass_RepeatMode_READ_WRITE = false; + static bool pass_GetTrackInfo_RETURN_VALUE = false; + static bool pass_SendPlayerCommand_RETURN_VALUE = false; + + [SetUp] + public 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 void Destroy() + { + LogUtils.Write(LogUtils.DEBUG, LogUtils.INFO, "Postconditions for each TEST"); + } + + public async Task AvrcpControlCombine_TEST() + { + try + { + if (_avrcpControlProfile == null) + { + _avrcpControlProfile = await BluetoothSetup.GetBluetoothAvrcpControlProfileUtil(); + Assert.IsNotNull(_avrcpControlProfile, "Precondtion failed: _avrcpControlProfile should not be null"); + } + + /* PASS condition for ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST */ + await _avrcpControlProfile.ConnectAsync(); + await Task.Delay(3000); + pass_ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST = true; + + /* PASS condition for DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST */ + await _avrcpControlProfile.DisconnectAsync(); + await Task.Delay(2000); + pass_DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST = true; + + EventHandler ControlConnectionChanged = null; + + ControlConnectionChanged = (sender, e) => { + /* PASS condition for ConnectionStateChanged_CHECK_EVENT */ + pass_ConnectionStateChanged_CHECK_EVENT = true; + + /* PASS condition for IsConnected_PROPERTY_READ_ONLY */ + Assert.IsInstanceOf(e.IsConnected, "IsConnected value is not of type bool"); + Assert.AreEqual(e.IsConnected, true, "IsConnected should be true"); + pass_IsConnected_PROPERTY_READ_ONLY = true; + + /* PASS condition for RemoteAddress_PROPERTY_READ_ONLY */ + Assert.IsInstanceOf(e.RemoteAddress, "RemoteAddress value is not of type string"); + Assert.AreNotEqual(e.RemoteAddress, "", "RemoteAddress is invalid"); + pass_RemoteAddress_PROPERTY_READ_ONLY = true; + + BluetoothHelper.DisplayCustomLabel("AvrcpControl is connected.\n Please type AVRCP command on sdb shell"); + + _avrcpControlProfile.ConnectionStateChanged -= ControlConnectionChanged; + }; + + _avrcpControlProfile.ConnectionStateChanged += ControlConnectionChanged; + await _avrcpControlProfile.ConnectAsync(); + await Task.Delay(3000); + + /* PASS condition for GetPlayStatus_RETURN_VALUE */ + PlayerState play_state = _avrcpControlProfile.GetPlayStatus(); + bool result = Enum.IsDefined(typeof(PlayerState), play_state); + Assert.True(result, "State value is not defined in enum"); + Assert.IsInstanceOf(play_state, "State value is not of type PlayerState"); + pass_GetPlayStatus_RETURN_VALUE = true; + + /* PASS condition for GetPosition_RETURN_VALUE */ + uint position = _avrcpControlProfile.GetPosition(); + Assert.IsInstanceOf(position, "position value is not of type uint"); + pass_GetPosition_RETURN_VALUE = true; + + /* PASS condition for EqualizerState_READ_WRITE */ + _avrcpControlProfile.EqualizerState = EqualizerState.On; + EqualizerState equalizer_state = _avrcpControlProfile.EqualizerState; + Assert.IsInstanceOf(equalizer_state, "State value is not of type EqualizerState"); + pass_EqualizerState_READ_WRITE = true; + + /* PASS condition for ShuffleMode_READ_WRITE */ + _avrcpControlProfile.ShuffleMode = ShuffleMode.AllTrack; + ShuffleMode shuffle_mode = _avrcpControlProfile.ShuffleMode; + Assert.IsInstanceOf(shuffle_mode, "Mode value is not of type ShuffleMode"); + pass_ShuffleMode_READ_WRITE = true; + + /* PASS condition for ScanMode_READ_WRITE */ + _avrcpControlProfile.ScanMode = ScanMode.AllTrack; + ScanMode scan_mode = _avrcpControlProfile.ScanMode; + Assert.IsInstanceOf(scan_mode, "Mode value is not of type ScanMode"); + pass_ScanMode_READ_WRITE = true; + + /* PASS condition for RepeatMode_READ_WRITE */ + _avrcpControlProfile.RepeatMode = RepeatMode.AllTrack; + RepeatMode repeat_state = _avrcpControlProfile.RepeatMode; + Assert.IsInstanceOf(repeat_state, "Mode value is not of type RepeatMode"); + pass_RepeatMode_READ_WRITE = true; + + /* PASS condition for GetTrackInfo_RETURN_VALUE */ + Track track = _avrcpControlProfile.GetTrackInfo(); + Assert.IsInstanceOf(track, "track value is not of type Track"); + pass_GetTrackInfo_RETURN_VALUE = true; + + /* PASS condition for SendPlayerCommand_RETURN_VALUE */ + _avrcpControlProfile.SendPlayerCommand(PlayerCommand.Next); + pass_SendPlayerCommand_RETURN_VALUE = true; + + /* PASS condition for PositionChanged_CHECK_EVENT */ + EventHandler PositionChanged = null; + + PositionChanged = (sender, e) => + { + pass_PositionChanged_CHECK_EVENT = true; + + /* PASS condition for Position_PROPERTY_READ_ONLY */ + Assert.IsInstanceOf(e.Position, "Position value is not of type uint"); + pass_Position_PROPERTY_READ_ONLY = true; + + if (pass_PositionChanged_CHECK_EVENT == true && + pass_PlayStateChanged_CHECK_EVENT == true && + pass_TrackInfoChanged_CHECK_EVENT == true) + BluetoothHelper.DisplayPassLabel("AvrcpControlCombine_TEST"); + + _avrcpControlProfile.PositionChanged -= PositionChanged; + }; + + _avrcpControlProfile.PositionChanged += PositionChanged; + + /* PASS condition for PlayStateChanged_CHECK_EVENT */ + EventHandler PlayStateChanged = null; + + PlayStateChanged = (sender, e) => + { + pass_PlayStateChanged_CHECK_EVENT = true; + + /* PASS condition for PlayState_PROPERTY_READ_ONLY */ + Assert.IsInstanceOf(e.PlayState, "PlayState value is not of type PlayerState"); + pass_PlayState_PROPERTY_READ_ONLY = true; + + if (pass_PositionChanged_CHECK_EVENT == true && + pass_PlayStateChanged_CHECK_EVENT == true && + pass_TrackInfoChanged_CHECK_EVENT == true) + BluetoothHelper.DisplayPassLabel("AvrcpControlCombine_TEST"); + + _avrcpControlProfile.PlayStateChanged -= PlayStateChanged; + }; + + _avrcpControlProfile.PlayStateChanged += PlayStateChanged; + + /* PASS condition for TrackInfoChanged_CHECK_EVENT */ + EventHandler TrackInfoChanged = null; + + TrackInfoChanged = (sender, e) => + { + pass_TrackInfoChanged_CHECK_EVENT = true; + + /* PASS condition for TrackData_PROPERTY_READ_ONLY */ + Assert.IsInstanceOf(e.TrackData, "TrackData value is not of type Track"); + pass_TrackData_PROPERTY_READ_ONLY = true; + + if (pass_PositionChanged_CHECK_EVENT == true && + pass_PlayStateChanged_CHECK_EVENT == true && + pass_TrackInfoChanged_CHECK_EVENT == true) + BluetoothHelper.DisplayPassLabel("AvrcpControlCombine_TEST"); + + _avrcpControlProfile.TrackInfoChanged -= TrackInfoChanged; + }; + + _avrcpControlProfile.TrackInfoChanged += TrackInfoChanged; + + await ManualTest.WaitForConfirm(); + } + catch (Exception ex) + { + Assert.True(false, "Exception occurs. Msg : " + ex.ToString()); + } + finally + { + if (_avrcpControlProfile != null) + { + await _avrcpControlProfile.DisconnectAsync(); + } + } + } + + [Test] + [Category("P1")] + [Description("Listen control connection state changed event")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ConnectionStateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ConnectionStateChanged_CHECK_EVENT() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("ConnectionStateChanged_CHECK_EVENT"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_ConnectionStateChanged_CHECK_EVENT == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_ConnectionStateChanged_CHECK_EVENT, "[TestCase][ConnectionStateChanged_CHECK_EVENT] Fail"); + } + + [Test] + [Category("P1")] + [Description("Listen control connection state changed event")] + [Property("SPEC", "Tizen.Network.Bluetooth.AvrcpControlConnectionChangedEventArgs.IsConnected A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task IsConnected_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("IsConnected_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_IsConnected_PROPERTY_READ_ONLY == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_IsConnected_PROPERTY_READ_ONLY, "[TestCase][IsConnected_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Listen control connection state changed event")] + [Property("SPEC", "Tizen.Network.Bluetooth.AvrcpControlConnectionChangedEventArgs.RemoteAddress A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task RemoteAddress_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("IsConnected_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_IsConnected_PROPERTY_READ_ONLY == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_IsConnected_PROPERTY_READ_ONLY, "[TestCase][IsConnected_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Listen Play Position Changed")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.PositionChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Change play position of a track by dragging seek bar on the target")] + [Postcondition(1, "NA")] + public async Task PositionChanged_CHECK_EVENT() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("PositionChanged_CHECK_EVENT"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_PositionChanged_CHECK_EVENT == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_PositionChanged_CHECK_EVENT, "[TestCase][PositionChanged_CHECK_EVENT] Fail"); + } + + [Test] + [Category("P1")] + [Description("Listen Play Position Changed")] + [Property("SPEC", "Tizen.Network.Bluetooth.PositionChangedEventArgs.Position A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Change play position of a track by dragging seek bar on the target")] + [Postcondition(1, "NA")] + public async Task Position_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("Position_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_Position_PROPERTY_READ_ONLY == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_Position_PROPERTY_READ_ONLY, "[TestCase][Position_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Listen PlayState changed")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.PlayStateChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Play/pause a track on the target")] + [Postcondition(1, "NA")] + public async Task PlayStateChanged_CHECK_EVENT() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("PlayStateChanged_CHECK_EVENT"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_PlayStateChanged_CHECK_EVENT == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_PlayStateChanged_CHECK_EVENT, "[TestCase][PlayStateChanged_CHECK_EVENT] Fail"); + } + + [Test] + [Category("P1")] + [Description("Test Mode: Check if state has proper value")] + [Property("SPEC", "Tizen.Network.Bluetooth.PlayStateChangedEventArgs.PlayState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Play/pause a track on the target")] + [Postcondition(1, "NA")] + public async Task PlayState_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("PlayState_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_PlayState_PROPERTY_READ_ONLY == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_PlayState_PROPERTY_READ_ONLY, "[TestCase][PlayState_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Listen Track Info changed")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.TrackInfoChanged E")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "EVL")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Change track on the target")] + [Postcondition(1, "NA")] + public async Task TrackInfoChanged_CHECK_EVENT() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("TrackInfoChanged_CHECK_EVENT"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_TrackInfoChanged_CHECK_EVENT == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_TrackInfoChanged_CHECK_EVENT, "[TestCase][TrackInfoChanged_CHECK_EVENT] Fail"); + } + + [Test] + [Category("P1")] + [Description("Listen Track Info changed")] + [Property("SPEC", "Tizen.Network.Bluetooth.TrackInfoChangedEventArgs.TrackData A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRO")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT headset.")] + [Precondition(3, "Sdb is connected as root with the target. \n>sdb root on")] + [Step(1, "Tap the Run button")] + [Step(2, "Change track on the target")] + [Postcondition(1, "NA")] + public async Task TrackData_PROPERTY_READ_ONLY() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("TrackData_PROPERTY_READ_ONLY"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_TrackData_PROPERTY_READ_ONLY == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_TrackData_PROPERTY_READ_ONLY, "[TestCase][TrackData_PROPERTY_READ_ONLY] Fail"); + } + + [Test] + [Category("P1")] + [Description("Connect AVRCP Control")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ConnectAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST, "[TestCase][ConnectAsync_AVRCP_CONTROL_CONNECTION_TEST] Fail"); + } + + [Test] + [Category("P1")] + [Description("Disconnect AVRCP Control")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.DisconnectAsync M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST, "[TestCase][DisconnectAsync_AVRCP_CONTROL_DISCONNECTION_TEST] Fail"); + } + + [Test] + [Category("P1")] + [Description("Get Play Status")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.GetPlayStatus M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task GetPlayStatus_RETURN_VALUE() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("GetPlayStatus_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetPlayStatus_RETURN_VALUE == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_GetPlayStatus_RETURN_VALUE, "[TestCase][GetPlayStatus_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Get Play Progress Position")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.GetPosition M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task GetPosition_RETURN_VALUE() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("GetPosition_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetPosition_RETURN_VALUE == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_GetPosition_RETURN_VALUE, "[TestCase][GetPosition_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Check whether EqualizerState is readable and writable")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.EqualizerState A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task EqualizerState_READ_WRITE() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("EqualizerState_READ_WRITE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_EqualizerState_READ_WRITE == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_EqualizerState_READ_WRITE, "[TestCase][EqualizerState_READ_WRITE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Check whether ShuffleMode is readable and writable")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ShuffleMode A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ShuffleMode_READ_WRITE() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("ShuffleMode_READ_WRITE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_ShuffleMode_READ_WRITE == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_ShuffleMode_READ_WRITE, "[TestCase][ShuffleMode_READ_WRITE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Check whether ScanMode is readable and writable")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.ScanMode A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task ScanMode_READ_WRITE() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("ScanMode_READ_WRITE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_ScanMode_READ_WRITE == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_ScanMode_READ_WRITE, "[TestCase][ScanMode_READ_WRITE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Check whether RepeatMode is readable and writable")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.RepeatMode A")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "PRW")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task RepeatMode_READ_WRITE() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("RepeatMode_READ_WRITE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_RepeatMode_READ_WRITE == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_RepeatMode_READ_WRITE, "[TestCase][RepeatMode_READ_WRITE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Get Track Info")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.GetTrackInfo M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task GetTrackInfo_RETURN_VALUE() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("GetTrackInfo_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_GetTrackInfo_RETURN_VALUE == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_GetTrackInfo_RETURN_VALUE, "[TestCase][GetTrackInfo_RETURN_VALUE] Fail"); + } + + [Test] + [Category("P1")] + [Description("Send a specific player state command to the target")] + [Property("SPEC", "Tizen.Network.Bluetooth.BluetoothAvrcpControl.SendPlayerCommand M")] + [Property("SPEC_URL", "-")] + [Property("CRITERIA", "MR")] + [Property("AUTHOR", "Sudipto Bal, sudipto.bal@samsung.com")] + [Precondition(1, "Turn on the bluetooth")] + [Precondition(2, "Paired with BT target device (phone, watch, etc).")] + [Step(1, "Tap the Run button")] + [Postcondition(1, "NA")] + public async Task SendPlayerCommand_RETURN_VALUE() + { + /* We can't occupy the precondition, if AVRCP Control feature is not supported in Manual TC */ + if (_isBluetoothAudioControlSupported == false) + { + BluetoothHelper.DisplayLabel("SendPlayerCommand_RETURN_VALUE"); + await ManualTest.WaitForConfirm(); + return; + } + + if (pass_SendPlayerCommand_RETURN_VALUE == false) + await AvrcpControlCombine_TEST(); + + Assert.True(pass_SendPlayerCommand_RETURN_VALUE, "[TestCase][SendPlayerCommand_RETURN_VALUE] Fail"); + } + } +}