Merge "Fix toolbar announce wrong text." into tm-qpr-dev am: 3292a30a1c
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19632605 Change-Id: If97f639c018bec3bcdb7e66b4e0d6b5b0848eadd Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1317,7 +1317,6 @@ final class RemoteSelectionToolbar {
|
|||||||
contentContainer.setLayoutParams(new ViewGroup.LayoutParams(
|
contentContainer.setLayoutParams(new ViewGroup.LayoutParams(
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
contentContainer.setTag(FloatingToolbar.FLOATING_TOOLBAR_TAG);
|
contentContainer.setTag(FloatingToolbar.FLOATING_TOOLBAR_TAG);
|
||||||
contentContainer.setContentDescription(FloatingToolbar.FLOATING_TOOLBAR_TAG);
|
|
||||||
contentContainer.setClipToOutline(true);
|
contentContainer.setClipToOutline(true);
|
||||||
return contentContainer;
|
return contentContainer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1475,7 +1475,6 @@ public final class LocalFloatingToolbarPopup implements FloatingToolbarPopup {
|
|||||||
contentContainer.setLayoutParams(new ViewGroup.LayoutParams(
|
contentContainer.setLayoutParams(new ViewGroup.LayoutParams(
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
contentContainer.setTag(FloatingToolbar.FLOATING_TOOLBAR_TAG);
|
contentContainer.setTag(FloatingToolbar.FLOATING_TOOLBAR_TAG);
|
||||||
contentContainer.setContentDescription(FloatingToolbar.FLOATING_TOOLBAR_TAG);
|
|
||||||
contentContainer.setClipToOutline(true);
|
contentContainer.setClipToOutline(true);
|
||||||
return contentContainer;
|
return contentContainer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
-->
|
-->
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/floating_popup_container"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="0dp"
|
android:padding="0dp"
|
||||||
|
|||||||
@@ -16,13 +16,12 @@
|
|||||||
|
|
||||||
package android.widget;
|
package android.widget;
|
||||||
|
|
||||||
import static com.android.internal.widget.floatingtoolbar.FloatingToolbar.FLOATING_TOOLBAR_TAG;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
import static com.google.common.truth.Truth.assertWithMessage;
|
import static com.google.common.truth.Truth.assertWithMessage;
|
||||||
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.support.test.uiautomator.By;
|
import android.support.test.uiautomator.By;
|
||||||
|
import android.support.test.uiautomator.BySelector;
|
||||||
import android.support.test.uiautomator.UiDevice;
|
import android.support.test.uiautomator.UiDevice;
|
||||||
import android.support.test.uiautomator.Until;
|
import android.support.test.uiautomator.Until;
|
||||||
|
|
||||||
@@ -33,25 +32,27 @@ import com.android.internal.R;
|
|||||||
final class FloatingToolbarUtils {
|
final class FloatingToolbarUtils {
|
||||||
|
|
||||||
private final UiDevice mDevice;
|
private final UiDevice mDevice;
|
||||||
|
private static final BySelector TOOLBAR_CONTAINER_SELECTOR =
|
||||||
|
By.res("android", "floating_popup_container");
|
||||||
|
|
||||||
FloatingToolbarUtils() {
|
FloatingToolbarUtils() {
|
||||||
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
|
mDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
|
||||||
}
|
}
|
||||||
|
|
||||||
void waitForFloatingToolbarPopup() {
|
void waitForFloatingToolbarPopup() {
|
||||||
mDevice.wait(Until.findObject(By.desc(FLOATING_TOOLBAR_TAG)), 500);
|
mDevice.wait(Until.findObject(TOOLBAR_CONTAINER_SELECTOR), 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
void assertFloatingToolbarIsDisplayed() {
|
void assertFloatingToolbarIsDisplayed() {
|
||||||
waitForFloatingToolbarPopup();
|
waitForFloatingToolbarPopup();
|
||||||
assertThat(mDevice.hasObject(By.desc(FLOATING_TOOLBAR_TAG))).isTrue();
|
assertThat(mDevice.hasObject(TOOLBAR_CONTAINER_SELECTOR)).isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void assertFloatingToolbarContainsItem(String itemLabel) {
|
void assertFloatingToolbarContainsItem(String itemLabel) {
|
||||||
waitForFloatingToolbarPopup();
|
waitForFloatingToolbarPopup();
|
||||||
assertWithMessage("Expected to find item labelled [" + itemLabel + "]")
|
assertWithMessage("Expected to find item labelled [" + itemLabel + "]")
|
||||||
.that(mDevice.hasObject(
|
.that(mDevice.hasObject(
|
||||||
By.desc(FLOATING_TOOLBAR_TAG).hasDescendant(By.text(itemLabel))))
|
TOOLBAR_CONTAINER_SELECTOR.hasDescendant(By.text(itemLabel))))
|
||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,14 +60,14 @@ final class FloatingToolbarUtils {
|
|||||||
waitForFloatingToolbarPopup();
|
waitForFloatingToolbarPopup();
|
||||||
assertWithMessage("Expected to not find item labelled [" + itemLabel + "]")
|
assertWithMessage("Expected to not find item labelled [" + itemLabel + "]")
|
||||||
.that(mDevice.hasObject(
|
.that(mDevice.hasObject(
|
||||||
By.desc(FLOATING_TOOLBAR_TAG).hasDescendant(By.text(itemLabel))))
|
TOOLBAR_CONTAINER_SELECTOR.hasDescendant(By.text(itemLabel))))
|
||||||
.isFalse();
|
.isFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
void assertFloatingToolbarContainsItemAtIndex(String itemLabel, int index) {
|
void assertFloatingToolbarContainsItemAtIndex(String itemLabel, int index) {
|
||||||
waitForFloatingToolbarPopup();
|
waitForFloatingToolbarPopup();
|
||||||
assertWithMessage("Expected to find item labelled [" + itemLabel + "] at index " + index)
|
assertWithMessage("Expected to find item labelled [" + itemLabel + "] at index " + index)
|
||||||
.that(mDevice.findObject(By.desc(FLOATING_TOOLBAR_TAG))
|
.that(mDevice.findObject(TOOLBAR_CONTAINER_SELECTOR)
|
||||||
.findObjects(By.clickable(true))
|
.findObjects(By.clickable(true))
|
||||||
.get(index)
|
.get(index)
|
||||||
.getChildren()
|
.getChildren()
|
||||||
@@ -77,7 +78,7 @@ final class FloatingToolbarUtils {
|
|||||||
|
|
||||||
void clickFloatingToolbarItem(String label) {
|
void clickFloatingToolbarItem(String label) {
|
||||||
waitForFloatingToolbarPopup();
|
waitForFloatingToolbarPopup();
|
||||||
mDevice.findObject(By.desc(FLOATING_TOOLBAR_TAG))
|
mDevice.findObject(TOOLBAR_CONTAINER_SELECTOR)
|
||||||
.findObject(By.text(label))
|
.findObject(By.text(label))
|
||||||
.click();
|
.click();
|
||||||
}
|
}
|
||||||
@@ -85,13 +86,13 @@ final class FloatingToolbarUtils {
|
|||||||
void clickFloatingToolbarOverflowItem(String label) {
|
void clickFloatingToolbarOverflowItem(String label) {
|
||||||
// TODO: There might be a benefit to combining this with "clickFloatingToolbarItem" method.
|
// TODO: There might be a benefit to combining this with "clickFloatingToolbarItem" method.
|
||||||
waitForFloatingToolbarPopup();
|
waitForFloatingToolbarPopup();
|
||||||
mDevice.findObject(By.desc(FLOATING_TOOLBAR_TAG))
|
mDevice.findObject(TOOLBAR_CONTAINER_SELECTOR)
|
||||||
.findObject(By.desc(str(R.string.floating_toolbar_open_overflow_description)))
|
.findObject(By.desc(str(R.string.floating_toolbar_open_overflow_description)))
|
||||||
.click();
|
.click();
|
||||||
mDevice.wait(
|
mDevice.wait(
|
||||||
Until.findObject(By.desc(FLOATING_TOOLBAR_TAG).hasDescendant(By.text(label))),
|
Until.findObject(TOOLBAR_CONTAINER_SELECTOR.hasDescendant(By.text(label))),
|
||||||
1000);
|
1000);
|
||||||
mDevice.findObject(By.desc(FLOATING_TOOLBAR_TAG))
|
mDevice.findObject(TOOLBAR_CONTAINER_SELECTOR)
|
||||||
.findObject(By.text(label))
|
.findObject(By.text(label))
|
||||||
.click();
|
.click();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user