Screen Resolution: add space for 4-digit values

Add logic that composes screen resolution string with non-breaking
spaces. Now setting page will show "1 080 x 1 280" instead of "1080 x
1280"

Test: atest -c <SETTINGS_APP_PATH>/tests/unit/src/com/android/settings/display/ScreenResolutionFragmentTest.java
Test: verified on device
Flag: EXEMPT no API change
Bug: 385895191
Change-Id: I9a4bbd7c20e8c700dee6e997a36d4fda69f4d780
This commit is contained in:
Vadym Omelnytskyi
2025-03-13 11:29:13 +00:00
parent 67b21fb238
commit 14050c89f5
2 changed files with 63 additions and 1 deletions

View File

@@ -110,4 +110,28 @@ public class ScreenResolutionFragmentTest {
assertThat(preference.getSummary().toString().contentEquals(summary)).isTrue();
}
@Test
public void testResolutionString_widthAndHeightAboveThreshold() {
String result = ScreenResolutionFragment.getResolutionString(1080, 1280);
assertThat(result).isEqualTo("1\u00A0080\u00A0x\u00A01\u00A0280");
}
@Test
public void testResolutionString_widthAboveThreshold_heightBelowThreshold() {
String result = ScreenResolutionFragment.getResolutionString(1080, 980);
assertThat(result).isEqualTo("1\u00A0080\u00A0x\u00A0980");
}
@Test
public void testResolutionString_widthBelowThreshold_heightBelowThreshold() {
String result = ScreenResolutionFragment.getResolutionString(980, 980);
assertThat(result).isEqualTo("980\u00A0x\u00A0980");
}
@Test
public void testResolutionString_widthBelowThreshold_heightAboveThreshold() {
String result = ScreenResolutionFragment.getResolutionString(980, 1080);
assertThat(result).isEqualTo("980\u00A0x\u00A01\u00A0080");
}
}