Commit both corner-resize dimensions in one host transaction

This commit is contained in:
2026-11-12 12:27:04 +01:00
parent dfa2dd1508
commit b9d59e162f
5 changed files with 220 additions and 35 deletions
@@ -0,0 +1,59 @@
package de.neitzel.fxdesigner.standalone;
import de.neitzel.fxdesigner.kit.*;
import de.neitzel.fxdesigner.workflow.HostLaunch;
import java.nio.file.*;
import java.util.concurrent.*;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.stage.Stage;
/** Minimal actual Kit corner gesture -> asynchronous host document regression, no worker/build. */
public final class CornerResizeSmoke {
public static void main(String[] args) throws Exception {
var started = new CountDownLatch(1);
Platform.startup(started::countDown);
started.await();
var launch = HostLaunch.load(Path.of(args[0]));
Path file = Files.createTempFile("corner-resize-", ".fxml");
Files.writeString(
file,
"<?import javafx.scene.layout.AnchorPane?><?import fixture.components.Card?><AnchorPane"
+ " xmlns:fx='http://javafx.com/fxml/1' prefWidth='620' prefHeight='400'><Card"
+ " fx:id='second' caption='Corner' prefWidth='250' prefHeight='220' layoutX='25'"
+ " layoutY='50'/></AnchorPane>");
try (var host =
new StandaloneHost(
launch.runtimes(),
l -> CompletableFuture.completedFuture(null),
d -> System.out.println(d.message()))) {
KitWorkflowSmoke.fx(
() -> {
KitWorkflowSmoke.pane = new DesignerPane(host.services(), launch, file);
KitWorkflowSmoke.stage = new Stage();
KitWorkflowSmoke.stage.setScene(new Scene(KitWorkflowSmoke.pane, 1300, 850));
KitWorkflowSmoke.stage.show();
return null;
});
long until = System.nanoTime() + TimeUnit.SECONDS.toNanos(10);
while (!KitWorkflowSmoke.fx(
() -> KitWorkflowSmoke.pane.kit().editor().getFxomDocument() != null)) {
if (System.nanoTime() > until) throw new AssertionError("Projection failed");
Thread.sleep(25);
}
try (var doc = host.services().documents().open(file.toUri()).toCompletableFuture().get()) {
ProjectionHostChecks.resizeCorner(KitWorkflowSmoke.pane, doc);
}
System.out.println("PASS corner resize commits height and width in one undo transaction");
} finally {
KitWorkflowSmoke.fx(
() -> {
if (KitWorkflowSmoke.pane != null) KitWorkflowSmoke.pane.close();
if (KitWorkflowSmoke.stage != null) KitWorkflowSmoke.stage.close();
return null;
});
Platform.exit();
Files.deleteIfExists(file);
}
}
}