82 }; 83 childByX = createByXChild(); 84 childByX2 = createByXChild(); 85 } 86 87 private Transition createByXChild() { 88 return new TransitionShim() { 89 { 90 setCycleDuration(Duration.seconds(1)); 91 setInterpolator(Interpolator.LINEAR); 92 } 93 94 long lastX; 95 96 @Override 97 protected void interpolate(double frac) { 98 xProperty.set(Math.round(lastX + frac * 1000)); 99 } 100 101 @Override 102 public void impl_sync(boolean forceSync) { 103 super.impl_sync(forceSync); 104 if (forceSync) { 105 lastX = xProperty.get(); 106 } 107 } 108 109 110 }; 111 } 112 113 @Test 114 public void testSimplePlay() { 115 st.getChildren().addAll(child1X, child1Y); 116 117 st.play(); 118 assertEquals(Status.RUNNING, st.getStatus()); 119 assertEquals(Status.STOPPED, child1X.getStatus()); 120 assertEquals(Status.STOPPED, child1Y.getStatus()); 121 122 amt.pulse(); 123 assertEquals(TickCalculation.toDuration(100), st.getCurrentTime()); | 82 }; 83 childByX = createByXChild(); 84 childByX2 = createByXChild(); 85 } 86 87 private Transition createByXChild() { 88 return new TransitionShim() { 89 { 90 setCycleDuration(Duration.seconds(1)); 91 setInterpolator(Interpolator.LINEAR); 92 } 93 94 long lastX; 95 96 @Override 97 protected void interpolate(double frac) { 98 xProperty.set(Math.round(lastX + frac * 1000)); 99 } 100 101 @Override 102 public void sync(boolean forceSync) { 103 super.sync(forceSync); 104 if (forceSync) { 105 lastX = xProperty.get(); 106 } 107 } 108 109 110 }; 111 } 112 113 @Test 114 public void testSimplePlay() { 115 st.getChildren().addAll(child1X, child1Y); 116 117 st.play(); 118 assertEquals(Status.RUNNING, st.getStatus()); 119 assertEquals(Status.STOPPED, child1X.getStatus()); 120 assertEquals(Status.STOPPED, child1Y.getStatus()); 121 122 amt.pulse(); 123 assertEquals(TickCalculation.toDuration(100), st.getCurrentTime()); |