Show prediction time when both value are ready

Bug: 215767460
Test: make -j64 RunSettingsRoboTests
Change-Id: I07947b3eca1f656e0dc603f9b9839825dd3149fd
This commit is contained in:
Hugh Chen
2022-02-17 09:10:49 +00:00
parent 01ad893e8c
commit 827910d3c3
2 changed files with 66 additions and 20 deletions

View File

@@ -387,34 +387,52 @@ public class AdvancedBluetoothDetailsHeaderControllerTest {
}
@Test
public void showBatteryPredictionIfNecessary_estimateReadyIsAvailable_showView() {
mController.showBatteryPredictionIfNecessary(1, 14218009,
mLayoutPreference.findViewById(R.id.layout_left));
mController.showBatteryPredictionIfNecessary(1, 14218009,
mLayoutPreference.findViewById(R.id.layout_middle));
mController.showBatteryPredictionIfNecessary(1, 14218009,
mLayoutPreference.findViewById(R.id.layout_right));
public void estimateReadyIsBothAvailable_showsView() {
mController.mIsLeftDeviceEstimateReady = true;
mController.mIsRightDeviceEstimateReady = true;
mController.showBothDevicesBatteryPredictionIfNecessary();
assertBatteryPredictionVisible(mLayoutPreference.findViewById(R.id.layout_left),
View.VISIBLE);
assertBatteryPredictionVisible(mLayoutPreference.findViewById(R.id.layout_middle),
View.VISIBLE);
assertBatteryPredictionVisible(mLayoutPreference.findViewById(R.id.layout_right),
View.VISIBLE);
}
@Test
public void showBatteryPredictionIfNecessary_estimateReadyIsNotAvailable_notShowView() {
mController.showBatteryPredictionIfNecessary(0, 14218009,
mLayoutPreference.findViewById(R.id.layout_left));
mController.showBatteryPredictionIfNecessary(0, 14218009,
mLayoutPreference.findViewById(R.id.layout_middle));
mController.showBatteryPredictionIfNecessary(0, 14218009,
mLayoutPreference.findViewById(R.id.layout_right));
public void leftDeviceEstimateIsReadyRightDeviceIsNotReady_notShowView() {
mController.mIsLeftDeviceEstimateReady = true;
mController.mIsRightDeviceEstimateReady = false;
mController.showBothDevicesBatteryPredictionIfNecessary();
assertBatteryPredictionVisible(mLayoutPreference.findViewById(R.id.layout_left),
View.GONE);
assertBatteryPredictionVisible(mLayoutPreference.findViewById(R.id.layout_middle),
assertBatteryPredictionVisible(mLayoutPreference.findViewById(R.id.layout_right),
View.GONE);
}
@Test
public void leftDeviceEstimateIsNotReadyRightDeviceIsReady_notShowView() {
mController.mIsLeftDeviceEstimateReady = false;
mController.mIsRightDeviceEstimateReady = true;
mController.showBothDevicesBatteryPredictionIfNecessary();
assertBatteryPredictionVisible(mLayoutPreference.findViewById(R.id.layout_left),
View.GONE);
assertBatteryPredictionVisible(mLayoutPreference.findViewById(R.id.layout_right),
View.GONE);
}
@Test
public void bothDevicesEstimateIsNotReady_notShowView() {
mController.mIsLeftDeviceEstimateReady = false;
mController.mIsRightDeviceEstimateReady = false;
mController.showBothDevicesBatteryPredictionIfNecessary();
assertBatteryPredictionVisible(mLayoutPreference.findViewById(R.id.layout_left),
View.GONE);
assertBatteryPredictionVisible(mLayoutPreference.findViewById(R.id.layout_right),
View.GONE);