|
15 | 15 | */ |
16 | 16 | package com.google.android.material.chip; |
17 | 17 |
|
18 | | -import android.widget.CompoundButton.OnCheckedChangeListener; |
19 | | -import com.google.android.material.test.R; |
| 18 | +import com.google.android.material.R; |
20 | 19 |
|
21 | | -import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; |
22 | 20 | import static com.google.common.truth.Truth.assertThat; |
23 | 21 | import static org.junit.Assert.assertEquals; |
24 | 22 | import static org.junit.Assert.assertTrue; |
25 | 23 |
|
26 | 24 | import android.content.Context; |
27 | 25 | import androidx.appcompat.app.AppCompatActivity; |
28 | 26 | import android.view.View; |
29 | | -import android.widget.CompoundButton; |
30 | 27 | import androidx.core.view.ViewCompat; |
31 | 28 | import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; |
32 | 29 | import androidx.core.view.accessibility.AccessibilityNodeInfoCompat.CollectionInfoCompat; |
@@ -199,41 +196,6 @@ public void onCheckedChanged(ChipGroup group, List<Integer> checkedIds) { |
199 | 196 | assertThat(checkedIds).contains(second.getId()); |
200 | 197 | } |
201 | 198 |
|
202 | | - @Test |
203 | | - public void multipleSelection_chipListener() { |
204 | | - chipgroup.setSingleSelection(false); |
205 | | - |
206 | | - Chip first = (Chip) chipgroup.getChildAt(0); |
207 | | - first.setOnCheckedChangeListener( |
208 | | - new OnCheckedChangeListener() { |
209 | | - @Override |
210 | | - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
211 | | - onChipCheckedStateChanged(buttonView, isChecked); |
212 | | - } |
213 | | - }); |
214 | | - |
215 | | - Chip second = (Chip) chipgroup.getChildAt(1); |
216 | | - second.setOnCheckedChangeListener( |
217 | | - new OnCheckedChangeListener() { |
218 | | - @Override |
219 | | - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
220 | | - onChipCheckedStateChanged(buttonView, isChecked); |
221 | | - } |
222 | | - }); |
223 | | - |
224 | | - first.performClick(); |
225 | | - getInstrumentation().waitForIdleSync(); |
226 | | - |
227 | | - assertThat(checkedChangeCallCount).isEqualTo(1); |
228 | | - assertThat(checkedIds).containsExactly(first.getId()); |
229 | | - |
230 | | - second.performClick(); |
231 | | - getInstrumentation().waitForIdleSync(); |
232 | | - |
233 | | - assertThat(checkedChangeCallCount).isEqualTo(2); |
234 | | - assertThat(checkedIds).containsExactly(first.getId(), second.getId()); |
235 | | - } |
236 | | - |
237 | 199 | @Test |
238 | 200 | public void multiSelection_withSelectionRequired_unSelectsIfTwo() { |
239 | 201 | chipgroup.setSingleSelection(false); |
@@ -298,9 +260,4 @@ public void isNotSingleLine_initializesAccessibilityNodeInfo() { |
298 | 260 | assertEquals(1, itemInfo.getRowIndex()); |
299 | 261 | assertTrue(itemInfo.isSelected()); |
300 | 262 | } |
301 | | - |
302 | | - private void onChipCheckedStateChanged(CompoundButton chip, boolean checked) { |
303 | | - checkedChangeCallCount++; |
304 | | - checkedIds = chipgroup.getCheckedChipIds(); |
305 | | - } |
306 | 263 | } |
0 commit comments