mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
Merge pull request #1034 from misaochan/fix-description-bug
Fix issue with Nearby item descriptions
This commit is contained in:
commit
a8bc53d1a7
5 changed files with 31 additions and 27 deletions
|
|
@ -30,10 +30,11 @@ import static org.junit.Assert.assertNotNull;
|
|||
@Config(constants = BuildConfig.class, sdk = 21, application = TestCommonsApplication.class)
|
||||
public class NearbyAdapterFactoryTest {
|
||||
|
||||
private static final Place PLACE = new Place("name", Place.Description.AIRPORT,
|
||||
private static final Place PLACE = new Place("name", Place.Label.AIRPORT,
|
||||
"desc", null, new LatLng(38.6270, -90.1994, 0), null);
|
||||
private static final Place UNKNOWN_PLACE = new Place("name", Place.Description.UNKNOWN,
|
||||
"desc", null, new LatLng(39.7392, -104.9903, 0), null);
|
||||
private static final Place UNKNOWN_PLACE = new Place("name", Place.Label.UNKNOWN,
|
||||
"?", null, new LatLng(39.7392, -104.9903, 0), null);
|
||||
// ^ "?" is a special value for unknown class names from Wikidata query results
|
||||
private Place clickedPlace;
|
||||
|
||||
@Test
|
||||
|
|
@ -68,12 +69,13 @@ public class NearbyAdapterFactoryTest {
|
|||
|
||||
RendererViewHolder viewHolder = renderComponent(result);
|
||||
|
||||
// test that the values we gave are actually rendered
|
||||
assertNotNull(viewHolder.itemView.findViewById(R.id.tvName));
|
||||
assertEquals("name",
|
||||
assertEquals(PLACE.name,
|
||||
((TextView) viewHolder.itemView.findViewById(R.id.tvName)).getText().toString());
|
||||
|
||||
assertNotNull(viewHolder.itemView.findViewById(R.id.tvDesc));
|
||||
assertEquals("airport",
|
||||
assertEquals(PLACE.getLongDescription(),
|
||||
((TextView) viewHolder.itemView.findViewById(R.id.tvDesc)).getText().toString());
|
||||
|
||||
assertNotNull(viewHolder.itemView.findViewById(R.id.distance));
|
||||
|
|
@ -94,7 +96,7 @@ public class NearbyAdapterFactoryTest {
|
|||
RendererViewHolder viewHolder = renderComponent(result);
|
||||
|
||||
assertNotNull(viewHolder.itemView.findViewById(R.id.tvDesc));
|
||||
assertEquals("no description found",
|
||||
assertEquals(RuntimeEnvironment.application.getString(R.string.no_description_found),
|
||||
((TextView) viewHolder.itemView.findViewById(R.id.tvDesc)).getText().toString());
|
||||
|
||||
assertNotNull(viewHolder.itemView.findViewById(R.id.icon));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue