Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/ItemChooserDialogTest.java

Issue 2704263004: bluetooth: Add connected icon to Bluetooth Chooser on Android (Closed)
Patch Set: Change name Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser; 5 package org.chromium.chrome.browser;
6 6
7 import android.app.Dialog; 7 import android.app.Dialog;
8 import android.graphics.drawable.Drawable;
9 import android.support.graphics.drawable.VectorDrawableCompat;
8 import android.support.test.filters.LargeTest; 10 import android.support.test.filters.LargeTest;
11 import android.test.MoreAsserts;
9 import android.test.UiThreadTest; 12 import android.test.UiThreadTest;
10 import android.text.SpannableString; 13 import android.text.SpannableString;
11 import android.view.View; 14 import android.view.View;
12 import android.widget.Button; 15 import android.widget.Button;
16 import android.widget.ImageView;
13 import android.widget.ListView; 17 import android.widget.ListView;
14 18
15 import org.chromium.base.ThreadUtils; 19 import org.chromium.base.ThreadUtils;
16 import org.chromium.base.test.util.RetryOnFailure; 20 import org.chromium.base.test.util.RetryOnFailure;
17 import org.chromium.chrome.R; 21 import org.chromium.chrome.R;
18 import org.chromium.chrome.test.ChromeActivityTestCaseBase; 22 import org.chromium.chrome.test.ChromeActivityTestCaseBase;
19 import org.chromium.content.browser.test.util.Criteria; 23 import org.chromium.content.browser.test.util.Criteria;
20 import org.chromium.content.browser.test.util.CriteriaHelper; 24 import org.chromium.content.browser.test.util.CriteriaHelper;
21 import org.chromium.content.browser.test.util.TouchCommon; 25 import org.chromium.content.browser.test.util.TouchCommon;
22 import org.chromium.ui.widget.TextViewWithClickableSpans; 26 import org.chromium.ui.widget.TextViewWithClickableSpans;
23 27
24 import java.util.concurrent.Callable; 28 import java.util.concurrent.Callable;
25 29
26 /** 30 /**
27 * Tests for the ItemChooserDialog class. 31 * Tests for the ItemChooserDialog class.
28 */ 32 */
29 @RetryOnFailure 33 @RetryOnFailure
30 public class ItemChooserDialogTest extends ChromeActivityTestCaseBase<ChromeActi vity> 34 public class ItemChooserDialogTest extends ChromeActivityTestCaseBase<ChromeActi vity>
31 implements ItemChooserDialog.ItemSelectedCallback { 35 implements ItemChooserDialog.ItemSelectedCallback {
32 36
33 ItemChooserDialog mChooserDialog; 37 ItemChooserDialog mChooserDialog;
34 38
35 String mLastSelectedId = "None"; 39 String mLastSelectedId = "None";
36 40
41 Drawable mTestDrawable1;
42 Drawable mTestDrawableSelected1;
43 String mTestDrawableDescription1;
44 ItemChooserDialog.ItemChooserRowIcon mTestIcon1;
45
46 Drawable mTestDrawable2;
47 Drawable mTestDrawableSelected2;
48 String mTestDrawableDescription2;
49 ItemChooserDialog.ItemChooserRowIcon mTestIcon2;
50
37 public ItemChooserDialogTest() { 51 public ItemChooserDialogTest() {
38 super(ChromeActivity.class); 52 super(ChromeActivity.class);
39 } 53 }
40 54
41 // ChromeActivityTestCaseBase: 55 // ChromeActivityTestCaseBase:
42 56
43 @Override 57 @Override
44 protected void setUp() throws Exception { 58 protected void setUp() throws Exception {
45 super.setUp(); 59 super.setUp();
46 mChooserDialog = createDialog(); 60 mChooserDialog = createDialog();
61
62 mTestDrawable1 = getNewTestDrawable();
63 mTestDrawableSelected1 = getNewTestDrawable();
64 MoreAsserts.assertNotEqual(
65 mTestDrawable1.getConstantState(), mTestDrawableSelected1.getCon stantState());
66 mTestDrawableDescription1 = "icon1 description";
67 mTestIcon1 = new ItemChooserDialog.ItemChooserRowIcon(
68 mTestDrawable1, mTestDrawableSelected1, mTestDrawableDescription 1);
69
70 mTestDrawable2 = getNewTestDrawable();
71 mTestDrawableSelected2 = getNewTestDrawable();
72 MoreAsserts.assertNotEqual(
73 mTestDrawable2.getConstantState(), mTestDrawableSelected2.getCon stantState());
74 mTestDrawableDescription2 = "icon2 description";
75 mTestIcon2 = new ItemChooserDialog.ItemChooserRowIcon(
76 mTestDrawable2, mTestDrawableSelected2, mTestDrawableDescription 2);
77
78 assertFalse(ItemChooserDialog.ItemChooserRowIcon.equals(mTestIcon1, mTes tIcon2));
47 } 79 }
48 80
49 @Override 81 @Override
50 public void startMainActivity() throws InterruptedException { 82 public void startMainActivity() throws InterruptedException {
51 startMainActivityOnBlankPage(); 83 startMainActivityOnBlankPage();
52 } 84 }
53 85
54 // ItemChooserDialog.ItemSelectedCallback: 86 // ItemChooserDialog.ItemSelectedCallback:
55 87
56 @Override 88 @Override
57 public void onItemSelected(String id) { 89 public void onItemSelected(String id) {
58 mLastSelectedId = id; 90 mLastSelectedId = id;
59 } 91 }
60 92
93 private Drawable getNewTestDrawable() {
94 Drawable drawable = VectorDrawableCompat.create(
95 getActivity().getResources(), R.drawable.ic_bluetooth_connected, null);
96 // Calling mutate() on a Drawable should typically create a new Constant State
97 // for that Drawable.
98 return drawable.mutate();
99 }
100
61 private ItemChooserDialog createDialog() { 101 private ItemChooserDialog createDialog() {
62 SpannableString title = new SpannableString("title"); 102 SpannableString title = new SpannableString("title");
63 SpannableString searching = new SpannableString("searching"); 103 SpannableString searching = new SpannableString("searching");
64 SpannableString noneFound = new SpannableString("noneFound"); 104 SpannableString noneFound = new SpannableString("noneFound");
65 SpannableString statusActive = new SpannableString("statusActive"); 105 SpannableString statusActive = new SpannableString("statusActive");
66 SpannableString statusIdleNoneFound = new SpannableString("statusIdleNon eFound"); 106 SpannableString statusIdleNoneFound = new SpannableString("statusIdleNon eFound");
67 SpannableString statusIdleSomeFound = new SpannableString("statusIdleSom eFound"); 107 SpannableString statusIdleSomeFound = new SpannableString("statusIdleSom eFound");
68 String positiveButton = new String("positiveButton"); 108 String positiveButton = new String("positiveButton");
69 final ItemChooserDialog.ItemChooserLabels labels = 109 final ItemChooserDialog.ItemChooserLabels labels =
70 new ItemChooserDialog.ItemChooserLabels(title, searching, noneFo und, statusActive, 110 new ItemChooserDialog.ItemChooserLabels(title, searching, noneFo und, statusActive,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 150
111 CriteriaHelper.pollUiThread( 151 CriteriaHelper.pollUiThread(
112 Criteria.equals(expectedItemId, new Callable<String>() { 152 Criteria.equals(expectedItemId, new Callable<String>() {
113 @Override 153 @Override
114 public String call() { 154 public String call() {
115 return mLastSelectedId; 155 return mLastSelectedId;
116 } 156 }
117 })); 157 }));
118 } 158 }
119 159
160 private ImageView getIconImageView(ListView items, int pos) {
161 final int first = items.getFirstVisiblePosition();
162 final int last = items.getLastVisiblePosition();
163 View item;
164 if (pos < first || pos > last) {
165 item = items.getAdapter().getView(pos, null, items);
166 } else {
167 final int visiblePos = pos - first;
168 item = items.getChildAt(visiblePos);
169 }
170 return (ImageView) item.findViewById(R.id.icon);
171 }
172
173 @LargeTest
174 @UiThreadTest
175 public void testAddItemsWithNoIcons() throws InterruptedException {
176 Dialog dialog = mChooserDialog.getDialogForTesting();
177 assertTrue(dialog.isShowing());
178
179 ItemChooserDialog.ItemAdapter itemAdapter = mChooserDialog.getItemAdapte rForTesting();
180 final ListView items = (ListView) dialog.findViewById(R.id.items);
181
182 // Initially the itemAdapter is empty.
183 assertTrue(itemAdapter.isEmpty());
184
185 {
juncai 2017/02/22 22:22:57 Question: why put these lines of code into a {}? I
ortuno 2017/02/28 01:42:48 Android sometimes reuses views so we need to retri
186 // Add item 1 with no icon.
187 mChooserDialog.addOrUpdateItem("key1", "desc1");
188 ImageView icon1 = getIconImageView(items, 0);
189 assertEquals(View.GONE, icon1.getVisibility());
190 assertEquals(null, icon1.getDrawable());
191 }
192
193 {
194 // Add item 2 with no icon.
195 mChooserDialog.addOrUpdateItem("key2", "desc2");
196 ImageView icon2 = getIconImageView(items, 1);
197 assertEquals(View.GONE, icon2.getVisibility());
198 assertEquals(null, icon2.getDrawable());
199 }
200
201 mChooserDialog.setIdleState();
202 mChooserDialog.dismiss();
203 }
204
205 @LargeTest
206 @UiThreadTest
207 public void testAddItemsWithIcons() throws InterruptedException {
208 Dialog dialog = mChooserDialog.getDialogForTesting();
209 assertTrue(dialog.isShowing());
210
211 ItemChooserDialog.ItemAdapter itemAdapter = mChooserDialog.getItemAdapte rForTesting();
212 final ListView items = (ListView) dialog.findViewById(R.id.items);
213
214 // Initially the itemAdapter is empty.
215 assertTrue(itemAdapter.isEmpty());
216
217 {
218 // Add item 1 with no icon.
219 mChooserDialog.addOrUpdateItem("key1", "desc1", mTestIcon1);
220 ImageView icon1 = getIconImageView(items, 0);
221 assertEquals(View.VISIBLE, icon1.getVisibility());
222 assertEquals(mTestDrawable1, icon1.getDrawable());
223 assertEquals(mTestDrawableDescription1, icon1.getContentDescription( ));
224 }
225
226 {
227 // Add item 2 with no icon.
228 mChooserDialog.addOrUpdateItem("key2", "desc2", mTestIcon2);
229 ImageView icon1 = getIconImageView(items, 0);
230 assertEquals(View.VISIBLE, icon1.getVisibility());
231 assertEquals(mTestDrawable1, icon1.getDrawable());
232 assertEquals(mTestDrawableDescription1, icon1.getContentDescription( ));
233 ImageView icon2 = getIconImageView(items, 1);
234 assertEquals(View.VISIBLE, icon2.getVisibility());
235 assertEquals(mTestDrawable2, icon2.getDrawable());
236 assertEquals(mTestDrawableDescription2, icon2.getContentDescription( ));
237 }
238
239 mChooserDialog.setIdleState();
240 mChooserDialog.dismiss();
241 }
242
243 @LargeTest
244 @UiThreadTest
245 public void testAddItemWithIconAfterItemWithNoIcon() throws InterruptedExcep tion {
246 Dialog dialog = mChooserDialog.getDialogForTesting();
247 assertTrue(dialog.isShowing());
248
249 ItemChooserDialog.ItemAdapter itemAdapter = mChooserDialog.getItemAdapte rForTesting();
250 final ListView items = (ListView) dialog.findViewById(R.id.items);
251
252 // Initially the itemAdapter is empty.
253 assertTrue(itemAdapter.isEmpty());
254
255 {
256 // Add item 1 with no icon.
257 mChooserDialog.addOrUpdateItem("key1", "desc1");
258 ImageView icon1 = getIconImageView(items, 0);
259 assertEquals(View.GONE, icon1.getVisibility());
260 assertEquals(null, icon1.getDrawable());
261 }
262
263 {
264 // Add item 2 with icon.
265 mChooserDialog.addOrUpdateItem("key2", "desc2", mTestIcon2);
266 ImageView icon1 = getIconImageView(items, 0);
267 ImageView icon2 = getIconImageView(items, 1);
268 assertEquals(View.INVISIBLE, icon1.getVisibility());
269 assertEquals(View.VISIBLE, icon2.getVisibility());
270 assertEquals(mTestDrawable2, icon2.getDrawable());
271 }
272
273 mChooserDialog.setIdleState();
274 mChooserDialog.dismiss();
275 }
276
277 @LargeTest
278 @UiThreadTest
279 public void testAddItemWithNoIconAfterItemWithIcon() throws InterruptedExcep tion {
280 Dialog dialog = mChooserDialog.getDialogForTesting();
281 assertTrue(dialog.isShowing());
282
283 ItemChooserDialog.ItemAdapter itemAdapter = mChooserDialog.getItemAdapte rForTesting();
284 final ListView items = (ListView) dialog.findViewById(R.id.items);
285
286 // Initially the itemAdapter is empty.
287 assertTrue(itemAdapter.isEmpty());
288
289 {
290 // Add item 1 with icon.
291 mChooserDialog.addOrUpdateItem("key1", "desc1", mTestIcon1);
292 ImageView icon1 = getIconImageView(items, 0);
293 assertEquals(View.VISIBLE, icon1.getVisibility());
294 assertEquals(mTestDrawable1, icon1.getDrawable());
295 }
296
297 {
298 // Add item 2 with no icon.
299 mChooserDialog.addOrUpdateItem("key2", "desc2");
300 ImageView icon1 = getIconImageView(items, 0);
301 ImageView icon2 = getIconImageView(items, 1);
302 assertEquals(View.VISIBLE, icon1.getVisibility());
303 assertEquals(mTestDrawable1, icon1.getDrawable());
304 assertEquals(View.INVISIBLE, icon2.getVisibility());
305 }
306
307 mChooserDialog.setIdleState();
308 mChooserDialog.dismiss();
309 }
310
311 @LargeTest
312 @UiThreadTest
313 public void testRemoveItemWithIconNoItemsWithIconsLeft() throws InterruptedE xception {
314 Dialog dialog = mChooserDialog.getDialogForTesting();
315 assertTrue(dialog.isShowing());
316
317 ItemChooserDialog.ItemAdapter itemAdapter = mChooserDialog.getItemAdapte rForTesting();
318 final ListView items = (ListView) dialog.findViewById(R.id.items);
319
320 // Initially the itemAdapter is empty.
321 assertTrue(itemAdapter.isEmpty());
322
323 {
324 // Add item 1 with icon.
325 mChooserDialog.addOrUpdateItem("key1", "desc1", mTestIcon1);
326 ImageView icon1 = getIconImageView(items, 0);
327 assertEquals(View.VISIBLE, icon1.getVisibility());
328 assertEquals(mTestDrawable1, icon1.getDrawable());
329 }
330 {
331 // Add item 2 with no icon.
332 mChooserDialog.addOrUpdateItem("key2", "desc2");
333 ImageView icon1 = getIconImageView(items, 0);
334 ImageView icon2 = getIconImageView(items, 1);
335 assertEquals(View.VISIBLE, icon1.getVisibility());
336 assertEquals(View.INVISIBLE, icon2.getVisibility());
337 }
338 {
339 // Remove item 1 with icon. No items with icons left.
340 mChooserDialog.removeItemFromList("key1");
341 ImageView icon2 = getIconImageView(items, 0);
342 assertEquals(View.GONE, icon2.getVisibility());
343 }
344
345 mChooserDialog.setIdleState();
346 mChooserDialog.dismiss();
347 }
348
349 @LargeTest
350 @UiThreadTest
351 public void testRemoveItemWithIconOneItemWithIconLeft() throws InterruptedEx ception {
352 Dialog dialog = mChooserDialog.getDialogForTesting();
353 assertTrue(dialog.isShowing());
354
355 ItemChooserDialog.ItemAdapter itemAdapter = mChooserDialog.getItemAdapte rForTesting();
356 final ListView items = (ListView) dialog.findViewById(R.id.items);
357
358 // Initially the itemAdapter is empty.
359 assertTrue(itemAdapter.isEmpty());
360 {
361 // Add item 1 with icon.
362 mChooserDialog.addOrUpdateItem("key1", "desc1", mTestIcon1);
363 ImageView icon1 = getIconImageView(items, 0);
364 assertEquals(View.VISIBLE, icon1.getVisibility());
365 }
366 {
367 // Add item 2 with icon.
368 mChooserDialog.addOrUpdateItem("key2", "desc2", mTestIcon2);
369 ImageView icon1 = getIconImageView(items, 0);
370 ImageView icon2 = getIconImageView(items, 1);
371 assertEquals(View.VISIBLE, icon1.getVisibility());
372 assertEquals(View.VISIBLE, icon2.getVisibility());
373 }
374 {
375 // Add item 3 with no icon.
376 mChooserDialog.addOrUpdateItem("key3", "desc3");
377 ImageView icon1 = getIconImageView(items, 0);
378 ImageView icon2 = getIconImageView(items, 1);
379 ImageView icon3 = getIconImageView(items, 2);
380 assertEquals(View.VISIBLE, icon1.getVisibility());
381 assertEquals(View.VISIBLE, icon2.getVisibility());
382 assertEquals(View.INVISIBLE, icon3.getVisibility());
383 }
384 {
385 mChooserDialog.removeItemFromList("key1");
386 ImageView icon2 = getIconImageView(items, 0);
387 ImageView icon3 = getIconImageView(items, 1);
388 assertEquals(View.VISIBLE, icon2.getVisibility());
389 assertEquals(mTestDrawable2, icon2.getDrawable());
390 assertEquals(View.INVISIBLE, icon3.getVisibility());
391 }
392 mChooserDialog.setIdleState();
393 mChooserDialog.dismiss();
394 }
395
396 @LargeTest
397 @UiThreadTest
398 public void testUpdateItemWithIconToNoIcon() throws InterruptedException {
399 Dialog dialog = mChooserDialog.getDialogForTesting();
400 assertTrue(dialog.isShowing());
401
402 ItemChooserDialog.ItemAdapter itemAdapter = mChooserDialog.getItemAdapte rForTesting();
403 final ListView items = (ListView) dialog.findViewById(R.id.items);
404
405 // Initially the itemAdapter is empty.
406 assertTrue(itemAdapter.isEmpty());
407
408 {
409 // Add item 1 with icon.
410 mChooserDialog.addOrUpdateItem("key1", "desc1", mTestIcon1);
411 ImageView icon1 = getIconImageView(items, 0);
412 assertEquals(View.VISIBLE, icon1.getVisibility());
413 assertEquals(mTestDrawableDescription1, icon1.getContentDescription( ));
414 assertTrue(itemAdapter.getItem(0).hasSameContents("key1", "desc1", m TestIcon1));
415 }
416 {
417 // Update item 1 to no icon.
418 mChooserDialog.addOrUpdateItem("key1", "desc1");
419 ImageView icon1 = getIconImageView(items, 0);
420 assertEquals(View.GONE, icon1.getVisibility());
421 assertEquals(null, icon1.getContentDescription());
422 assertTrue(itemAdapter.getItem(0).hasSameContents("key1", "desc1", n ull));
423 }
424 mChooserDialog.setIdleState();
425 mChooserDialog.dismiss();
426 }
427
428 @LargeTest
429 @UiThreadTest
430 public void testUpdateItemWithNoIconToIcon() throws InterruptedException {
431 Dialog dialog = mChooserDialog.getDialogForTesting();
432 assertTrue(dialog.isShowing());
433
434 ItemChooserDialog.ItemAdapter itemAdapter = mChooserDialog.getItemAdapte rForTesting();
435 final ListView items = (ListView) dialog.findViewById(R.id.items);
436
437 // Initially the itemAdapter is empty.
438 assertTrue(itemAdapter.isEmpty());
439
440 {
441 // Add item 1 to no icon.
442 mChooserDialog.addOrUpdateItem("key1", "desc1");
443 ImageView icon1 = getIconImageView(items, 0);
444 assertEquals(View.GONE, icon1.getVisibility());
445 assertTrue(itemAdapter.getItem(0).hasSameContents("key1", "desc1"));
446 }
447 {
448 // Update item 1 with icon.
449 mChooserDialog.addOrUpdateItem("key1", "desc1", mTestIcon1);
450 ImageView icon1 = getIconImageView(items, 0);
451 assertEquals(View.VISIBLE, icon1.getVisibility());
452 assertEquals(mTestDrawable1, icon1.getDrawable());
453 assertEquals(mTestDrawableDescription1, icon1.getContentDescription( ));
454 assertTrue(itemAdapter.getItem(0).hasSameContents("key1", "desc1", m TestIcon1));
455 }
456 mChooserDialog.setIdleState();
457 mChooserDialog.dismiss();
458 }
459
460 @LargeTest
461 @UiThreadTest
462 public void testUpdateItemIcon() throws InterruptedException {
463 Dialog dialog = mChooserDialog.getDialogForTesting();
464 assertTrue(dialog.isShowing());
465
466 ItemChooserDialog.ItemAdapter itemAdapter = mChooserDialog.getItemAdapte rForTesting();
467 final ListView items = (ListView) dialog.findViewById(R.id.items);
468
469 // Initially the itemAdapter is empty.
470 assertTrue(itemAdapter.isEmpty());
471
472 {
473 // Update item 1 with icon.
474 mChooserDialog.addOrUpdateItem("key1", "desc1", mTestIcon1);
475 ImageView icon1 = getIconImageView(items, 0);
476 assertEquals(View.VISIBLE, icon1.getVisibility());
477 assertEquals(mTestDrawable1, icon1.getDrawable());
478 assertEquals(mTestDrawableDescription1, icon1.getContentDescription( ));
479 assertTrue(itemAdapter.getItem(0).hasSameContents("key1", "desc1", m TestIcon1));
480 }
481 {
482 // Update item 1 with different icon.
483 mChooserDialog.addOrUpdateItem("key1", "desc1", mTestIcon2);
484 ImageView icon1 = getIconImageView(items, 0);
485 assertEquals(View.VISIBLE, icon1.getVisibility());
486 assertEquals(mTestDrawable2, icon1.getDrawable());
487 assertEquals(mTestDrawableDescription2, icon1.getContentDescription( ));
488 assertTrue(itemAdapter.getItem(0).hasSameContents("key1", "desc1", m TestIcon2));
489 }
490 mChooserDialog.setIdleState();
491 mChooserDialog.dismiss();
492 }
493
120 @LargeTest 494 @LargeTest
121 public void testSimpleItemSelection() { 495 public void testSimpleItemSelection() {
122 Dialog dialog = mChooserDialog.getDialogForTesting(); 496 Dialog dialog = mChooserDialog.getDialogForTesting();
123 assertTrue(dialog.isShowing()); 497 assertTrue(dialog.isShowing());
124 498
125 TextViewWithClickableSpans statusView = (TextViewWithClickableSpans) 499 TextViewWithClickableSpans statusView = (TextViewWithClickableSpans)
126 dialog.findViewById(R.id.status); 500 dialog.findViewById(R.id.status);
127 final ListView items = (ListView) dialog.findViewById(R.id.items); 501 final ListView items = (ListView) dialog.findViewById(R.id.items);
128 final Button button = (Button) dialog.findViewById(R.id.positive); 502 final Button button = (Button) dialog.findViewById(R.id.positive);
129 503
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 841
468 // 1460 * .3 is 438, which rounds above the maximum height. 842 // 1460 * .3 is 438, which rounds above the maximum height.
469 assertEquals(408, ItemChooserDialog.getListHeight(1460, 1.0f)); 843 assertEquals(408, ItemChooserDialog.getListHeight(1460, 1.0f));
470 844
471 // 1100px is 500dp at a density of 2.2. 500 * .3 is 150dp, which is 48dp * 845 // 1100px is 500dp at a density of 2.2. 500 * .3 is 150dp, which is 48dp *
472 // 3.125. 48dp * 3.5 is 168dp. 168dp * 2.2px/dp is 369.6, which rounds t o 846 // 3.125. 48dp * 3.5 is 168dp. 168dp * 2.2px/dp is 369.6, which rounds t o
473 // 370. 847 // 370.
474 assertEquals(370, ItemChooserDialog.getListHeight(1100, 2.2f)); 848 assertEquals(370, ItemChooserDialog.getListHeight(1100, 2.2f));
475 } 849 }
476 } 850 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698