Update StringUtil#formatElapsedTime method (2/3) am: 50f314e45d
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/14063748 Change-Id: Idb5dad8aa7105650d6a6cc7155d8e2786b0bc4d5
This commit is contained in:
@@ -473,9 +473,9 @@ public class AdvancedBluetoothDetailsHeaderControllerTest {
|
||||
@Test
|
||||
public void showBatteryPredictionIfNecessary_estimateReadyIsAvailable_showCorrectValue() {
|
||||
final String leftBatteryPrediction =
|
||||
StringUtil.formatElapsedTime(mContext, 12000000, false).toString();
|
||||
StringUtil.formatElapsedTime(mContext, 12000000, false, false).toString();
|
||||
final String rightBatteryPrediction =
|
||||
StringUtil.formatElapsedTime(mContext, 1200000, false).toString();
|
||||
StringUtil.formatElapsedTime(mContext, 1200000, false, false).toString();
|
||||
|
||||
mController.showBatteryPredictionIfNecessary(1, 12000000,
|
||||
mLayoutPreference.findViewById(R.id.layout_left));
|
||||
|
@@ -150,10 +150,9 @@ public class BatteryInfoTest {
|
||||
mBatteryUsageStats, estimate, SystemClock.elapsedRealtime() * 1000,
|
||||
true /* shortString */);
|
||||
|
||||
// We only add special mention for the long string
|
||||
assertThat(info.remainingLabel.toString()).contains(ENHANCED_STRING_SUFFIX);
|
||||
// Both long and short strings should not have extra text
|
||||
assertThat(info.remainingLabel.toString()).doesNotContain(ENHANCED_STRING_SUFFIX);
|
||||
assertThat(info.suggestionLabel).contains(BATTERY_RUN_OUT_PREFIX);
|
||||
// shortened string should not have extra text
|
||||
assertThat(info2.remainingLabel.toString()).doesNotContain(ENHANCED_STRING_SUFFIX);
|
||||
assertThat(info2.suggestionLabel).contains(BATTERY_RUN_OUT_PREFIX);
|
||||
}
|
||||
|
@@ -579,7 +579,11 @@ public class WifiDetailPreferenceController2Test {
|
||||
ZoneId.of("Europe/London"));
|
||||
doShouldShowRemainingTimeTest(fakeNow, timeRemainingMs);
|
||||
final String expectedSummary = mContext.getString(R.string.wifi_time_remaining,
|
||||
StringUtil.formatElapsedTime(mContext, timeRemainingMs, false /* withSeconds */));
|
||||
StringUtil.formatElapsedTime(
|
||||
mContext,
|
||||
timeRemainingMs,
|
||||
false /* withSeconds */,
|
||||
false /* collapseTimeUnit */));
|
||||
final InOrder inOrder = inOrder(mMockHeaderController);
|
||||
inOrder.verify(mMockHeaderController).setSecondSummary(expectedSummary);
|
||||
|
||||
|
Reference in New Issue
Block a user