Search in sources :

Example 1 with ViewControllerOverlay

use of com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ViewControllerOverlay in project react-native-navigation by wix.

the class ViewControllerTest method onChildViewAdded_delegatesToYellowBoxDelegate.

@Test
public void onChildViewAdded_delegatesToYellowBoxDelegate() {
    View child = new View(activity);
    ViewGroup view = new FrameLayout(activity);
    ViewController vc = new ViewController(activity, "", yellowBoxDelegate, new Options(), new ViewControllerOverlay(activity)) {

        @Override
        public ViewGroup createView() {
            return view;
        }

        @Override
        public void sendOnNavigationButtonPressed(String buttonId) {
        }

        @Override
        public String getCurrentComponentName() {
            return null;
        }
    };
    vc.onChildViewAdded(view, child);
    verify(yellowBoxDelegate).onChildViewAdded(view, child);
}
Also used : Options(com.reactnativenavigation.options.Options) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) View(android.view.View) ViewControllerOverlay(com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ViewControllerOverlay) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 2 with ViewControllerOverlay

use of com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ViewControllerOverlay in project react-native-navigation by wix.

the class ViewControllerTest method canOverrideViewCreation.

@Test
public void canOverrideViewCreation() {
    final FrameLayout otherView = new FrameLayout(activity);
    yellowBoxDelegate = spy(new YellowBoxDelegate(activity));
    ViewController myController = new ViewController(activity, "vc", yellowBoxDelegate, new Options(), new ViewControllerOverlay(activity)) {

        @Override
        public FrameLayout createView() {
            return otherView;
        }

        @Override
        public void sendOnNavigationButtonPressed(String buttonId) {
        }

        @Override
        public String getCurrentComponentName() {
            return null;
        }
    };
    assertThat(myController.getView()).isEqualTo(otherView);
}
Also used : Options(com.reactnativenavigation.options.Options) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) FrameLayout(android.widget.FrameLayout) ViewControllerOverlay(com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ViewControllerOverlay) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Aggregations

FrameLayout (android.widget.FrameLayout)2 BaseTest (com.reactnativenavigation.BaseTest)2 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)2 Options (com.reactnativenavigation.options.Options)2 ViewControllerOverlay (com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ViewControllerOverlay)2 Test (org.junit.Test)2 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1