Search in sources :

Example 41 with TestController

use of com.bluelinelabs.conductor.util.TestController in project Conductor by bluelinelabs.

the class ViewLeakTests method testPopWhenPushNeverCompleted.

@Test
public void testPopWhenPushNeverCompleted() {
    Controller controller = new TestController();
    router.pushController(RouterTransaction.with(controller).pushChangeHandler(new NeverCompleteChangeHandler()));
    assertNotNull(controller.getView());
    router.popCurrentController();
    assertNull(controller.getView());
}
Also used : TestController(com.bluelinelabs.conductor.util.TestController) TestController(com.bluelinelabs.conductor.util.TestController) Test(org.junit.Test)

Example 42 with TestController

use of com.bluelinelabs.conductor.util.TestController in project Conductor by bluelinelabs.

the class ViewLeakTests method testActivityStopWhenPushNeverAdded.

@Test
public void testActivityStopWhenPushNeverAdded() {
    Controller controller = new TestController();
    router.pushController(RouterTransaction.with(controller).pushChangeHandler(new NeverAddChangeHandler()));
    assertNotNull(controller.getView());
    activityProxy.stop(true);
    assertNull(controller.getView());
}
Also used : TestController(com.bluelinelabs.conductor.util.TestController) TestController(com.bluelinelabs.conductor.util.TestController) Test(org.junit.Test)

Example 43 with TestController

use of com.bluelinelabs.conductor.util.TestController in project Conductor by bluelinelabs.

the class ViewLeakTests method testPopWhenPushNeverAdded.

@Test
public void testPopWhenPushNeverAdded() {
    Controller controller = new TestController();
    router.pushController(RouterTransaction.with(controller).pushChangeHandler(new NeverAddChangeHandler()));
    assertNotNull(controller.getView());
    router.popCurrentController();
    assertNull(controller.getView());
}
Also used : TestController(com.bluelinelabs.conductor.util.TestController) TestController(com.bluelinelabs.conductor.util.TestController) Test(org.junit.Test)

Example 44 with TestController

use of com.bluelinelabs.conductor.util.TestController in project Conductor by bluelinelabs.

the class RouterTests method testSetBackstack.

@Test
public void testSetBackstack() {
    RouterTransaction rootTransaction = RouterTransaction.with(new TestController());
    RouterTransaction middleTransaction = RouterTransaction.with(new TestController());
    RouterTransaction topTransaction = RouterTransaction.with(new TestController());
    List<RouterTransaction> backstack = Arrays.asList(rootTransaction, middleTransaction, topTransaction);
    router.setBackstack(backstack, null);
    assertEquals(3, router.getBackstackSize());
    List<RouterTransaction> fetchedBackstack = router.getBackstack();
    assertEquals(rootTransaction, fetchedBackstack.get(0));
    assertEquals(middleTransaction, fetchedBackstack.get(1));
    assertEquals(topTransaction, fetchedBackstack.get(2));
}
Also used : TestController(com.bluelinelabs.conductor.util.TestController) Test(org.junit.Test)

Example 45 with TestController

use of com.bluelinelabs.conductor.util.TestController in project Conductor by bluelinelabs.

the class RouterTests method testReplaceTopController.

@Test
public void testReplaceTopController() {
    RouterTransaction rootTransaction = RouterTransaction.with(new TestController());
    RouterTransaction topTransaction = RouterTransaction.with(new TestController());
    List<RouterTransaction> backstack = Arrays.asList(rootTransaction, topTransaction);
    router.setBackstack(backstack, null);
    assertEquals(2, router.getBackstackSize());
    List<RouterTransaction> fetchedBackstack = router.getBackstack();
    assertEquals(rootTransaction, fetchedBackstack.get(0));
    assertEquals(topTransaction, fetchedBackstack.get(1));
    RouterTransaction newTopTransaction = RouterTransaction.with(new TestController());
    router.replaceTopController(newTopTransaction);
    assertEquals(2, router.getBackstackSize());
    fetchedBackstack = router.getBackstack();
    assertEquals(rootTransaction, fetchedBackstack.get(0));
    assertEquals(newTopTransaction, fetchedBackstack.get(1));
}
Also used : TestController(com.bluelinelabs.conductor.util.TestController) Test(org.junit.Test)

Aggregations

TestController (com.bluelinelabs.conductor.util.TestController)65 Test (org.junit.Test)64 CallState (com.bluelinelabs.conductor.util.CallState)14 View (android.view.View)6 ViewGroup (android.view.ViewGroup)5 MockChangeHandler (com.bluelinelabs.conductor.util.MockChangeHandler)5 Bundle (android.os.Bundle)4 HorizontalChangeHandler (com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler)3 Intent (android.content.Intent)2 FadeChangeHandler (com.bluelinelabs.conductor.changehandler.FadeChangeHandler)2 LifecycleListener (com.bluelinelabs.conductor.Controller.LifecycleListener)1 VerticalChangeHandler (com.bluelinelabs.conductor.changehandler.VerticalChangeHandler)1 ActivityProxy (com.bluelinelabs.conductor.util.ActivityProxy)1