Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/javadoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ '16', '17' ]
os: [ ubuntu-20.04 ]
java: [ '17' ]
os: [ ubuntu-22.04 ]

steps:
- uses: actions/checkout@v2
Expand All @@ -41,7 +41,6 @@ jobs:
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
cache: maven

- name: Build
run: mvn -q install -DskipTests
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
matrix:
java: [ '8', '11', '17', '21' ]
os: [ ubuntu-20.04 ]
os: [ ubuntu-22.04 ]

steps:
- uses: actions/checkout@v2
Expand All @@ -41,7 +41,6 @@ jobs:
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
cache: maven

- name: Build with Maven
run: mvn -q install -DskipTests
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
java: [ '8', '11', '17', '21' ]
os: [ macos-13 ]
java: [ '11', '17' ]
os: [ macos-14 ]

steps:
- uses: actions/checkout@v2
Expand All @@ -41,7 +41,6 @@ jobs:
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
cache: maven

- name: Build with Maven
run: mvn -q install -DskipTests
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
matrix:
java: [ '8', '11', '17', '21' ]
os: [ windows-2019 ]
os: [ windows-2022 ]

steps:
- uses: actions/checkout@v2
Expand All @@ -41,7 +41,6 @@ jobs:
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
cache: maven

- name: Build with Maven
run: mvn -q install -DskipTests
Expand Down
22 changes: 20 additions & 2 deletions boot-fx/src/test/java/org/netbeans/html/boot/fx/KOFx.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@
import java.lang.reflect.Method;
import java.util.Timer;
import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Platform;
import javafx.stage.Stage;
import org.netbeans.html.boot.spi.Fn;
import static org.testng.Assert.fail;
import org.testng.IHookCallBack;
import org.testng.IHookable;
import org.testng.ITest;
Expand All @@ -36,7 +40,7 @@
*/
public final class KOFx implements ITest, IHookable, Runnable {
private static final Timer SCHEDULER = new Timer("Fx Scheduler");

private final Fn.Presenter p;
private final Method m;
private Object result;
Expand Down Expand Up @@ -99,7 +103,7 @@ public synchronized void run() {
public void run(IHookCallBack ihcb, ITestResult itr) {
ihcb.runTestMethod(itr);
}

private static void schedule(Runnable task, long delay) {
SCHEDULER.schedule(new TimerTask() {
@Override
Expand All @@ -108,4 +112,18 @@ public void run() {
}
}, delay);
}

static void assertTitle(Stage s, String expTitle, String msg) {
for (var i = 0; i < 100; i++) {
var title = s.getTitle();
if (expTitle.equals(title)) {
return;
}
try {
Thread.sleep(50);
} catch (InterruptedException ex) {
}
}
fail(msg + " expecting: " + expTitle + " but was: " + s.getTitle());
}
}
16 changes: 7 additions & 9 deletions boot-fx/src/test/java/org/netbeans/html/boot/fx/PopupTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import net.java.html.BrwsrCtx;
import net.java.html.boot.BrowserBuilder;
import net.java.html.js.JavaScriptBody;
import static org.netbeans.html.boot.fx.KOFx.assertTitle;
import org.netbeans.html.boot.spi.Fn;
import static org.testng.Assert.*;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -84,23 +85,20 @@ public void run() {

assertNotNull(lastWebView[0], "A WebView created");
Stage s = (Stage) lastWebView[0].getScene().getWindow();
assertEquals(s.getTitle(), "FX Presenter Harness");
assertTitle(s, "FX Presenter Harness", "Initial title value read from HTML page");

final Object[] window = new Object[1];
final CountDownLatch openWindow = new CountDownLatch(1);
when.ctx.execute(new Runnable() {
@Override
public void run() {
TitleTest.changeTitle("First window");
window[0] = openSecondaryWindow("second.html");
openWindow.countDown();
}
when.ctx.execute(() -> {
TitleTest.changeTitle("First window");
window[0] = openSecondaryWindow("second.html");
openWindow.countDown();
});

openWindow.await(5, TimeUnit.SECONDS);

assertNotNull(window[0], "Second window opened");

assertEquals(s.getTitle(), "First window", "The title is kept");
assertTitle(s, "First window", "The title is kept");
}
}
20 changes: 7 additions & 13 deletions boot-fx/src/test/java/org/netbeans/html/boot/fx/TitleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import net.java.html.BrwsrCtx;
import net.java.html.boot.BrowserBuilder;
import net.java.html.js.JavaScriptBody;
import static org.netbeans.html.boot.fx.KOFx.assertTitle;
import org.netbeans.html.boot.spi.Fn;
import static org.testng.Assert.*;
import org.testng.annotations.Test;
Expand Down Expand Up @@ -88,25 +88,19 @@ public void run() {

assertNotNull(lastWebView[0], "A WebView created");
Stage s = (Stage) lastWebView[0].getScene().getWindow();
assertEquals(s.getTitle(), "FX Presenter Harness");
assertTitle(s, "FX Presenter Harness", "Initial title is read from HTML page");

final CountDownLatch propChange = new CountDownLatch(1);
s.titleProperty().addListener(new ChangeListener<String>() {
@Override
public void changed(ObservableValue<? extends String> ov, String t, String t1) {
propChange.countDown();
}
s.titleProperty().addListener((ObservableValue<? extends String> ov, String t, String t1) -> {
propChange.countDown();
});

when.ctx.execute(new Runnable() {
@Override
public void run() {
changeTitle("New title");
}
when.ctx.execute(() -> {
changeTitle("New title");
});

propChange.await(5, TimeUnit.SECONDS);
assertEquals(s.getTitle(), "New title");
assertTitle(s, "New title", "Title is dynamically updated");
}

final void doCheckReload() throws Exception {
Expand Down
1 change: 1 addition & 0 deletions ecj-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<subpackages>org.netbeans.html.ecjtest.dummy</subpackages>
<skip>true</skip>
</configuration>
</plugin>
Expand Down
25 changes: 25 additions & 0 deletions ecj-test/src/main/java/org/netbeans/html/ecjtest/dummy/Dummy.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/package org.netbeans.html.ecjtest.dummy;

/** Dummy class.
*/
public final class Dummy {
private Dummy() {
}
}
5 changes: 3 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<netbeans.version>RELEASE130</netbeans.version>
<graalvm.version>21.3.0</graalvm.version>
<grizzly.version>2.3.8</grizzly.version>
<openjfx.version>11.0.2</openjfx.version>
<license>COPYING</license>
<publicPackages />
<bundleSymbolicName>${project.artifactId}</bundleSymbolicName>
Expand Down Expand Up @@ -393,13 +394,13 @@ org.netbeans.html.boot.impl:org.netbeans.html.boot.fx:org.netbeans.html.context.
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>11</version>
<version>${openjfx.version}</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<scope>test</scope>
<version>11</version>
<version>${openjfx.version}</version>
</dependency>
<dependency>
<groupId>com.vaadin.external.google</groupId>
Expand Down