|
@@ -15,6 +15,7 @@ import com.reactnativenavigation.parse.Options;
|
15
|
15
|
import com.reactnativenavigation.parse.params.Bool;
|
16
|
16
|
import com.reactnativenavigation.parse.params.NullBool;
|
17
|
17
|
import com.reactnativenavigation.utils.CommandListenerAdapter;
|
|
18
|
+import com.reactnativenavigation.utils.Functions;
|
18
|
19
|
import com.reactnativenavigation.viewcontrollers.stack.StackController;
|
19
|
20
|
import com.reactnativenavigation.views.Component;
|
20
|
21
|
|
|
@@ -112,6 +113,24 @@ public class ViewControllerTest extends BaseTest {
|
112
|
113
|
assertThat(uut.findController("uut")).isEqualTo(uut);
|
113
|
114
|
}
|
114
|
115
|
|
|
116
|
+ @Test
|
|
117
|
+ public void runOnPreDraw() {
|
|
118
|
+ Functions.Func1<View> task = Mockito.mock(Functions.Func1.class);
|
|
119
|
+ uut.runOnPreDraw(task);
|
|
120
|
+ dispatchPreDraw(uut.getView());
|
|
121
|
+ verify(task).run(uut.getView());
|
|
122
|
+ }
|
|
123
|
+
|
|
124
|
+ @Test
|
|
125
|
+ public void runOnPreDraw_doesNotInvokeTaskIfControllerIsDestroyed() {
|
|
126
|
+ Functions.Func1<View> task = Mockito.mock(Functions.Func1.class);
|
|
127
|
+ uut.runOnPreDraw(task);
|
|
128
|
+ View view = uut.getView();
|
|
129
|
+ uut.destroy();
|
|
130
|
+ dispatchPreDraw(view);
|
|
131
|
+ verify(task, times(1)).run(view);
|
|
132
|
+ }
|
|
133
|
+
|
115
|
134
|
@Test
|
116
|
135
|
public void onChildViewAdded_delegatesToYellowBoxDelegate() {
|
117
|
136
|
View child = new View(activity);
|