Search in sources :

Example 16 with BluetoothCodecStatus

use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.

the class BluetoothSampleRateDialogPreferenceControllerTest method getSelectableIndex_verifyList.

@Test
public void getSelectableIndex_verifyList() {
    BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC };
    mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
    when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
    mController.onBluetoothServiceConnected(mBluetoothA2dp);
    List<Integer> indexList = new ArrayList<>();
    indexList.add(mController.getDefaultIndex());
    indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.SAMPLE_RATE_48000));
    indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.SAMPLE_RATE_88200));
    assertThat(mController.getSelectableIndex().containsAll(indexList)).isTrue();
    assertThat(indexList.containsAll(mController.getSelectableIndex())).isTrue();
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 17 with BluetoothCodecStatus

use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.

the class AbstractBluetoothDialogPreferenceControllerTest method getSelectableConfigs_verifyConfig.

@Test
public void getSelectableConfigs_verifyConfig() {
    mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
    when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
    mController.onBluetoothServiceConnected(mBluetoothA2dp);
    assertThat(mController.getSelectableConfigs(null)).isEqualTo(mCodecConfigs);
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) Test(org.junit.Test)

Example 18 with BluetoothCodecStatus

use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.

the class BluetoothBitPerSampleDialogPreferenceControllerTest method writeConfigurationValues_selectDefault_setHighest.

@Test
public void writeConfigurationValues_selectDefault_setHighest() {
    BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC };
    mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
    when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
    mController.onBluetoothServiceConnected(mBluetoothA2dp);
    mController.writeConfigurationValues(0);
    verify(mBluetoothA2dpConfigStore).setBitsPerSample(BluetoothCodecConfig.BITS_PER_SAMPLE_24);
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Test(org.junit.Test)

Example 19 with BluetoothCodecStatus

use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.

the class BluetoothBitPerSampleDialogPreferenceControllerTest method getSelectableIndex_verifyList.

@Test
public void getSelectableIndex_verifyList() {
    BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC };
    mCodecStatus = new BluetoothCodecStatus(mCodecConfigAAC, null, mCodecConfigs);
    when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
    mController.onBluetoothServiceConnected(mBluetoothA2dp);
    List<Integer> indexList = new ArrayList<>();
    indexList.add(mPreference.getDefaultIndex());
    indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.BITS_PER_SAMPLE_16));
    indexList.add(mController.convertCfgToBtnIndex(BluetoothCodecConfig.BITS_PER_SAMPLE_24));
    assertThat(mController.getSelectableIndex().containsAll(indexList)).isTrue();
    assertThat(indexList.containsAll(mController.getSelectableIndex())).isTrue();
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 20 with BluetoothCodecStatus

use of android.bluetooth.BluetoothCodecStatus in project android_packages_apps_Settings by omnirom.

the class BluetoothChannelModeDialogPreferenceControllerTest method writeConfigurationValues_selectDefault_setHighest.

@Test
public void writeConfigurationValues_selectDefault_setHighest() {
    BluetoothCodecConfig[] mCodecConfigs = { mCodecConfigAAC, mCodecConfigSBC };
    mCodecStatus = new BluetoothCodecStatus(mCodecConfigSBC, null, mCodecConfigs);
    when(mBluetoothA2dp.getCodecStatus(mActiveDevice)).thenReturn(mCodecStatus);
    mController.onBluetoothServiceConnected(mBluetoothA2dp);
    mController.writeConfigurationValues(0);
    verify(mBluetoothA2dpConfigStore).setChannelMode(BluetoothCodecConfig.CHANNEL_MODE_STEREO);
}
Also used : BluetoothCodecStatus(android.bluetooth.BluetoothCodecStatus) BluetoothCodecConfig(android.bluetooth.BluetoothCodecConfig) Test(org.junit.Test)

Aggregations

BluetoothCodecStatus (android.bluetooth.BluetoothCodecStatus)26 BluetoothCodecConfig (android.bluetooth.BluetoothCodecConfig)17 Test (org.junit.Test)17 Resources (android.content.res.Resources)6 BluetoothDevice (android.bluetooth.BluetoothDevice)3 ArrayList (java.util.ArrayList)3 BluetoothA2dp (android.bluetooth.BluetoothA2dp)2 VisibleForTesting (androidx.annotation.VisibleForTesting)1