-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start using Monocle for JavaFX/TestFX unit testing and enable `headle…
…ss` mode for the CI (#47) * Use TestFX with Monocle for JavaFX unit testing and enable `headless` mode for the CI * TestFreezeDetector now uses TestFX API to run unit tests * Skip MediaRecorder tests on the CI * Change assertion when we seek by clicking on the seek slider MediaPlayerTests * Set up Virtual Display (for Linux) * Set up Virtual Display (for Linux), new config * Move Virtual Display config (for Linux) to `Test` step * Remove `software` rendering option from `headless` mode * Try Monocle version `21.0.2-jpms` * Install `GStreamer and Plugins` (for Linux) and setup a Virtual Audio Device (for Linux) * Revert Monocle version to `17.0.10-jpms` * Install Media Features for Windows only and force JavaFX to use WMF backend * List Windows Optional Features * Enable `ServerMediaFoundation` Windows Feature * Exclude `media-recorder` tests when running on CI * Fix exclusion of `media-recorder` unit tests when running on CI * Remove Windows Optional Features listing on the CI * Move `media-recorder` junit tag on the class * Set GStreamer as JavaFX Media backend for Windows on the CI * Revert at using WMF as JavaFX Media backend for Windows on the CI
- Loading branch information
Showing
13 changed files
with
183 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
dependencies { | ||
api "org.slf4j:slf4j-api:$SLF4J_API_VERSION" | ||
|
||
testImplementation "one.jpro.platform.jpms:testfx-junit5:$TESTFX_VERSION" | ||
testImplementation "one.jpro.platform.jpms:testfx-core:$TESTFX_VERSION" | ||
testImplementation "one.jpro.platform.jpms:openjfx-monocle:$MONOCLE_VERSION" | ||
} | ||
|
||
test { | ||
jvmArgs = [ | ||
"-Dtestfx.headless=true", "-Djava.awt.headless=true", | ||
"--add-opens", "javafx.graphics/com.sun.glass.ui=org.testfx.core", | ||
"--add-opens", "javafx.graphics/com.sun.javafx.application=org.testfx.core", | ||
"--add-exports", "javafx.graphics/com.sun.javafx.application=org.testfx.core", | ||
"--add-exports", "javafx.graphics/com.sun.glass.ui=org.testfx.monocle", | ||
"--add-exports", "javafx.graphics/com.sun.javafx.util=org.testfx.monocle", | ||
"--add-exports", "javafx.base/com.sun.javafx.logging=org.testfx.monocle" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Module descriptor for the JPro Platform Freeze Detector Test module. | ||
* | ||
* @author Besmir Beqiri | ||
*/ | ||
module one.jpro.platform.freezedetector.test { | ||
requires one.jpro.platform.freezedetector; | ||
requires org.slf4j; | ||
|
||
requires org.junit.jupiter; | ||
requires org.testfx.core; | ||
requires org.testfx.junit5; | ||
requires org.assertj.core; | ||
|
||
opens one.jpro.platform.freezedetector.test; | ||
} |
78 changes: 0 additions & 78 deletions
78
freeze-detector/src/test/java/one/jpro/platform/TestFreezeDetector.java
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
freeze-detector/src/test/java/one/jpro/platform/freezedetector/test/TestFreezeDetector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package one.jpro.platform.freezedetector.test; | ||
|
||
import one.jpro.platform.freezedetector.FreezeDetector; | ||
import org.junit.jupiter.api.Test; | ||
import org.testfx.framework.junit5.ApplicationTest; | ||
|
||
import java.time.Duration; | ||
import java.util.concurrent.atomic.AtomicInteger; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* Tests the freeze detector. | ||
* | ||
* @author Besmir Beqiri | ||
*/ | ||
public class TestFreezeDetector extends ApplicationTest { | ||
|
||
@Test | ||
public void testFreezeDetector() throws InterruptedException { | ||
AtomicInteger counter = new AtomicInteger(0); | ||
interact(() -> new FreezeDetector(Duration.ofMillis(100), | ||
(thread, duration) -> counter.incrementAndGet())); | ||
|
||
assertThat(counter.get()).isEqualTo(0); | ||
Thread.sleep(200); | ||
assertThat(counter.get()).isEqualTo(0); | ||
interact(() -> { | ||
try { | ||
Thread.sleep(150); | ||
} catch (InterruptedException ex) { | ||
ex.printStackTrace(); | ||
} | ||
}); | ||
assertThat(counter.get()).isEqualTo(1); | ||
Thread.sleep(200); | ||
assertThat(counter.get()).isEqualTo(1); | ||
interact(() -> { | ||
try { | ||
Thread.sleep(150); | ||
} catch (InterruptedException ex) { | ||
ex.printStackTrace(); | ||
} | ||
}); | ||
assertThat(counter.get()).isEqualTo(2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* Module descriptor for the JPro Platform Media Test module. | ||
* | ||
* @author Besmir Beqiri | ||
*/ | ||
open module one.jpro.platform.media.test { | ||
requires one.jpro.platform.media; | ||
requires org.slf4j; | ||
|
||
requires org.junit.jupiter; | ||
requires org.testfx.core; | ||
requires org.testfx.junit5; | ||
requires org.assertj.core; | ||
|
||
exports one.jpro.platform.media.test; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.