Skip to content

Commit

Permalink
Make tests run (on Windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
tbee committed Apr 21, 2021
1 parent 413f28c commit 320cc96
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 11 deletions.
25 changes: 21 additions & 4 deletions javafx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
<name>MiGLayout JavaFX</name>
<description>MiGLayout - Layout Manager for JavaFX</description>

<properties>
<skipTests>true</skipTests> <!-- TODO: this needs to be removed and the tests made running! -->
</properties>

<dependencyManagement>
<dependencies>
<dependency>
Expand Down Expand Up @@ -67,4 +63,25 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>7.2</version>
</dependency>
</dependencies>
<configuration>
<argLine>
--add-exports javafx.graphics/com.sun.javafx.application=ALL-UNNAMED,org.testfx
</argLine>
</configuration>
</plugin>
</plugins>
</build>
</project>
6 changes: 3 additions & 3 deletions javafx/src/test/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
exports org.tbee.javafx.scene.layout.fxml;

requires com.miglayout.core;
requires static javafx.base;
requires static javafx.graphics;
requires static javafx.controls;
requires javafx.base;
requires javafx.graphics;
requires javafx.controls;

requires junit;
requires javafx.fxml;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
import javafx.scene.text.Font;
import javafx.scene.text.TextAlignment;
import javafx.stage.Stage;
//import jfxtras.resources.JFXtrasFontRoboto;
import net.miginfocom.layout.AC;
import net.miginfocom.layout.CC;
import net.miginfocom.layout.LC;
import net.miginfocom.layout.PlatformDefaults;

import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.tbee.javafx.scene.layout.MigPane;

/**
* THESE TESTS ONLY RUN ON WINDOWS
* ===============================
*
* TestFX is able to layout a single node per class.
* Because we would be creating MigPane only once, this would result in one class with one test method per to-be-tested layout, and thus is a LOT of classes.
* By placing MigPane in a presized Pane, it is possible to test different layouts each in a separate method, all in a single class.
Expand All @@ -38,7 +38,7 @@ public class MigPaneInternalLayoutTest extends org.testfx.framework.junit.Applic

@Override
public void start(Stage stage) throws Exception {
// JFXtrasFontRoboto.loadAll();
javafx.scene.text.Font.loadFont(this.getClass().getResource("/" + "Roboto-Medium.ttf").toExternalForm(), 12);

this.stage = stage;
Scene scene = new Scene(getRootNode());
Expand Down
Binary file added javafx/src/test/resources/Roboto-Medium.ttf
Binary file not shown.

0 comments on commit 320cc96

Please sign in to comment.