|
@@ -357,6 +357,34 @@ public class StackControllerTest extends BaseTest {
|
357
|
357
|
assertThat(animator.getDuration()).isEqualTo(300);
|
358
|
358
|
}
|
359
|
359
|
|
|
360
|
+ @SuppressWarnings("MagicNumber")
|
|
361
|
+ @Test
|
|
362
|
+ public void pop_animationOptionsAreMergedCorrectlyToDisappearingChildWithDefaultOptions() throws JSONException {
|
|
363
|
+ disablePushAnimation(child1, child2);
|
|
364
|
+
|
|
365
|
+ uut.push(child1, new CommandListenerAdapter());
|
|
366
|
+ uut.push(child2, new CommandListenerAdapter());
|
|
367
|
+
|
|
368
|
+ Options defaultOptions = new Options();
|
|
369
|
+ JSONObject content = new JSONObject();
|
|
370
|
+ JSONObject x = new JSONObject();
|
|
371
|
+ x.put("duration", 300);
|
|
372
|
+ x.put("from", 0);
|
|
373
|
+ x.put("to", 1000);
|
|
374
|
+ content.put("x", x);
|
|
375
|
+ defaultOptions.animations.pop.content = AnimationOptions.parse(content);
|
|
376
|
+ uut.setDefaultOptions(defaultOptions);
|
|
377
|
+
|
|
378
|
+ uut.pop(Options.EMPTY, new CommandListenerAdapter());
|
|
379
|
+ ArgumentCaptor<NestedAnimationsOptions> captor = ArgumentCaptor.forClass(NestedAnimationsOptions.class);
|
|
380
|
+ verify(animator, times(1)).pop(any(), captor.capture(), any());
|
|
381
|
+ Animator animator = captor.getValue().content
|
|
382
|
+ .getAnimation(mock(View.class))
|
|
383
|
+ .getChildAnimations()
|
|
384
|
+ .get(0);
|
|
385
|
+ assertThat(animator.getDuration()).isEqualTo(300);
|
|
386
|
+ }
|
|
387
|
+
|
360
|
388
|
@Test
|
361
|
389
|
public void canPopWhenSizeIsMoreThanOne() {
|
362
|
390
|
assertThat(uut.isEmpty()).isTrue();
|