summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-10-09 23:00:40 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2021-10-09 23:00:40 +0000
commit115b6e1c7a394302ee5ac74c048e8bcdc8f8ec30 (patch)
treed245545323fc5b2e56e54afa4a35210c56fa9c5e
parente63731bbb0b15c45bddee379c21be94edd19120f (diff)
parent051439cfb504b68e6b7970edf241592cd82d1d15 (diff)
downloadcts-115b6e1c7a394302ee5ac74c048e8bcdc8f8ec30.tar.gz
Snap for 7809314 from 051439cfb504b68e6b7970edf241592cd82d1d15 to sc-qpr1-d-release
Change-Id: Iae2986b31f6791fb8b8f768cef6180a1f7644927
-rw-r--r--tests/translation/src/android/translation/cts/UiTranslationManagerTest.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/translation/src/android/translation/cts/UiTranslationManagerTest.java b/tests/translation/src/android/translation/cts/UiTranslationManagerTest.java
index 477c1dfb249..34ceb720a4a 100644
--- a/tests/translation/src/android/translation/cts/UiTranslationManagerTest.java
+++ b/tests/translation/src/android/translation/cts/UiTranslationManagerTest.java
@@ -240,6 +240,39 @@ public class UiTranslationManagerTest {
}
@Test
+ public void testPauseUiTranslationThenStartUiTranslation() throws Throwable {
+ final Pair<List<AutofillId>, ContentCaptureContext> result =
+ enableServicesAndStartActivityForTranslation();
+
+ final CharSequence originalText = mTextView.getText();
+ final List<AutofillId> views = result.first;
+ final ContentCaptureContext contentCaptureContext = result.second;
+
+ final String translatedText = "success";
+ final UiObject2 helloText = Helper.findObjectByResId(Helper.ACTIVITY_PACKAGE,
+ SimpleActivity.HELLO_TEXT_ID);
+ assertThat(helloText).isNotNull();
+ // Set response
+ final TranslationResponse response =
+ createViewsTranslationResponse(views, translatedText);
+ sTranslationReplier.addResponse(response);
+
+ startUiTranslation(/* shouldPadContent */ false, views, contentCaptureContext);
+
+ assertThat(helloText.getText()).isEqualTo(translatedText);
+
+ pauseUiTranslation(contentCaptureContext);
+
+ assertThat(helloText.getText()).isEqualTo(originalText.toString());
+
+ sTranslationReplier.addResponse(createViewsTranslationResponse(views, translatedText));
+
+ startUiTranslation(/* shouldPadContent */ false, views, contentCaptureContext);
+
+ assertThat(helloText.getText()).isEqualTo(translatedText);
+ }
+
+ @Test
public void testUiTranslation_CustomViewTranslationCallback() throws Throwable {
final Pair<List<AutofillId>, ContentCaptureContext> result =
enableServicesAndStartActivityForTranslation();