-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft: java 11 support #63
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,8 @@ public JavaFXLibrary(boolean headless) { | |
if (headless) { | ||
System.setProperty("testfx.robot", "glass"); | ||
System.setProperty("testfx.headless", "true"); | ||
System.setProperty("glass.platform", "Monocle"); | ||
System.setProperty("monocle.platform", "Headless"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Relates to previous comment. Maybe these are not necessary? |
||
System.setProperty("prism.order", "sw"); | ||
System.setProperty("prism.text", "t2k"); | ||
TestFxAdapter.isHeadless = true; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,8 +17,8 @@ | |
|
||
package javafxlibrary.keywords.AdditionalKeywords; | ||
|
||
import com.sun.javafx.scene.control.skin.TableViewSkin; | ||
import com.sun.javafx.scene.control.skin.VirtualFlow; | ||
import javafx.scene.control.skin.TableViewSkin; | ||
import javafx.scene.control.skin.VirtualFlow; | ||
import javafx.collections.ObservableList; | ||
import javafx.css.PseudoClass; | ||
import javafx.geometry.BoundingBox; | ||
|
@@ -279,7 +279,7 @@ public String getNodeText(Object locator) { | |
@RobotKeyword("Returns image name and path of the node. \n\n" | ||
+ "``locator`` is either a _query_ or _Object_ for a node whose getHeight method will be called, see " | ||
+ "`3. Locating JavaFX Nodes`. \n\n" | ||
+ "Returns full image path by subsequently calling impl_getUrl -method. \n\n" | ||
+ "Returns full image path by subsequently calling getUrl -method. \n\n" | ||
+ "Note, impl_getUrl -method is deprecated! Support for this method will be removed from Java in the future.") | ||
@ArgumentNames({"node"}) | ||
public String getNodeImageUrl(Object locator) { | ||
|
@@ -294,8 +294,7 @@ public String getNodeImageUrl(Object locator) { | |
try { | ||
Object result = m.invoke(node, (Object) null); | ||
Image image = (Image) result; | ||
RobotLog.trace("Calling deprecated method impl_getUrl() for image: \"" + image + "\""); | ||
return image.impl_getUrl(); | ||
return image.getUrl(); | ||
} catch (Exception e) { | ||
throw new JavaFXLibraryNonFatalException("Problem calling method: .getImage(): " + e.getMessage(), e); | ||
} | ||
|
@@ -477,15 +476,22 @@ public List<Object> getTableColumnValues(Object locator, int column) { | |
public List<Object> getTableColumnCells(Object locator, int column) { | ||
checkObjectArgumentNotNull(locator); | ||
try { | ||
List<Object> columnCells = new ArrayList<>(); | ||
|
||
RobotLog.info("Getting table \"" + locator + "\" cells from column \"" + column + "\"."); | ||
TableView table = (TableView) objectToNode(locator); | ||
List<Object> columnCells = new ArrayList<>(); | ||
VirtualFlow<?> vf = (VirtualFlow<?>) ((TableViewSkin<?>) table.getSkin()).getChildren().get(1); | ||
|
||
for (int i = vf.getFirstVisibleCell().getIndex(); i < vf.getLastVisibleCell().getIndex() + 1; i++) { | ||
RobotLog.info("Index number: " + i); | ||
columnCells.add(mapObject(vf.getCell(i).getChildrenUnmodifiable().get(column))); | ||
} | ||
Optional<VirtualFlow> vf = table.getChildrenUnmodifiable().stream().filter(node -> node instanceof VirtualFlow).map(VirtualFlow.class::cast).findFirst(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed public API in JavaFX. |
||
|
||
vf.ifPresentOrElse(virtualFlow -> { | ||
for (int i = virtualFlow.getFirstVisibleCell().getIndex(); i < virtualFlow.getLastVisibleCell().getIndex() + 1; i++) { | ||
RobotLog.info("Index number: " + i); | ||
columnCells.add(mapObject(virtualFlow.getCell(i).getChildrenUnmodifiable().get(column))); | ||
} | ||
}, () -> { | ||
throw new JavaFXLibraryNonFatalException("Could not find VirtualFlow from Tableview!"); | ||
}); | ||
|
||
return mapObjects(columnCells); | ||
} catch (ClassCastException cce) { | ||
throw new JavaFXLibraryNonFatalException("Unable to handle argument as TableView!"); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ | |
import javafx.scene.input.MouseButton; | ||
import javafxlibrary.exceptions.JavaFXLibraryNonFatalException; | ||
import javafxlibrary.utils.HelperFunctions; | ||
|
||
import java.util.Arrays; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
|
@@ -50,7 +53,7 @@ public void getMouseButtons_MultipleValues() { | |
public void getMouseButtons_InvalidValue() { | ||
thrown.expect(JavaFXLibraryNonFatalException.class); | ||
// thrown.expect(IllegalArgumentException.class); | ||
thrown.expectMessage("\"HUGE_RED_ONE\" is not a valid MouseButton. Accepted values are: [NONE, PRIMARY, MIDDLE, SECONDARY]"); | ||
thrown.expectMessage("\"HUGE_RED_ONE\" is not a valid MouseButton. Accepted values are: " + Arrays.asList(MouseButton.values())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had a mouse with back and forward buttons. Test failed since message had BACK and FORWARD values. |
||
HelperFunctions.getMouseButtons(new String[]{"HUGE_RED_ONE"}); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jdk-11+26 version did not work. Had some missing methods. Upgrading resolved issues.