Strengthen a11y text location test

Use a German strong 's' in all-caps to create a mismatch
between mText and mTransformed in the TextView that
displays it. This new test fails without a fix to code
that generates text positions for accessibility services.

Bug: 69044691
Test: The new test passes
Change-Id: I49bd85fcd0bebeb373d623d486140c79e1292fea
diff --git a/tests/accessibilityservice/res/values/strings.xml b/tests/accessibilityservice/res/values/strings.xml
index 454102a..ad5d3fd 100644
--- a/tests/accessibilityservice/res/values/strings.xml
+++ b/tests/accessibilityservice/res/values/strings.xml
@@ -139,6 +139,8 @@
 
     <string name="a_b">A B</string>
 
+    <string name="german_text_with_strong_s">ß</string>
+
     <string name="android_wiki_search">Android is a Linux-based</string>
 
     <string name="foo_bar_baz">Foo bar baz.</string>
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextActionTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextActionTest.java
index 38bb738..b17594e 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextActionTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextActionTest.java
@@ -198,10 +198,14 @@
 
     public void testTextLocations_textViewShouldProvideWhenRequested() {
         final TextView textView = (TextView) getActivity().findViewById(R.id.text);
-        makeTextViewVisibleAndSetText(textView, getString(R.string.a_b));
+        // Use text with a strong s, since that gets replaced with a double s for all caps.
+        // That replacement requires us to properly handle the length of the string changing.
+        String stringToSet = getString(R.string.german_text_with_strong_s);
+        makeTextViewVisibleAndSetText(textView, stringToSet);
+        getInstrumentation().runOnMainSync(() -> textView.setAllCaps(true));
 
         final AccessibilityNodeInfo text = mUiAutomation.getRootInActiveWindow()
-                .findAccessibilityNodeInfosByText(getString(R.string.a_b)).get(0);
+                .findAccessibilityNodeInfosByText(stringToSet).get(0);
         List<String> textAvailableExtraData = text.getAvailableExtraData();
         assertTrue("Text view should offer text location to accessibility",
                 textAvailableExtraData.contains(EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY));