modules/graphics/src/test/java/test/javafx/animation/FillTransitionTest.java

Print this page
rev 9250 : 8134762: Refactor Javafx graphics module tests for clear separation of tests
Reviewed-by:


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package javafx.animation;
  27 





  28 import static org.junit.Assert.assertEquals;
  29 import static org.junit.Assert.assertFalse;
  30 import static org.junit.Assert.assertNull;
  31 import static org.junit.Assert.assertTrue;
  32 import javafx.scene.Group;
  33 import javafx.scene.paint.Color;
  34 import javafx.scene.paint.LinearGradient;
  35 import javafx.scene.paint.Paint;
  36 import javafx.scene.paint.Stop;
  37 import javafx.scene.shape.Rectangle;
  38 import javafx.scene.shape.Shape;
  39 import javafx.util.Duration;
  40 
  41 import org.junit.Before;
  42 import org.junit.Test;
  43 
  44 public class FillTransitionTest {
  45         
  46         private static Duration DEFAULT_DURATION = Duration.millis(400);
  47         private static Interpolator DEFAULT_INTERPOLATOR = Interpolator.EASE_BOTH;


 104                 assertNull(t0.getShape());
 105                 assertEquals(DEFAULT_INTERPOLATOR, t0.getInterpolator());
 106                 assertNull(t0.getOnFinished());
 107                 
 108                 // duration, shape, and values
 109                 t0 = new FillTransition(TWO_SECS, shape, Color.BLACK, Color.WHITE);
 110                 assertEquals(TWO_SECS, t0.getDuration());
 111                 assertColorEquals(Color.BLACK, t0.getFromValue());
 112                 assertColorEquals(Color.WHITE, t0.getToValue());
 113                 assertEquals(shape, t0.getShape());
 114                 assertEquals(DEFAULT_INTERPOLATOR, t0.getInterpolator());
 115                 assertNull(t0.getOnFinished());
 116         }
 117 
 118         @Test
 119         public void testInterpolate() {
 120                 final Color fromValue = Color.color(0.2, 0.3, 0.7, 0.1);
 121                 final Color toValue = Color.color(0.8, 0.4, 0.2, 0.9);
 122                 final FillTransition t0 = new FillTransition(ONE_SEC, shape, fromValue, toValue);
 123                 
 124                 assertTrue(t0.impl_startable(false));
 125                 t0.impl_start(false);
 126                 t0.interpolate(0.0);
 127                 assertColorEquals(Color.color(0.2, 0.3, 0.7, 0.1), shape.getFill());
 128                 t0.interpolate(0.4);
 129                 assertColorEquals(Color.color(0.44, 0.34, 0.5, 0.42), shape.getFill());
 130                 t0.interpolate(1.0);
 131                 assertColorEquals(Color.color(0.8, 0.4, 0.2, 0.9), shape.getFill());
 132         t0.impl_finished();
 133         }
 134         
 135         @Test
 136         public void testValueCombinations() {
 137                 final FillTransition t0 = new FillTransition(ONE_SEC, shape, null, Color.WHITE);
 138                 final double original = 0.6;
 139                 final double from = 0.4;
 140                 final Color originalValue = Color.color(original, original, original);
 141                 final Color fromValue = Color.color(from, from, from);
 142                 
 143                 // no from value set
 144                 shape.setFill(originalValue);
 145                 t0.setFromValue(null);
 146                 assertTrue(t0.impl_startable(false));
 147                 t0.impl_start(false);
 148                 t0.interpolate(0.0);
 149                 assertColorEquals(originalValue, shape.getFill());
 150                 t0.impl_finished();
 151                 
 152                 // from-value set
 153                 shape.setFill(originalValue);
 154                 t0.setFromValue(fromValue);
 155                 assertTrue(t0.impl_startable(true));
 156                 t0.impl_start(true);
 157                 t0.interpolate(0.0);
 158                 assertColorEquals(fromValue, shape.getFill());
 159                 t0.impl_finished();
 160         }
 161         
 162     @Test
 163     public void testGetTargetNode() {
 164         final Color fromValue = Color.color(0.0, 0.4, 0.8, 1.0);
 165                 final Color toValue = Color.color(1.0, 0.8, 0.6, 0.4);
 166         final FillTransition ft = new FillTransition(ONE_SEC, shape, fromValue, toValue);
 167         ft.setInterpolator(Interpolator.LINEAR);
 168         final Shape shape2 = new Rectangle();
 169         final ParallelTransition pt = new ParallelTransition();
 170         pt.getChildren().add(ft);
 171         pt.setNode(shape2);
 172         shape.setFill(Color.WHITE);
 173         shape2.setFill(Color.WHITE);
 174 
 175         // node set, parent set
 176         assertTrue(ft.impl_startable(false));
 177         ft.impl_start(false);
 178         ft.interpolate(0.5);
 179         assertColorEquals(Color.color(0.5, 0.6, 0.7, 0.7), shape.getFill());
 180         assertColorEquals(Color.WHITE, shape2.getFill());
 181         ft.impl_finished();
 182 
 183         // node null, parent set
 184         ft.setShape(null);
 185         assertTrue(ft.impl_startable(true));
 186         ft.impl_start(true);
 187         ft.interpolate(0.4);
 188         assertColorEquals(Color.color(0.5, 0.6, 0.7, 0.7), shape.getFill());
 189         assertColorEquals(Color.color(0.4, 0.56, 0.72, 0.76), shape2.getFill());
 190         ft.impl_finished();
 191         
 192         // node null, parent not shape set
 193         pt.setNode(new Group());
 194         assertFalse(ft.impl_startable(true));
 195 
 196         // node null, parent null
 197         pt.setNode(null);
 198         assertFalse(ft.impl_startable(true));
 199     }
 200 
 201     @Test
 202     public void testCachedValues() {
 203         final Color fromValue = Color.color(0.0, 0.4, 0.8, 0.2);
 204         final Color toValue = Color.color(1.0, 0.8, 0.6, 0.4);
 205         final FillTransition ft = new FillTransition(ONE_SEC, shape, fromValue, toValue);
 206         ft.setInterpolator(Interpolator.LINEAR);
 207 
 208         // start
 209         assertTrue(ft.impl_startable(false));
 210         ft.impl_start(false);
 211         ft.setFromValue(Color.WHITE);
 212         ft.interpolate(0.5);
 213         assertColorEquals(Color.color(0.5, 0.6, 0.7, 0.3), shape.getFill());
 214         ft.impl_finished();
 215                 ft.setFromValue(fromValue);
 216 
 217         // end
 218         assertTrue(ft.impl_startable(true));
 219         ft.impl_start(true);
 220         ft.setToValue(Color.BLACK);
 221         ft.interpolate(0.2);
 222         assertColorEquals(Color.color(0.2, 0.48, 0.76, 0.24), shape.getFill());
 223         ft.impl_finished();
 224         ft.setToValue(toValue);
 225 
 226         // shape
 227         assertTrue(ft.impl_startable(true));
 228         ft.impl_start(true);
 229         ft.setShape(null);
 230         ft.interpolate(0.7);
 231         assertColorEquals(Color.color(0.7, 0.68, 0.66, 0.34), shape.getFill());
 232         ft.impl_finished();
 233         ft.setShape(shape);
 234 
 235         // interpolator
 236         assertTrue(ft.impl_startable(true));
 237         ft.impl_start(true);
 238         ft.setInterpolator(null);
 239         ft.interpolate(0.1);
 240         assertColorEquals(Color.color(0.1, 0.44, 0.78, 0.22), shape.getFill());
 241         ft.impl_finished();
 242         ft.setInterpolator(Interpolator.LINEAR);
 243     }
 244 
 245         @Test
 246         public void testStartable_unsynchronized() {
 247                 final FillTransition t0 = new FillTransition(Duration.ONE, shape, Color.WHITE, Color.BLACK);
 248                 final Paint paint2 = new LinearGradient(0, 0, 1, 1, false, null,
 249                 new Stop[] { new Stop(0, Color.RED) });
 250                 assertTrue(t0.impl_startable(true));
 251                 
 252                 // duration is 0
 253                 t0.setDuration(Duration.ZERO);
 254                 assertFalse(t0.impl_startable(true));
 255                 t0.setDuration(Duration.ONE);
 256                 assertTrue(t0.impl_startable(true));
 257                 
 258                 // interpolator is null
 259                 t0.setInterpolator(null);
 260                 assertFalse(t0.impl_startable(true));
 261                 t0.setInterpolator(Interpolator.LINEAR);
 262                 assertTrue(t0.impl_startable(true));
 263                 
 264                 // shape is null
 265                 t0.setShape(null);
 266                 assertFalse(t0.impl_startable(false));
 267                 assertFalse(t0.impl_startable(true));
 268                 t0.setShape(shape);
 269                 assertTrue(t0.impl_startable(false));
 270                 assertTrue(t0.impl_startable(true));
 271                 
 272                 // fromValue
 273                 t0.setFromValue(null);
 274                 shape.setFill(paint2);
 275                 assertFalse(t0.impl_startable(false));
 276                 assertFalse(t0.impl_startable(true));
 277                 shape.setFill(Color.BLACK);
 278                 assertTrue(t0.impl_startable(false));
 279                 assertTrue(t0.impl_startable(true));
 280                 t0.setFromValue(Color.WHITE);
 281                 shape.setFill(paint2);
 282                 assertTrue(t0.impl_startable(false));
 283                 assertTrue(t0.impl_startable(true));
 284                 
 285                 // toValue
 286                 t0.setToValue(null);
 287                 assertFalse(t0.impl_startable(false));
 288                 assertFalse(t0.impl_startable(true));
 289                 t0.setToValue(Color.BLACK);
 290                 assertTrue(t0.impl_startable(false));
 291                 assertTrue(t0.impl_startable(true));
 292         }
 293 
 294         @Test
 295         public void testStartable_synchronized() {
 296                 final FillTransition t0 = new FillTransition(Duration.ONE, shape, Color.WHITE, Color.BLACK);
 297                 final Paint paint2 = new LinearGradient(0, 0, 1, 1, false, null,
 298                 new Stop[] { new Stop(0, Color.RED) });
 299                 assertTrue(t0.impl_startable(true));
 300                 t0.impl_start(true);
 301                 t0.impl_finished();
 302                 
 303                 // shape is null
 304                 t0.setShape(null);
 305                 assertTrue(t0.impl_startable(false));
 306                 assertFalse(t0.impl_startable(true));
 307                 t0.setShape(shape);
 308                 assertTrue(t0.impl_startable(false));
 309                 assertTrue(t0.impl_startable(true));
 310                 
 311                 // fromValue
 312                 t0.setFromValue(null);
 313                 shape.setFill(paint2);
 314                 assertTrue(t0.impl_startable(false));
 315                 assertFalse(t0.impl_startable(true));
 316                 shape.setFill(Color.BLACK);
 317                 assertTrue(t0.impl_startable(false));
 318                 assertTrue(t0.impl_startable(true));
 319                 t0.setFromValue(Color.WHITE);
 320                 shape.setFill(paint2);
 321                 assertTrue(t0.impl_startable(false));
 322                 assertTrue(t0.impl_startable(true));
 323                 
 324                 // toValue
 325                 t0.setToValue(null);
 326                 assertTrue(t0.impl_startable(false));
 327                 assertFalse(t0.impl_startable(true));
 328                 t0.setToValue(Color.BLACK);
 329                 assertTrue(t0.impl_startable(false));
 330                 assertTrue(t0.impl_startable(true));
 331         }
 332 
 333         @Test
 334         public void testEvaluateStartValue() {
 335                 final FillTransition t0 = new FillTransition(Duration.INDEFINITE, shape, null, Color.WHITE);
 336                 
 337                 // first run
 338                 shape.setFill(Color.GREY);
 339                 assertTrue(t0.impl_startable(false));
 340                 t0.impl_start(false);
 341                 shape.setFill(Color.TRANSPARENT);
 342                 t0.interpolate(0.0);
 343                 assertColorEquals(Color.GREY, shape.getFill());
 344                 t0.impl_finished();
 345                 
 346                 // second run
 347                 shape.setFill(Color.BLACK);
 348                 assertTrue(t0.impl_startable(true));
 349                 t0.impl_start(true);
 350                 shape.setFill(Color.WHITE);
 351                 t0.interpolate(0.0);
 352                 assertColorEquals(Color.BLACK, shape.getFill());
 353                 t0.impl_finished();
 354         }
 355 
 356 }


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package test.javafx.animation;
  27 
  28 import javafx.animation.AnimationShim;
  29 import javafx.animation.FillTransition;
  30 import javafx.animation.Interpolator;
  31 import javafx.animation.ParallelTransition;
  32 import javafx.animation.TransitionShim;
  33 import static org.junit.Assert.assertEquals;
  34 import static org.junit.Assert.assertFalse;
  35 import static org.junit.Assert.assertNull;
  36 import static org.junit.Assert.assertTrue;
  37 import javafx.scene.Group;
  38 import javafx.scene.paint.Color;
  39 import javafx.scene.paint.LinearGradient;
  40 import javafx.scene.paint.Paint;
  41 import javafx.scene.paint.Stop;
  42 import javafx.scene.shape.Rectangle;
  43 import javafx.scene.shape.Shape;
  44 import javafx.util.Duration;
  45 
  46 import org.junit.Before;
  47 import org.junit.Test;
  48 
  49 public class FillTransitionTest {
  50         
  51         private static Duration DEFAULT_DURATION = Duration.millis(400);
  52         private static Interpolator DEFAULT_INTERPOLATOR = Interpolator.EASE_BOTH;


 109                 assertNull(t0.getShape());
 110                 assertEquals(DEFAULT_INTERPOLATOR, t0.getInterpolator());
 111                 assertNull(t0.getOnFinished());
 112                 
 113                 // duration, shape, and values
 114                 t0 = new FillTransition(TWO_SECS, shape, Color.BLACK, Color.WHITE);
 115                 assertEquals(TWO_SECS, t0.getDuration());
 116                 assertColorEquals(Color.BLACK, t0.getFromValue());
 117                 assertColorEquals(Color.WHITE, t0.getToValue());
 118                 assertEquals(shape, t0.getShape());
 119                 assertEquals(DEFAULT_INTERPOLATOR, t0.getInterpolator());
 120                 assertNull(t0.getOnFinished());
 121         }
 122 
 123         @Test
 124         public void testInterpolate() {
 125                 final Color fromValue = Color.color(0.2, 0.3, 0.7, 0.1);
 126                 final Color toValue = Color.color(0.8, 0.4, 0.2, 0.9);
 127                 final FillTransition t0 = new FillTransition(ONE_SEC, shape, fromValue, toValue);
 128                 
 129                 assertTrue(AnimationShim.impl_startable(t0,false));
 130                 AnimationShim.impl_start(t0,false);
 131                 TransitionShim.interpolate(t0,0.0);
 132                 assertColorEquals(Color.color(0.2, 0.3, 0.7, 0.1), shape.getFill());
 133                 TransitionShim.interpolate(t0,0.4);
 134                 assertColorEquals(Color.color(0.44, 0.34, 0.5, 0.42), shape.getFill());
 135                 TransitionShim.interpolate(t0,1.0);
 136                 assertColorEquals(Color.color(0.8, 0.4, 0.2, 0.9), shape.getFill());
 137         AnimationShim.impl_finished(t0);
 138         }
 139         
 140         @Test
 141         public void testValueCombinations() {
 142                 final FillTransition t0 = new FillTransition(ONE_SEC, shape, null, Color.WHITE);
 143                 final double original = 0.6;
 144                 final double from = 0.4;
 145                 final Color originalValue = Color.color(original, original, original);
 146                 final Color fromValue = Color.color(from, from, from);
 147                 
 148                 // no from value set
 149                 shape.setFill(originalValue);
 150                 t0.setFromValue(null);
 151                 assertTrue(AnimationShim.impl_startable(t0,false));
 152                 AnimationShim.impl_start(t0,false);
 153                 TransitionShim.interpolate(t0,0.0);
 154                 assertColorEquals(originalValue, shape.getFill());
 155                 AnimationShim.impl_finished(t0);
 156                 
 157                 // from-value set
 158                 shape.setFill(originalValue);
 159                 t0.setFromValue(fromValue);
 160                 assertTrue(AnimationShim.impl_startable(t0,true));
 161                 AnimationShim.impl_start(t0,true);
 162                 TransitionShim.interpolate(t0,0.0);
 163                 assertColorEquals(fromValue, shape.getFill());
 164                 AnimationShim.impl_finished(t0);
 165         }
 166         
 167     @Test
 168     public void testGetTargetNode() {
 169         final Color fromValue = Color.color(0.0, 0.4, 0.8, 1.0);
 170                 final Color toValue = Color.color(1.0, 0.8, 0.6, 0.4);
 171         final FillTransition ft = new FillTransition(ONE_SEC, shape, fromValue, toValue);
 172         ft.setInterpolator(Interpolator.LINEAR);
 173         final Shape shape2 = new Rectangle();
 174         final ParallelTransition pt = new ParallelTransition();
 175         pt.getChildren().add(ft);
 176         pt.setNode(shape2);
 177         shape.setFill(Color.WHITE);
 178         shape2.setFill(Color.WHITE);
 179 
 180         // node set, parent set
 181         assertTrue(AnimationShim.impl_startable(ft,false));
 182         AnimationShim.impl_start(ft,false);
 183         TransitionShim.interpolate(ft,0.5);
 184         assertColorEquals(Color.color(0.5, 0.6, 0.7, 0.7), shape.getFill());
 185         assertColorEquals(Color.WHITE, shape2.getFill());
 186         AnimationShim.impl_finished(ft);
 187 
 188         // node null, parent set
 189         ft.setShape(null);
 190         assertTrue(AnimationShim.impl_startable(ft,true));
 191         AnimationShim.impl_start(ft,true);
 192         TransitionShim.interpolate(ft,0.4);
 193         assertColorEquals(Color.color(0.5, 0.6, 0.7, 0.7), shape.getFill());
 194         assertColorEquals(Color.color(0.4, 0.56, 0.72, 0.76), shape2.getFill());
 195         AnimationShim.impl_finished(ft);
 196         
 197         // node null, parent not shape set
 198         pt.setNode(new Group());
 199         assertFalse(AnimationShim.impl_startable(ft,true));
 200 
 201         // node null, parent null
 202         pt.setNode(null);
 203         assertFalse(AnimationShim.impl_startable(ft,true));
 204     }
 205 
 206     @Test
 207     public void testCachedValues() {
 208         final Color fromValue = Color.color(0.0, 0.4, 0.8, 0.2);
 209         final Color toValue = Color.color(1.0, 0.8, 0.6, 0.4);
 210         final FillTransition ft = new FillTransition(ONE_SEC, shape, fromValue, toValue);
 211         ft.setInterpolator(Interpolator.LINEAR);
 212 
 213         // start
 214         assertTrue(AnimationShim.impl_startable(ft,false));
 215         AnimationShim.impl_start(ft,false);
 216         ft.setFromValue(Color.WHITE);
 217         TransitionShim.interpolate(ft,0.5);
 218         assertColorEquals(Color.color(0.5, 0.6, 0.7, 0.3), shape.getFill());
 219         AnimationShim.impl_finished(ft);
 220                 ft.setFromValue(fromValue);
 221 
 222         // end
 223         assertTrue(AnimationShim.impl_startable(ft,true));
 224         AnimationShim.impl_start(ft,true);
 225         ft.setToValue(Color.BLACK);
 226         TransitionShim.interpolate(ft,0.2);
 227         assertColorEquals(Color.color(0.2, 0.48, 0.76, 0.24), shape.getFill());
 228         AnimationShim.impl_finished(ft);
 229         ft.setToValue(toValue);
 230 
 231         // shape
 232         assertTrue(AnimationShim.impl_startable(ft,true));
 233         AnimationShim.impl_start(ft,true);
 234         ft.setShape(null);
 235         TransitionShim.interpolate(ft,0.7);
 236         assertColorEquals(Color.color(0.7, 0.68, 0.66, 0.34), shape.getFill());
 237         AnimationShim.impl_finished(ft);
 238         ft.setShape(shape);
 239 
 240         // interpolator
 241         assertTrue(AnimationShim.impl_startable(ft,true));
 242         AnimationShim.impl_start(ft,true);
 243         ft.setInterpolator(null);
 244         TransitionShim.interpolate(ft,0.1);
 245         assertColorEquals(Color.color(0.1, 0.44, 0.78, 0.22), shape.getFill());
 246         AnimationShim.impl_finished(ft);
 247         ft.setInterpolator(Interpolator.LINEAR);
 248     }
 249 
 250         @Test
 251         public void testStartable_unsynchronized() {
 252                 final FillTransition t0 = new FillTransition(Duration.ONE, shape, Color.WHITE, Color.BLACK);
 253                 final Paint paint2 = new LinearGradient(0, 0, 1, 1, false, null,
 254                 new Stop[] { new Stop(0, Color.RED) });
 255                 assertTrue(AnimationShim.impl_startable(t0,true));
 256                 
 257                 // duration is 0
 258                 t0.setDuration(Duration.ZERO);
 259                 assertFalse(AnimationShim.impl_startable(t0,true));
 260                 t0.setDuration(Duration.ONE);
 261                 assertTrue(AnimationShim.impl_startable(t0,true));
 262                 
 263                 // interpolator is null
 264                 t0.setInterpolator(null);
 265                 assertFalse(AnimationShim.impl_startable(t0,true));
 266                 t0.setInterpolator(Interpolator.LINEAR);
 267                 assertTrue(AnimationShim.impl_startable(t0,true));
 268                 
 269                 // shape is null
 270                 t0.setShape(null);
 271                 assertFalse(AnimationShim.impl_startable(t0,false));
 272                 assertFalse(AnimationShim.impl_startable(t0,true));
 273                 t0.setShape(shape);
 274                 assertTrue(AnimationShim.impl_startable(t0,false));
 275                 assertTrue(AnimationShim.impl_startable(t0,true));
 276                 
 277                 // fromValue
 278                 t0.setFromValue(null);
 279                 shape.setFill(paint2);
 280                 assertFalse(AnimationShim.impl_startable(t0,false));
 281                 assertFalse(AnimationShim.impl_startable(t0,true));
 282                 shape.setFill(Color.BLACK);
 283                 assertTrue(AnimationShim.impl_startable(t0,false));
 284                 assertTrue(AnimationShim.impl_startable(t0,true));
 285                 t0.setFromValue(Color.WHITE);
 286                 shape.setFill(paint2);
 287                 assertTrue(AnimationShim.impl_startable(t0,false));
 288                 assertTrue(AnimationShim.impl_startable(t0,true));
 289                 
 290                 // toValue
 291                 t0.setToValue(null);
 292                 assertFalse(AnimationShim.impl_startable(t0,false));
 293                 assertFalse(AnimationShim.impl_startable(t0,true));
 294                 t0.setToValue(Color.BLACK);
 295                 assertTrue(AnimationShim.impl_startable(t0,false));
 296                 assertTrue(AnimationShim.impl_startable(t0,true));
 297         }
 298 
 299         @Test
 300         public void testStartable_synchronized() {
 301                 final FillTransition t0 = new FillTransition(Duration.ONE, shape, Color.WHITE, Color.BLACK);
 302                 final Paint paint2 = new LinearGradient(0, 0, 1, 1, false, null,
 303                 new Stop[] { new Stop(0, Color.RED) });
 304                 assertTrue(AnimationShim.impl_startable(t0,true));
 305                 AnimationShim.impl_start(t0,true);
 306                 AnimationShim.impl_finished(t0);
 307                 
 308                 // shape is null
 309                 t0.setShape(null);
 310                 assertTrue(AnimationShim.impl_startable(t0,false));
 311                 assertFalse(AnimationShim.impl_startable(t0,true));
 312                 t0.setShape(shape);
 313                 assertTrue(AnimationShim.impl_startable(t0,false));
 314                 assertTrue(AnimationShim.impl_startable(t0,true));
 315                 
 316                 // fromValue
 317                 t0.setFromValue(null);
 318                 shape.setFill(paint2);
 319                 assertTrue(AnimationShim.impl_startable(t0,false));
 320                 assertFalse(AnimationShim.impl_startable(t0,true));
 321                 shape.setFill(Color.BLACK);
 322                 assertTrue(AnimationShim.impl_startable(t0,false));
 323                 assertTrue(AnimationShim.impl_startable(t0,true));
 324                 t0.setFromValue(Color.WHITE);
 325                 shape.setFill(paint2);
 326                 assertTrue(AnimationShim.impl_startable(t0,false));
 327                 assertTrue(AnimationShim.impl_startable(t0,true));
 328                 
 329                 // toValue
 330                 t0.setToValue(null);
 331                 assertTrue(AnimationShim.impl_startable(t0,false));
 332                 assertFalse(AnimationShim.impl_startable(t0,true));
 333                 t0.setToValue(Color.BLACK);
 334                 assertTrue(AnimationShim.impl_startable(t0,false));
 335                 assertTrue(AnimationShim.impl_startable(t0,true));
 336         }
 337 
 338         @Test
 339         public void testEvaluateStartValue() {
 340                 final FillTransition t0 = new FillTransition(Duration.INDEFINITE, shape, null, Color.WHITE);
 341                 
 342                 // first run
 343                 shape.setFill(Color.GREY);
 344                 assertTrue(AnimationShim.impl_startable(t0,false));
 345                 AnimationShim.impl_start(t0,false);
 346                 shape.setFill(Color.TRANSPARENT);
 347                 TransitionShim.interpolate(t0,0.0);
 348                 assertColorEquals(Color.GREY, shape.getFill());
 349                 AnimationShim.impl_finished(t0);
 350                 
 351                 // second run
 352                 shape.setFill(Color.BLACK);
 353                 assertTrue(AnimationShim.impl_startable(t0,true));
 354                 AnimationShim.impl_start(t0,true);
 355                 shape.setFill(Color.WHITE);
 356                 TransitionShim.interpolate(t0,0.0);
 357                 assertColorEquals(Color.BLACK, shape.getFill());
 358                 AnimationShim.impl_finished(t0);
 359         }
 360 
 361 }