|
@@ -42,9 +42,7 @@ import org.assertj.core.api.iterable.Extractor;
|
42
|
42
|
import org.json.JSONException;
|
43
|
43
|
import org.json.JSONObject;
|
44
|
44
|
import org.junit.Test;
|
45
|
|
-import org.mockito.ArgumentCaptor;
|
46
|
|
-import org.mockito.InOrder;
|
47
|
|
-import org.mockito.Mockito;
|
|
45
|
+import org.mockito.*;
|
48
|
46
|
|
49
|
47
|
import java.util.ArrayList;
|
50
|
48
|
import java.util.Arrays;
|
|
@@ -297,6 +295,18 @@ public class StackControllerTest extends BaseTest {
|
297
|
295
|
});
|
298
|
296
|
}
|
299
|
297
|
|
|
298
|
+ @Test
|
|
299
|
+ public void pop_screenCurrentlyBeingPushedIsPopped() {
|
|
300
|
+ disablePushAnimation(child1, child2);
|
|
301
|
+ uut.push(child1, Mockito.mock(CommandListenerAdapter.class));
|
|
302
|
+ uut.push(child2, Mockito.mock(CommandListenerAdapter.class));
|
|
303
|
+
|
|
304
|
+ uut.push(child3, Mockito.mock(CommandListenerAdapter.class));
|
|
305
|
+ uut.pop(Options.EMPTY, Mockito.mock(CommandListenerAdapter.class));
|
|
306
|
+ assertThat(uut.size()).isEqualTo(2);
|
|
307
|
+ assertContainsOnlyId(child1.getId(), child2.getId());
|
|
308
|
+ }
|
|
309
|
+
|
300
|
310
|
@Test
|
301
|
311
|
public void pop_appliesOptionsAfterPop() {
|
302
|
312
|
uut.push(child1, new CommandListenerAdapter());
|
|
@@ -622,6 +632,19 @@ public class StackControllerTest extends BaseTest {
|
622
|
632
|
});
|
623
|
633
|
}
|
624
|
634
|
|
|
635
|
+ @Test
|
|
636
|
+ public void popTo_pushAnimationIsCancelled() {
|
|
637
|
+ disablePushAnimation(child1, child2);
|
|
638
|
+ uut.push(child1, Mockito.mock(CommandListenerAdapter.class));
|
|
639
|
+ uut.push(child2, Mockito.mock(CommandListenerAdapter.class));
|
|
640
|
+
|
|
641
|
+ ViewGroup pushed = child3.getView();
|
|
642
|
+ uut.push(child3, Mockito.mock(CommandListenerAdapter.class));
|
|
643
|
+ uut.popTo(child1, Options.EMPTY, Mockito.mock(CommandListenerAdapter.class));
|
|
644
|
+ animator.endPushAnimation(pushed);
|
|
645
|
+ assertContainsOnlyId(child1.getId());
|
|
646
|
+ }
|
|
647
|
+
|
625
|
648
|
@Test
|
626
|
649
|
public void popToRoot_PopsEverythingAboveFirstController() {
|
627
|
650
|
child1.options.animations.push.enabled = new Bool(false);
|
|
@@ -707,6 +730,19 @@ public class StackControllerTest extends BaseTest {
|
707
|
730
|
verify(child1, times(0)).mergeOptions(mergeOptions);
|
708
|
731
|
}
|
709
|
732
|
|
|
733
|
+ @Test
|
|
734
|
+ public void popToRoot_screenPushedBeforePopAnimationCompletesIsPopped() {
|
|
735
|
+ disablePushAnimation(child1, child2);
|
|
736
|
+ uut.push(child1, Mockito.mock(CommandListenerAdapter.class));
|
|
737
|
+ uut.push(child2, Mockito.mock(CommandListenerAdapter.class));
|
|
738
|
+
|
|
739
|
+ ViewGroup pushed = child3.getView();
|
|
740
|
+ uut.push(child3, Mockito.mock(CommandListenerAdapter.class));
|
|
741
|
+ uut.popToRoot(Options.EMPTY, Mockito.mock(CommandListenerAdapter.class));
|
|
742
|
+ animator.endPushAnimation(pushed);
|
|
743
|
+ assertContainsOnlyId(child1.getId());
|
|
744
|
+ }
|
|
745
|
+
|
710
|
746
|
@Test
|
711
|
747
|
public void findControllerById_ReturnsSelfOrChildrenById() {
|
712
|
748
|
assertThat(uut.findController("123")).isNull();
|