-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from aalmiray/fxml-updates
Fxml updates + TestFX
- Loading branch information
Showing
7 changed files
with
210 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
/.nb-gradle/ | ||
.nb-gradle/ | ||
.idea/ | ||
.gradle/ | ||
out/ | ||
build/ |
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
plugins { | ||
id "com.github.hierynomus.license" version "0.13.1" | ||
id 'com.github.hierynomus.license' version '0.13.1' | ||
id 'maven-publish' | ||
id "net.nemerosa.versioning" version "2.4.0" | ||
id 'com.jfrog.bintray' version '1.7.1' | ||
id 'net.nemerosa.versioning' version '2.4.0' | ||
id 'com.jfrog.bintray' version '1.7.2' | ||
id 'com.github.ben-manes.versions' version '0.13.0' | ||
} | ||
|
||
apply plugin: 'java' | ||
|
@@ -31,3 +32,12 @@ license { | |
ext.year = '2016-2016' | ||
ext.author = 'Michael Hoffer <[email protected]>' | ||
} | ||
|
||
repositories { | ||
jcenter() | ||
} | ||
|
||
dependencies { | ||
testCompile 'org.testfx:testfx-core:4.0.4-alpha' | ||
testCompile 'org.testfx:testfx-junit:4.0.4-alpha' | ||
} |
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 |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
*/ | ||
package eu.mihosoft.scaledfx; | ||
|
||
import javafx.beans.DefaultProperty; | ||
import javafx.beans.property.BooleanProperty; | ||
import javafx.beans.property.DoubleProperty; | ||
import javafx.beans.property.ObjectProperty; | ||
|
@@ -51,6 +52,7 @@ | |
* | ||
* @author Michael Hoffer <[email protected]> | ||
*/ | ||
@DefaultProperty("content") | ||
public class ScalableContentPane extends Region { | ||
|
||
private Scale contentScaleTransform; | ||
|
58 changes: 58 additions & 0 deletions
58
src/test/java/eu/mihosoft/scaledfx/ExplicitContentTest.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,58 @@ | ||
/* | ||
* Copyright 2016-2016 Michael Hoffer <[email protected]>. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are | ||
* permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this list of | ||
* conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
* of conditions and the following disclaimer in the documentation and/or other materials | ||
* provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY Michael Hoffer <[email protected]> "AS IS" AND ANY EXPRESS OR IMPLIED | ||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Michael Hoffer <[email protected]> OR | ||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* The views and conclusions contained in the software and documentation are those of the | ||
* authors and should not be interpreted as representing official policies, either expressed | ||
* or implied, of Michael Hoffer <[email protected]>. | ||
*/ | ||
package eu.mihosoft.scaledfx; | ||
|
||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Scene; | ||
import javafx.stage.Stage; | ||
import org.junit.Test; | ||
import org.testfx.framework.junit.ApplicationTest; | ||
|
||
import java.net.URL; | ||
|
||
import static org.testfx.api.FxAssert.verifyThat; | ||
import static org.testfx.matcher.base.NodeMatchers.hasChildren; | ||
|
||
/** | ||
* @author Andres Almiray | ||
*/ | ||
public class ExplicitContentTest extends ApplicationTest { | ||
@Override | ||
public void start(Stage stage) throws Exception { | ||
URL location = getClass().getClassLoader().getResource("eu/mihosoft/scaledfx/explicit_content.fxml"); | ||
FXMLLoader fxml = new FXMLLoader(location); | ||
stage.setScene(new Scene(fxml.load())); | ||
stage.sizeToScene(); | ||
stage.show(); | ||
} | ||
|
||
@Test | ||
public void contentIsSet() { | ||
verifyThat("#pane", hasChildren(1, "#button")); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
src/test/java/eu/mihosoft/scaledfx/ImplicitContentTest.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,58 @@ | ||
/* | ||
* Copyright 2016-2016 Michael Hoffer <[email protected]>. All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, are | ||
* permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, this list of | ||
* conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
* of conditions and the following disclaimer in the documentation and/or other materials | ||
* provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY Michael Hoffer <[email protected]> "AS IS" AND ANY EXPRESS OR IMPLIED | ||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Michael Hoffer <[email protected]> OR | ||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* The views and conclusions contained in the software and documentation are those of the | ||
* authors and should not be interpreted as representing official policies, either expressed | ||
* or implied, of Michael Hoffer <[email protected]>. | ||
*/ | ||
package eu.mihosoft.scaledfx; | ||
|
||
import javafx.fxml.FXMLLoader; | ||
import javafx.scene.Scene; | ||
import javafx.stage.Stage; | ||
import org.junit.Test; | ||
import org.testfx.framework.junit.ApplicationTest; | ||
|
||
import java.net.URL; | ||
|
||
import static org.testfx.api.FxAssert.verifyThat; | ||
import static org.testfx.matcher.base.NodeMatchers.hasChildren; | ||
|
||
/** | ||
* @author Andres Almiray | ||
*/ | ||
public class ImplicitContentTest extends ApplicationTest { | ||
@Override | ||
public void start(Stage stage) throws Exception { | ||
URL location = getClass().getClassLoader().getResource("eu/mihosoft/scaledfx/implicit_content.fxml"); | ||
FXMLLoader fxml = new FXMLLoader(location); | ||
stage.setScene(new Scene(fxml.load())); | ||
stage.sizeToScene(); | ||
stage.show(); | ||
} | ||
|
||
@Test | ||
public void contentIsSet() { | ||
verifyThat("#pane", hasChildren(1, "#button")); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
src/test/resources/eu/mihosoft/scaledfx/explicit_content.fxml
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,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 2016-2016 Michael Hoffer <[email protected]>. All rights reserved. | ||
Redistribution and use in source and binary forms, with or without modification, are | ||
permitted provided that the following conditions are met: | ||
1. Redistributions of source code must retain the above copyright notice, this list of | ||
conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
of conditions and the following disclaimer in the documentation and/or other materials | ||
provided with the distribution. | ||
THIS SOFTWARE IS PROVIDED BY Michael Hoffer <[email protected]> "AS IS" AND ANY EXPRESS OR IMPLIED | ||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Michael Hoffer <[email protected]> OR | ||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
The views and conclusions contained in the software and documentation are those of the | ||
authors and should not be interpreted as representing official policies, either expressed | ||
or implied, of Michael Hoffer <[email protected]>. | ||
--> | ||
|
||
<?import eu.mihosoft.scaledfx.ScalableContentPane?> | ||
<?import javafx.scene.control.Button?> | ||
<ScalableContentPane fx:id="pane" xmlns:fx="http://javafx.com/fxml" prefWidth="100" prefHeight="60"> | ||
<content> | ||
<Button fx:id="button" text="explicit"/> | ||
</content> | ||
</ScalableContentPane> |
36 changes: 36 additions & 0 deletions
36
src/test/resources/eu/mihosoft/scaledfx/implicit_content.fxml
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,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright 2016-2016 Michael Hoffer <[email protected]>. All rights reserved. | ||
Redistribution and use in source and binary forms, with or without modification, are | ||
permitted provided that the following conditions are met: | ||
1. Redistributions of source code must retain the above copyright notice, this list of | ||
conditions and the following disclaimer. | ||
2. Redistributions in binary form must reproduce the above copyright notice, this list | ||
of conditions and the following disclaimer in the documentation and/or other materials | ||
provided with the distribution. | ||
THIS SOFTWARE IS PROVIDED BY Michael Hoffer <[email protected]> "AS IS" AND ANY EXPRESS OR IMPLIED | ||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Michael Hoffer <[email protected]> OR | ||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | ||
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
The views and conclusions contained in the software and documentation are those of the | ||
authors and should not be interpreted as representing official policies, either expressed | ||
or implied, of Michael Hoffer <[email protected]>. | ||
--> | ||
|
||
<?import eu.mihosoft.scaledfx.ScalableContentPane?> | ||
<?import javafx.scene.control.Button?> | ||
<ScalableContentPane fx:id="pane" xmlns:fx="http://javafx.com/fxml" prefWidth="100" prefHeight="60"> | ||
<Button fx:id="button" text="implicit"/> | ||
</ScalableContentPane> |