@Test public void testBackgroundDrawable() { Drawable backgroundDrawable = mock(Drawable.class); int[] offset = new int[] {1, 2, 3, 4}; locationViewSettings.setBackgroundDrawable(backgroundDrawable, offset); assertEquals( "foreground should match", backgroundDrawable, locationViewSettings.getBackgroundDrawable()); assertTrue( "offsets should match", Arrays.equals(offset, locationViewSettings.getBackgroundOffset())); }
@Test public void testForegroundDrawables() { Drawable foregroundDrawable = mock(Drawable.class); Drawable foregroundBearingDrawable = mock(Drawable.class); Drawable.ConstantState constantState = mock(Drawable.ConstantState.class); when(foregroundDrawable.getConstantState()).thenReturn(constantState); when(constantState.newDrawable()).thenReturn(foregroundDrawable); locationViewSettings.setForegroundDrawable(foregroundDrawable, foregroundBearingDrawable); assertEquals( "foreground should match", foregroundDrawable, locationViewSettings.getForegroundDrawable()); assertEquals( "foreground bearing should match", foregroundBearingDrawable, locationViewSettings.getForegroundBearingDrawable()); }
@Test public void testBackgroundTransparentTint() { int color = Color.TRANSPARENT; locationViewSettings.setBackgroundTintColor(Color.TRANSPARENT); assertEquals("color should match", color, locationViewSettings.getBackgroundTintColor()); }
@Test public void testBackgroundTint() { int color = Color.RED; locationViewSettings.setBackgroundTintColor(Color.RED); assertEquals("color should match", color, locationViewSettings.getBackgroundTintColor()); }
@Test public void testEnabled() { assertFalse("initial state should be false", locationViewSettings.isEnabled()); locationViewSettings.setEnabled(true); assertTrue("state should be true", locationViewSettings.isEnabled()); }