Merge "Reland "Don't use framework strings for formatting file sizes"" am: ba69fd0d3f
am: d5ab7dc729
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2096605 Change-Id: I8b616af8d02a6d984d7dbec2b50087242958dd40 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -18,9 +18,11 @@ package com.android.settings.utils;
|
||||
|
||||
import static com.android.settings.utils.FileSizeFormatter.GIGABYTE_IN_BYTES;
|
||||
import static com.android.settings.utils.FileSizeFormatter.MEGABYTE_IN_BYTES;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Context;
|
||||
import android.icu.util.MeasureUnit;
|
||||
|
||||
import androidx.test.InstrumentationRegistry;
|
||||
import androidx.test.filters.SmallTest;
|
||||
@@ -46,7 +48,7 @@ public class FileSizeFormatterTest {
|
||||
FileSizeFormatter.formatFileSize(
|
||||
mContext,
|
||||
0 /* size */,
|
||||
com.android.internal.R.string.gigabyteShort,
|
||||
MeasureUnit.GIGABYTE,
|
||||
GIGABYTE_IN_BYTES))
|
||||
.isEqualTo("0.00 GB");
|
||||
}
|
||||
@@ -57,7 +59,7 @@ public class FileSizeFormatterTest {
|
||||
FileSizeFormatter.formatFileSize(
|
||||
mContext,
|
||||
MEGABYTE_IN_BYTES * 11 /* size */,
|
||||
com.android.internal.R.string.gigabyteShort,
|
||||
MeasureUnit.GIGABYTE,
|
||||
GIGABYTE_IN_BYTES))
|
||||
.isEqualTo("0.01 GB");
|
||||
}
|
||||
@@ -68,7 +70,7 @@ public class FileSizeFormatterTest {
|
||||
FileSizeFormatter.formatFileSize(
|
||||
mContext,
|
||||
MEGABYTE_IN_BYTES * 155 /* size */,
|
||||
com.android.internal.R.string.gigabyteShort,
|
||||
MeasureUnit.GIGABYTE,
|
||||
GIGABYTE_IN_BYTES))
|
||||
.isEqualTo("0.16 GB");
|
||||
}
|
||||
@@ -79,7 +81,7 @@ public class FileSizeFormatterTest {
|
||||
FileSizeFormatter.formatFileSize(
|
||||
mContext,
|
||||
MEGABYTE_IN_BYTES * 1551 /* size */,
|
||||
com.android.internal.R.string.gigabyteShort,
|
||||
MeasureUnit.GIGABYTE,
|
||||
GIGABYTE_IN_BYTES))
|
||||
.isEqualTo("1.6 GB");
|
||||
}
|
||||
@@ -91,7 +93,7 @@ public class FileSizeFormatterTest {
|
||||
FileSizeFormatter.formatFileSize(
|
||||
mContext,
|
||||
GIGABYTE_IN_BYTES * 15 + MEGABYTE_IN_BYTES * 50 /* size */,
|
||||
com.android.internal.R.string.gigabyteShort,
|
||||
MeasureUnit.GIGABYTE,
|
||||
GIGABYTE_IN_BYTES))
|
||||
.isEqualTo("15 GB");
|
||||
}
|
||||
@@ -102,7 +104,7 @@ public class FileSizeFormatterTest {
|
||||
FileSizeFormatter.formatFileSize(
|
||||
mContext,
|
||||
MEGABYTE_IN_BYTES * -155 /* size */,
|
||||
com.android.internal.R.string.gigabyteShort,
|
||||
MeasureUnit.GIGABYTE,
|
||||
GIGABYTE_IN_BYTES))
|
||||
.isEqualTo("-0.16 GB");
|
||||
}
|
||||
|
Reference in New Issue
Block a user