OSDN Git Service

Add content description to suggestion card close button.
authorDoris Ling <dling@google.com>
Mon, 12 Feb 2018 19:40:03 +0000 (11:40 -0800)
committerDoris Ling <dling@google.com>
Mon, 12 Feb 2018 19:40:03 +0000 (11:40 -0800)
Change-Id: I2354dd5a4b092ac24bbc0c197bd228b73d8ede64
Fixes: 72958040
Test: talkback, make RunSettingsRoboTests

res/layout/suggestion_tile.xml
res/layout/suggestion_tile_with_button.xml
tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java

index fa3f3af..850e55a 100644 (file)
@@ -52,6 +52,7 @@
                 android:layout_alignParentEnd="true"
                 android:layout_marginTop="8dp"
                 android:layout_marginEnd="8dp"
+                android:contentDescription="@string/dlg_close"
                 android:src="@drawable/ic_suggestion_close_button"/>
 
         </RelativeLayout>
index de3494a..8fb8e84 100644 (file)
@@ -52,6 +52,7 @@
                 android:layout_alignParentEnd="true"
                 android:layout_marginTop="8dp"
                 android:layout_marginEnd="8dp"
+                android:contentDescription="@string/dlg_close"
                 android:src="@drawable/ic_suggestion_close_button"/>
 
         </RelativeLayout>
index bac02d3..4ff09c1 100644 (file)
@@ -295,6 +295,19 @@ public class SuggestionAdapterTest {
     }
 
     @Test
+    public void onBindViewHolder_closeButtonShouldHaveContentDescription()
+        throws PendingIntent.CanceledException {
+        final List<Suggestion> suggestions = makeSuggestions("pkg1");
+        setupSuggestions(mActivity, suggestions);
+
+        mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
+
+        assertThat(
+            mSuggestionHolder.itemView.findViewById(R.id.close_button).getContentDescription())
+            .isNotNull();
+    }
+
+    @Test
     public void setCardLayout_oneCard_shouldSetCardWidthToMatchParent() {
         final List<Suggestion> suggestions = makeSuggestions("pkg1");
         setupSuggestions(mContext, suggestions);