예제 #1
0
 @Test
 public void setRouteTo_failureShouldDismissLoadingDialogUpon() throws Exception {
   fragment.createRouteToDestination();
   fragment.failure(500);
   assertThat(activity.getMapFragment().getView().findViewById(R.id.map)).isVisible();
   assertThat(activity.getMapFragment().getView().findViewById(R.id.progress)).isNotVisible();
 }
예제 #2
0
 @Test
 public void setRouteTo_successShouldDismissLoadingDialogUpon() throws Exception {
   fragment.createRouteToDestination();
   fragment.success(new Route(getFixture("around_the_block")));
   assertThat(activity.getMapFragment().getView().findViewById(R.id.map)).isVisible();
   assertThat(activity.getMapFragment().getView().findViewById(R.id.progress)).isNotVisible();
 }
예제 #3
0
 @Test
 public void reverse_shouldToggleCircleButtonToStart() throws Exception {
   fragment.createRouteToDestination();
   Route testRoute = new Route(getFixture("around_the_block"));
   fragment.success(testRoute);
   fragment.reverse();
   fragment.reverse();
   assertThat(fragment.routingCircle.getTag()).isEqualTo(activity.getString(R.string.start));
 }
예제 #4
0
 @Test
 public void start_shouldStartRouting() throws Exception {
   fragment.createRouteToDestination();
   Route testRoute = new Route(getFixture("around_the_block"));
   fragment.success(testRoute);
   ImageButton startBtn = (ImageButton) fragment.getView().findViewById(R.id.routing_circle);
   startBtn.performClick();
   assertThat(activity.getSupportFragmentManager()).hasFragmentWithTag(RouteFragment.TAG);
 }
예제 #5
0
 @Before
 public void setup() throws Exception {
   ((TestMapzenApplication) Robolectric.application).inject(this);
   MockitoAnnotations.initMocks(this);
   activity = initBaseActivity();
   activity.disableActionbar();
   destination = getTestSimpleFeature();
   fragment = RoutePreviewFragment.newInstance(activity, destination);
   TestHelper.startFragment(fragment, activity);
 }
예제 #6
0
 @Test
 public void onResume_shouldNotCreateRouteToDestinationIfRouting() throws Exception {
   activity
       .getSupportFragmentManager()
       .beginTransaction()
       .add(new Fragment(), RouteFragment.TAG)
       .commit();
   fragment.onResume();
   verify(router, times(1)).fetch();
 }
예제 #7
0
 @Test
 public void onViewCreated_shouldHideActionBar() throws Exception {
   activity.getSupportActionBar().show();
   fragment.onViewCreated(fragment.getView(), null);
   assertThat(activity.getSupportActionBar().isShowing()).isFalse();
 }
예제 #8
0
 @Test
 public void onDetach_shouldShowActionbar() throws Exception {
   fragment.onDetach();
   assertThat(activity.actionBarIsEnabled()).isTrue();
   assertThat(activity.getSupportActionBar().isShowing()).isTrue();
 }
예제 #9
0
 @Test
 public void onStart_shouldHideActionbar() throws Exception {
   assertThat(activity.getSupportActionBar().isShowing()).isFalse();
 }
예제 #10
0
 @Test
 public void setRouteTo_shouldShowLoadingDialog() throws Exception {
   fragment.createRouteToDestination();
   assertThat(activity.getMapFragment().getView().findViewById(R.id.progress)).isVisible();
 }