[android] - build and test wear module on CI, cleanup gradle file, added make target, added unit test (#7534)

This commit is contained in:
Tobrun
2016-12-28 15:16:18 +01:00
committed by GitHub
parent 65c28deefe
commit eefbb754d0
4 changed files with 66 additions and 14 deletions

View File

@@ -0,0 +1,28 @@
package com.mapbox.weartestapp.utils;
import android.view.View;
import org.junit.Test;
import org.mockito.InjectMocks;
import static junit.framework.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class OffsettingHelperTest {
private static final double DELTA = 1e-15;
@InjectMocks
View view = mock(View.class);
@Test
public void testAnchorOffset() {
float[] offset = new float[2];
int viewHeight = 50;
when(view.getHeight()).thenReturn(viewHeight);
OffsettingHelper offsettingHelper = new OffsettingHelper();
offsettingHelper.adjustAnchorOffsetXY(view, offset);
assertEquals("Offset of " + viewHeight + " should be divided by 2: ", viewHeight / 2, offset[0], DELTA);
}
}