Edit and exercise Archiver CommandBindings in the IntelliJ designer
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package qualification;
|
||||
|
||||
import de.neitzel.fxdesigner.target.ExampleCatalog;
|
||||
import de.neitzel.fxdesigner.target.TargetPreview;
|
||||
import java.time.Duration;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javafx.application.Platform;
|
||||
|
||||
/** Run once per example in a fresh target JVM with fx-example's designer test classpath. */
|
||||
public final class PersonDeskRender {
|
||||
public static void main(String[] args) throws Exception {
|
||||
var loader = PersonDeskRender.class.getClassLoader();
|
||||
var example =
|
||||
ExampleCatalog.discover(loader).stream()
|
||||
.filter(entry -> entry.id().equals(args[0]))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
Platform.startup(() -> Platform.setImplicitExit(false));
|
||||
try (var preview = TargetPreview.open(example, loader, Duration.ofSeconds(15))) {
|
||||
preview.ready().toCompletableFuture().get(20, TimeUnit.SECONDS);
|
||||
var render = new FutureTask<>(() -> preview.render(480, 320));
|
||||
Platform.runLater(render);
|
||||
byte[] rgba = render.get(10, TimeUnit.SECONDS);
|
||||
int distinct = 0;
|
||||
for (int p = 4; p < rgba.length; p += 4) {
|
||||
if (rgba[p] != rgba[0] || rgba[p + 1] != rgba[1] || rgba[p + 2] != rgba[2]) distinct++;
|
||||
}
|
||||
if (rgba.length != 480 * 320 * 4 || distinct < 100)
|
||||
throw new AssertionError("Incomplete or blank frame for " + example.id());
|
||||
System.out.printf(
|
||||
"PASS %s 480x320, %d pixels differ from background%n", example.id(), distinct);
|
||||
} finally {
|
||||
Platform.exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user