mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 09:01:55 +01:00
Sony Headphones: Fix unit tests
This commit is contained in:
parent
894f913a89
commit
d432800ae4
@ -22,6 +22,7 @@ import java.util.Set;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCapabilities;
|
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCapabilities;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCoordinator;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||||
|
|
||||||
@ -44,7 +45,13 @@ public class MockSonyCoordinator extends SonyHeadphonesCoordinator {
|
|||||||
capabilities.add(capability);
|
capabilities.add(capability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Set<SonyHeadphonesCapabilities> getCapabilities() {
|
public Set<SonyHeadphonesCapabilities> getCapabilities() {
|
||||||
return capabilities;
|
return capabilities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<SonyHeadphonesCapabilities> getCapabilities(final GBDevice device) {
|
||||||
|
return getCapabilities();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ import static nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphon
|
|||||||
import static nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.protocol.impl.SonyTestUtils.assertRequests;
|
import static nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.protocol.impl.SonyTestUtils.assertRequests;
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.protocol.impl.SonyTestUtils.handleMessage;
|
import static nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.protocol.impl.SonyTestUtils.handleMessage;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ import java.util.Map;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCapabilities;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.SonyHeadphonesCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWF1000XM4Coordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.coordinators.SonyWF1000XM4Coordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.prefs.AmbientSoundControlButtonMode;
|
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.prefs.AmbientSoundControlButtonMode;
|
||||||
@ -48,16 +50,35 @@ import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.prefs.SpeakT
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.prefs.SpeakToChatEnabled;
|
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.prefs.SpeakToChatEnabled;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.prefs.VoiceNotifications;
|
import nodomain.freeyourgadget.gadgetbridge.devices.sony.headphones.prefs.VoiceNotifications;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.protocol.Request;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.protocol.Request;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.protocol.impl.MockSonyCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.protocol.impl.v1.params.BatteryType;
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.sony.headphones.protocol.impl.v1.params.BatteryType;
|
||||||
|
|
||||||
public class SonyProtocolImplV2Test {
|
public class SonyProtocolImplV2Test {
|
||||||
|
private final MockSonyCoordinator coordinator = new MockSonyCoordinator();
|
||||||
private final SonyProtocolImplV2 protocol = new SonyProtocolImplV2(null) {
|
private final SonyProtocolImplV2 protocol = new SonyProtocolImplV2(null) {
|
||||||
@Override
|
@Override
|
||||||
protected SonyHeadphonesCoordinator getCoordinator() {
|
protected SonyHeadphonesCoordinator getCoordinator() {
|
||||||
return new SonyWF1000XM4Coordinator();
|
return coordinator;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void before() {
|
||||||
|
coordinator.getCapabilities().clear();
|
||||||
|
// Same as the WF-1000XM4
|
||||||
|
coordinator.getCapabilities().addAll(Arrays.asList(
|
||||||
|
SonyHeadphonesCapabilities.BatteryDual,
|
||||||
|
SonyHeadphonesCapabilities.BatteryCase,
|
||||||
|
SonyHeadphonesCapabilities.AmbientSoundControl,
|
||||||
|
SonyHeadphonesCapabilities.WindNoiseReduction,
|
||||||
|
SonyHeadphonesCapabilities.EqualizerSimple,
|
||||||
|
SonyHeadphonesCapabilities.AudioUpsampling,
|
||||||
|
SonyHeadphonesCapabilities.ButtonModesLeftRight,
|
||||||
|
SonyHeadphonesCapabilities.PauseWhenTakenOff,
|
||||||
|
SonyHeadphonesCapabilities.AutomaticPowerOffWhenTakenOff
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getAmbientSoundControl() {
|
public void getAmbientSoundControl() {
|
||||||
// TODO
|
// TODO
|
||||||
|
Loading…
Reference in New Issue
Block a user