Exemplo n.º 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();
 }
Exemplo n.º 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();
 }
Exemplo n.º 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));
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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();
 }
Exemplo n.º 7
0
 @Test
 public void onViewCreated_shouldHideActionBar() throws Exception {
   activity.getSupportActionBar().show();
   fragment.onViewCreated(fragment.getView(), null);
   assertThat(activity.getSupportActionBar().isShowing()).isFalse();
 }
Exemplo n.º 8
0
 @Test
 public void onDetach_shouldShowActionbar() throws Exception {
   fragment.onDetach();
   assertThat(activity.actionBarIsEnabled()).isTrue();
   assertThat(activity.getSupportActionBar().isShowing()).isTrue();
 }
Exemplo n.º 9
0
 @Test
 public void onStart_shouldHideActionbar() throws Exception {
   assertThat(activity.getSupportActionBar().isShowing()).isFalse();
 }
Exemplo n.º 10
0
 @Test
 public void setRouteTo_shouldShowLoadingDialog() throws Exception {
   fragment.createRouteToDestination();
   assertThat(activity.getMapFragment().getView().findViewById(R.id.progress)).isVisible();
 }