use of com.bluelinelabs.conductor.util.TestController in project Conductor by bluelinelabs.
the class RouterTests method testPopToTag.
@Test
public void testPopToTag() {
String controller1Tag = "controller1";
String controller2Tag = "controller2";
String controller3Tag = "controller3";
String controller4Tag = "controller4";
Controller controller1 = new TestController();
Controller controller2 = new TestController();
Controller controller3 = new TestController();
Controller controller4 = new TestController();
router.pushController(RouterTransaction.with(controller1).tag(controller1Tag));
router.pushController(RouterTransaction.with(controller2).tag(controller2Tag));
router.pushController(RouterTransaction.with(controller3).tag(controller3Tag));
router.pushController(RouterTransaction.with(controller4).tag(controller4Tag));
router.popToTag(controller2Tag);
assertEquals(2, router.getBackstackSize());
assertEquals(controller1, router.getControllerWithTag(controller1Tag));
assertEquals(controller2, router.getControllerWithTag(controller2Tag));
assertNull(router.getControllerWithTag(controller3Tag));
assertNull(router.getControllerWithTag(controller4Tag));
}
use of com.bluelinelabs.conductor.util.TestController in project Conductor by bluelinelabs.
the class TargetControllerTests method testSiblingTarget.
@Test
public void testSiblingTarget() {
final TestController controllerA = new TestController();
final TestController controllerB = new TestController();
assertNull(controllerA.getTargetController());
assertNull(controllerB.getTargetController());
router.pushController(RouterTransaction.with(controllerA).pushChangeHandler(MockChangeHandler.defaultHandler()).popChangeHandler(MockChangeHandler.defaultHandler()));
controllerB.setTargetController(controllerA);
router.pushController(RouterTransaction.with(controllerB).pushChangeHandler(MockChangeHandler.defaultHandler()).popChangeHandler(MockChangeHandler.defaultHandler()));
assertNull(controllerA.getTargetController());
assertEquals(controllerA, controllerB.getTargetController());
}
use of com.bluelinelabs.conductor.util.TestController in project Conductor by bluelinelabs.
the class TargetControllerTests method testChildParentTarget.
@Test
public void testChildParentTarget() {
final TestController controllerA = new TestController();
final TestController controllerB = new TestController();
assertNull(controllerA.getTargetController());
assertNull(controllerB.getTargetController());
router.pushController(RouterTransaction.with(controllerA).pushChangeHandler(MockChangeHandler.defaultHandler()).popChangeHandler(MockChangeHandler.defaultHandler()));
controllerA.setTargetController(controllerB);
Router childRouter = controllerA.getChildRouter((ViewGroup) controllerA.getView().findViewById(TestController.VIEW_ID));
childRouter.pushController(RouterTransaction.with(controllerB).pushChangeHandler(MockChangeHandler.defaultHandler()).popChangeHandler(MockChangeHandler.defaultHandler()));
assertNull(controllerB.getTargetController());
assertEquals(controllerB, controllerA.getTargetController());
}
use of com.bluelinelabs.conductor.util.TestController in project Conductor by bluelinelabs.
the class TargetControllerTests method createActivityController.
public void createActivityController(Bundle savedInstanceState) {
ActivityProxy activityProxy = new ActivityProxy().create(savedInstanceState).start().resume();
router = Conductor.attachRouter(activityProxy.getActivity(), activityProxy.getView(), savedInstanceState);
if (!router.hasRootController()) {
router.setRoot(RouterTransaction.with(new TestController()));
}
}
use of com.bluelinelabs.conductor.util.TestController in project Conductor by bluelinelabs.
the class BackstackTests method testPopTo.
@Test
public void testPopTo() {
RouterTransaction transaction1 = RouterTransaction.with(new TestController());
RouterTransaction transaction2 = RouterTransaction.with(new TestController());
RouterTransaction transaction3 = RouterTransaction.with(new TestController());
backstack.push(transaction1);
backstack.push(transaction2);
backstack.push(transaction3);
assertEquals(3, backstack.size());
backstack.popTo(transaction1);
assertEquals(1, backstack.size());
assertEquals(transaction1, backstack.peek());
}
Aggregations