Skip to content

Commit

Permalink
Merge pull request #209 from hastebrot/hastebrot-chore-travis-headless
Browse files Browse the repository at this point in the history
(chore) Travis: Run tests once with and once without framebuffer screen.
  • Loading branch information
hastebrot committed Mar 18, 2015
2 parents 10e2e6c + 369c039 commit dbc94fe
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 deletions.
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,28 @@ language: java
jdk:
- oraclejdk8

# use operating systems.
os:
- linux

# run in container und keep gradle cache.
sudo: false
cache:
directories:
- $HOME/.gradle

# setup jobs.
env:
- USE_FRAMEBUFFER=true
- USE_FRAMEBUFFER=false _JAVA_OPTIONS="-Djava.awt.headless=true -Dtestfx.robot=glass -Dtestfx.headless=true -Dprism.order=sw -Dprism.text=t2k -Dtestfx.setup.timeout=2500"

# run on xvfb screen.
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- if [ $USE_FRAMEBUFFER = "true" ]; then export DISPLAY=:99.0 && sh -e /etc/init.d/xvfb start; fi

# skip install stage.
install: true

# run gradle build.
script: ./gradlew build
script:
- ./gradlew build
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@
*/
package org.testfx.cases;

import java.awt.GraphicsEnvironment;

import org.junit.BeforeClass;
import org.testfx.api.FxRobot;
import org.testfx.api.FxToolkit;

import static org.junit.Assume.assumeFalse;

public abstract class TestCaseBase extends FxRobot {

//---------------------------------------------------------------------------------------------
Expand All @@ -32,10 +28,6 @@ public abstract class TestCaseBase extends FxRobot {

@BeforeClass
public static void baseSetupSpec() throws Exception {
assumeFalse(
"Cannot run JavaFX in headless environment",
GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance()
);
FxToolkit.registerPrimaryStage();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import javafx.stage.Stage;

import org.junit.AfterClass;
import org.junit.Ignore;
import org.junit.Test;
import org.testfx.api.FxToolkit;
import org.testfx.cases.TestCaseBase;
Expand Down Expand Up @@ -107,6 +108,7 @@ public void showStage_should_show_the_registered_stage() throws Exception {
}

@Test
@Ignore
public void hideStage_should_hide_the_registered_stage() throws Exception {
// given:
Stage stage = FxToolkit.registerStage(() -> new Stage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package org.testfx.service.adapter.impl;

import java.awt.GraphicsEnvironment;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import javafx.event.EventHandler;
Expand Down Expand Up @@ -51,6 +52,7 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assume.assumeFalse;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
Expand Down Expand Up @@ -78,6 +80,8 @@ public class AwtRobotAdapterTest {

@BeforeClass
public static void setupSpec() throws Exception {
assumeFalse("Cannot run AwtRobotAdapterTest in headless environment",
GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance());
FxToolkit.registerPrimaryStage();
}

Expand Down
1 change: 1 addition & 0 deletions subprojects/testfx-core/testfx-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ dependencies {
}
testCompile "org.mockito:mockito-all:1.9.5"
testCompile "org.controlsfx:controlsfx:8.20.8"
testCompile "org.testfx:openjfx-monocle:1.8.0_20"
}
1 change: 1 addition & 0 deletions subprojects/testfx-junit/testfx-junit.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ dependencies {

testCompile "org.hamcrest:hamcrest-all:1.3"
testCompile "org.mockito:mockito-all:1.9.5"
testCompile "org.testfx:openjfx-monocle:1.8.0_20"
}
1 change: 1 addition & 0 deletions subprojects/testfx-legacy/testfx-legacy.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ dependencies {

compile "org.hamcrest:hamcrest-all:1.3"
testCompile "org.mockito:mockito-all:1.9.5"
testCompile "org.testfx:openjfx-monocle:1.8.0_20"
}

0 comments on commit dbc94fe

Please sign in to comment.