|
@@ -41,9 +41,13 @@ import org.testfx.api.FxRobot;
|
|
|
import org.testfx.api.FxToolkit;
|
|
|
import org.testfx.framework.junit5.ApplicationExtension;
|
|
|
import org.testfx.framework.junit5.Start;
|
|
|
+import org.testfx.util.WaitForAsyncUtils;
|
|
|
|
|
|
import java.util.Optional;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
+import java.util.concurrent.TimeUnit;
|
|
|
import java.util.concurrent.TimeoutException;
|
|
|
+import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.concurrent.atomic.AtomicReference;
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*;
|
|
@@ -186,7 +190,7 @@ public class IconsTests {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- void testWrap(FxRobot robot) throws InterruptedException {
|
|
|
+ void testWrap(FxRobot robot) throws InterruptedException, TimeoutException {
|
|
|
StackPane root = setupStage();
|
|
|
MFXIconWrapper wrapper = new MFXFontIcon(FontAwesomeSolid.CIRCLE.getDescription(), 64.0).wrap();
|
|
|
robot.interact(() -> root.getChildren().setAll(wrapper));
|
|
@@ -209,15 +213,19 @@ public class IconsTests {
|
|
|
));
|
|
|
Thread.sleep(sleep);
|
|
|
|
|
|
+ AtomicBoolean ripple = new AtomicBoolean(false);
|
|
|
robot.interact(() -> {
|
|
|
wrapper.getIcon().setDescription(FontAwesomeRegular.SQUARE.getDescription());
|
|
|
wrapper.setStyle("-mfx-enable-ripple: true;\n-mfx-round: true;\n");
|
|
|
});
|
|
|
wrapper.getRippleGenerator().setRippleRadius(128.0);
|
|
|
+ wrapper.getRippleGenerator().setOnAnimationFinished(e -> ripple.set(true));
|
|
|
assertNotNull(wrapper.getClip());
|
|
|
assertEquals(2, wrapper.getChildren().size());
|
|
|
robot.clickOn(wrapper);
|
|
|
+ WaitForAsyncUtils.waitFor(1, TimeUnit.SECONDS, CompletableFuture.supplyAsync(ripple::get));
|
|
|
Thread.sleep(sleep);
|
|
|
+ assertTrue(ripple.get());
|
|
|
|
|
|
robot.interact(() -> wrapper.setStyle(null));
|
|
|
assertNull(wrapper.getClip());
|