[automerge] Show prediction time when both value are ready 2p: 827910d3c3

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16972164

Bug: 215767460
Change-Id: Ic1931ca8176c5c06a234d2c734c016d05b9be55c
This commit is contained in:
Hugh Chen
2022-02-22 05:38:42 +00:00
committed by Presubmit Automerger Backend
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);