Update strings again for refreshed High Contrast Text

Deletes the old string resource and uses a new resource because the old
translated strings do not have formatting placeholders. Eventually the
old translated strings will be automatically deleted and the new string
with placeholder will be translated.

Also uses placeholders for referencing other strings so that
we guarantee that the strings are consistent across this notification
and the actual preference in Settings.

Bug: 384791485
Test: see bug screenshots
Flag: com.android.graphics.hwui.flags.high_contrast_text_small_text_rect
Change-Id: I89a9ee4b3755b20f4e090df5b4cccb7ce47a961c
This commit is contained in:
Daniel Norman
2025-01-28 16:47:29 -08:00
parent 6e12194015
commit 6d0a04a171
3 changed files with 29 additions and 17 deletions

View File

@@ -46,9 +46,10 @@ import android.provider.Settings;
import androidx.test.core.app.ApplicationProvider;
import com.android.graphics.hwui.flags.Flags;
import com.android.settings.R;
import com.android.settings.Utils;
import com.google.common.truth.Expect;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -65,7 +66,8 @@ import java.util.List;
/** Tests for {@link HighContrastTextMigrationReceiver}. */
@RunWith(RobolectricTestRunner.class)
public class HighContrastTextMigrationReceiverTest {
@Rule
public final Expect expect = Expect.create();
@Rule
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
private final Context mContext = ApplicationProvider.getApplicationContext();
@@ -230,14 +232,12 @@ public class HighContrastTextMigrationReceiverTest {
assertThat(notification).isNotNull();
ShadowNotification shadowNotification = Shadows.shadowOf(notification);
assertThat(shadowNotification.getContentTitle()).isEqualTo(mContext.getString(
R.string.accessibility_notification_high_contrast_text_title));
assertThat(shadowNotification.getContentText()).isEqualTo(
mContext.getString(R.string.accessibility_notification_high_contrast_text_content));
expect.that(shadowNotification.getContentTitle()).isEqualTo("Improve text contrast");
expect.that(shadowNotification.getContentText()).isEqualTo(
"Outline text has replaced high contrast text. You can turn it on in Settings.");
assertThat(notification.actions.length).isEqualTo(1);
assertThat(notification.actions[0].title.toString()).isEqualTo(
mContext.getString(R.string.accessibility_notification_high_contrast_text_action));
expect.that(notification.actions.length).isEqualTo(1);
expect.that(notification.actions[0].title.toString()).isEqualTo("Go to Settings");
}
private void assertPromptStateAndHctState(