Merge "Fix inconsistent connected without charging state in the Settings" into udc-qpr-dev am: 296322ad47 am: 4b1d5b8e8e

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

Change-Id: I11be4dc1c925f0100183d842fe2d2b3a13ae2741
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
YK Hung
2023-07-28 19:21:21 +00:00
committed by Automerger Merge Worker
2 changed files with 17 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ import android.content.Intent;
import android.hardware.usb.UsbManager;
import android.hardware.usb.UsbPort;
import android.hardware.usb.UsbPortStatus;
import android.os.BatteryManager;
import androidx.preference.Preference;
import androidx.test.core.app.ApplicationProvider;
@@ -145,6 +146,17 @@ public class TopLevelBatteryPreferenceControllerTest {
.isEqualTo(mContext.getString(R.string.battery_info_status_not_charging));
}
@Test
public void getDashboardLabel_notChargingState_returnsCorrectLabel() {
mController.mPreference = new Preference(mContext);
BatteryInfo info = new BatteryInfo();
info.batteryStatus = BatteryManager.BATTERY_STATUS_NOT_CHARGING;
info.statusLabel = "expected returned label";
assertThat(mController.getDashboardLabel(mContext, info, true))
.isEqualTo(info.statusLabel);
}
@Test
public void getSummary_batteryNotPresent_shouldShowWarningMessage() {
mController.mIsBatteryPresent = false;