[QPR1] Add time unit into battery usage chart and refine some UI
- add time unit into battery chart for 12/24 hours - refine the radius size for chart bar - use fixed font size for timestamp and percentage screenshots: 24-hour format: https://screenshot.googleplex.com/3VNedE2nAx6LrXu 12-hour format: https://screenshot.googleplex.com/3tpTXjYfrasrenW fixed-size: https://screenshot.googleplex.com/nPRKm7XCkmFzW6K Bug: 194836607 Test: make SettingsRoboTests Change-Id: I5b35b0fa808eb8a5f607962ee973c2896529b078 Merged-In: I5b35b0fa808eb8a5f607962ee973c2896529b078
This commit is contained in:
@@ -30,7 +30,6 @@ import android.os.UserHandle;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
@@ -317,71 +316,6 @@ public final class ConvertUtilsTest {
|
||||
.isEqualTo(entry.mConsumePower * ratio);
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testUtcToLocalTime_returnExpectedResult() {
|
||||
ConvertUtils.sZoneId = null;
|
||||
ConvertUtils.sLocale = null;
|
||||
final long timestamp = 1619196786769L;
|
||||
final String expectedZoneId = "America/Los_Angeles";
|
||||
ConvertUtils.sSimpleDateFormat = null;
|
||||
// Invokes the method first to create the SimpleDateFormat.
|
||||
ConvertUtils.utcToLocalTime(mContext, /*timestamp=*/ 0);
|
||||
ConvertUtils.sSimpleDateFormat
|
||||
.setTimeZone(TimeZone.getTimeZone(expectedZoneId));
|
||||
mContext.getResources().getConfiguration().setLocales(
|
||||
new LocaleList(new Locale("en_US")));
|
||||
|
||||
assertThat(ConvertUtils.utcToLocalTime(mContext, timestamp))
|
||||
.isEqualTo("Apr 24,2021 00:53:06");
|
||||
assertThat(ConvertUtils.sZoneId).isNotEqualTo(expectedZoneId);
|
||||
assertThat(ConvertUtils.sLocale).isEqualTo(new Locale("en_US"));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testUtcToLocalTimeHour_12HourFormat_returnExpectedResult() {
|
||||
ConvertUtils.sZoneIdForHour = null;
|
||||
ConvertUtils.sLocaleForHour = null;
|
||||
final long timestamp = 1619000086769L;
|
||||
final String expectedZoneId = "America/Los_Angeles";
|
||||
ConvertUtils.sSimpleDateFormatForHour = null;
|
||||
// Invokes the method first to create the SimpleDateFormat.
|
||||
ConvertUtils.utcToLocalTimeHour(
|
||||
mContext, /*timestamp=*/ 0, /*is24HourFormat=*/ false);
|
||||
ConvertUtils.sSimpleDateFormatForHour
|
||||
.setTimeZone(TimeZone.getTimeZone(expectedZoneId));
|
||||
mContext.getResources().getConfiguration().setLocales(
|
||||
new LocaleList(new Locale("en_US")));
|
||||
|
||||
assertThat(ConvertUtils.utcToLocalTimeHour(
|
||||
mContext, timestamp, /*is24HourFormat=*/ false)).isEqualTo("6");
|
||||
assertThat(ConvertUtils.sZoneIdForHour).isNotEqualTo(expectedZoneId);
|
||||
assertThat(ConvertUtils.sLocaleForHour).isEqualTo(new Locale("en_US"));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testUtcToLocalTimeHour_24HourFormat_returnExpectedResult() {
|
||||
ConvertUtils.sZoneIdForHour = null;
|
||||
ConvertUtils.sLocaleForHour = null;
|
||||
final long timestamp = 1619000086769L;
|
||||
final String expectedZoneId = "America/Los_Angeles";
|
||||
ConvertUtils.sSimpleDateFormatForHour = null;
|
||||
// Invokes the method first to create the SimpleDateFormat.
|
||||
ConvertUtils.utcToLocalTimeHour(
|
||||
mContext, /*timestamp=*/ 0, /*is24HourFormat=*/ false);
|
||||
ConvertUtils.sSimpleDateFormatForHour
|
||||
.setTimeZone(TimeZone.getTimeZone(expectedZoneId));
|
||||
mContext.getResources().getConfiguration().setLocales(
|
||||
new LocaleList(new Locale("en_US")));
|
||||
|
||||
assertThat(ConvertUtils.utcToLocalTimeHour(
|
||||
mContext, timestamp, /*is24HourFormat=*/ true)).isEqualTo("18");
|
||||
assertThat(ConvertUtils.sZoneIdForHour).isNotEqualTo(expectedZoneId);
|
||||
assertThat(ConvertUtils.sLocaleForHour).isEqualTo(new Locale("en_US"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getLocale_nullContext_returnDefaultLocale() {
|
||||
assertThat(ConvertUtils.getLocale(/*context=*/ null))
|
||||
|
Reference in New Issue
Block a user