|
@@ -12,9 +12,9 @@ import com.reactnativenavigation.TestUtils;
|
12
|
12
|
import com.reactnativenavigation.anim.NavigationAnimator;
|
13
|
13
|
import com.reactnativenavigation.mocks.ImageLoaderMock;
|
14
|
14
|
import com.reactnativenavigation.mocks.SimpleViewController;
|
|
15
|
+import com.reactnativenavigation.mocks.TitleBarButtonCreatorMock;
|
15
|
16
|
import com.reactnativenavigation.mocks.TitleBarReactViewCreatorMock;
|
16
|
17
|
import com.reactnativenavigation.mocks.TopBarBackgroundViewCreatorMock;
|
17
|
|
-import com.reactnativenavigation.mocks.TitleBarButtonCreatorMock;
|
18
|
18
|
import com.reactnativenavigation.parse.AnimationOptions;
|
19
|
19
|
import com.reactnativenavigation.parse.NestedAnimationsOptions;
|
20
|
20
|
import com.reactnativenavigation.parse.Options;
|
|
@@ -59,6 +59,7 @@ import java.util.List;
|
59
|
59
|
|
60
|
60
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
61
|
61
|
|
|
62
|
+import static com.reactnativenavigation.utils.ObjectUtils.take;
|
62
|
63
|
import static com.reactnativenavigation.utils.ViewUtils.topMargin;
|
63
|
64
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
64
|
65
|
import static org.mockito.ArgumentMatchers.any;
|
|
@@ -82,6 +83,7 @@ public class StackControllerTest extends BaseTest {
|
82
|
83
|
private ViewController child1a;
|
83
|
84
|
private ViewController child2;
|
84
|
85
|
private ViewController child3;
|
|
86
|
+ private SimpleViewController.SimpleView child3View;
|
85
|
87
|
private ViewController child4;
|
86
|
88
|
private NavigationAnimator animator;
|
87
|
89
|
private TopBarController topBarController;
|
|
@@ -108,13 +110,22 @@ public class StackControllerTest extends BaseTest {
|
108
|
110
|
new Options()
|
109
|
111
|
)
|
110
|
112
|
);
|
|
113
|
+ createChildren();
|
|
114
|
+ uut = createStack();
|
|
115
|
+ activity.setContentView(uut.getView());
|
|
116
|
+ }
|
|
117
|
+
|
|
118
|
+ private void createChildren() {
|
111
|
119
|
child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
|
112
|
120
|
child1a = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
|
113
|
121
|
child2 = spy(new SimpleViewController(activity, childRegistry, "child2", new Options()));
|
114
|
|
- child3 = spy(new SimpleViewController(activity, childRegistry, "child3", new Options()));
|
|
122
|
+ child3 = spy(new SimpleViewController(activity, childRegistry, "child3", new Options()) {
|
|
123
|
+ @Override
|
|
124
|
+ protected SimpleView createView() {
|
|
125
|
+ return take(child3View, super.createView());
|
|
126
|
+ }
|
|
127
|
+ });
|
115
|
128
|
child4 = spy(new SimpleViewController(activity, childRegistry, "child4", new Options()));
|
116
|
|
- uut = createStack();
|
117
|
|
- activity.setContentView(uut.getView());
|
118
|
129
|
}
|
119
|
130
|
|
120
|
131
|
@Test
|
|
@@ -394,6 +405,19 @@ public class StackControllerTest extends BaseTest {
|
394
|
405
|
assertContainsOnlyId(child1a.getId());
|
395
|
406
|
}
|
396
|
407
|
|
|
408
|
+ @Test
|
|
409
|
+ public void setRoot_topScreenIsStartedThenTheRest() {
|
|
410
|
+ disablePushAnimation(child1, child2, child3);
|
|
411
|
+ child3View = spy(new SimpleViewController.SimpleView(activity));
|
|
412
|
+
|
|
413
|
+ uut.setRoot(Arrays.asList(child1, child2, child3), new CommandListenerAdapter());
|
|
414
|
+ ShadowLooper.idleMainLooper();
|
|
415
|
+ InOrder inOrder = inOrder(child3View, child2, child1);
|
|
416
|
+ inOrder.verify(child3View).start();
|
|
417
|
+ inOrder.verify(child2).start();
|
|
418
|
+ inOrder.verify(child1).start();
|
|
419
|
+ }
|
|
420
|
+
|
397
|
421
|
@Test
|
398
|
422
|
public synchronized void pop() {
|
399
|
423
|
disablePushAnimation(child1, child2);
|