Preserve FXML source ranges and extend shared Component projection
This commit is contained in:
+28
@@ -67,4 +67,32 @@ class FileDocumentsTest {
|
||||
assertEquals("draft", d.snapshot().toCompletableFuture().get().text());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void cleanExternalChangesReloadAndInvalidateOldTransactions() throws Exception {
|
||||
Path file = folder.resolve("External.fxml");
|
||||
Files.writeString(file, "old");
|
||||
try (var docs = new FileDocuments()) {
|
||||
var first = docs.open(file.toUri()).toCompletableFuture().get();
|
||||
var second = docs.open(file.toUri()).toCompletableFuture().get();
|
||||
var initial = first.snapshot().toCompletableFuture().get();
|
||||
Files.writeString(file, "external");
|
||||
var reloaded = second.snapshot().toCompletableFuture().get();
|
||||
assertEquals("external", reloaded.text());
|
||||
assertFalse(reloaded.dirty());
|
||||
assertNotEquals(initial.revision(), reloaded.revision());
|
||||
assertThrows(
|
||||
ExecutionException.class,
|
||||
() ->
|
||||
first
|
||||
.apply(
|
||||
new EditBatch(
|
||||
initial.revision(),
|
||||
"old edit",
|
||||
List.of(new EditBatch.Replacement(0, 1, "X"))))
|
||||
.toCompletableFuture()
|
||||
.get());
|
||||
assertEquals("external", first.undo().toCompletableFuture().get().text());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+22
-3
@@ -127,15 +127,30 @@ public final class KitWorkflowSmoke {
|
||||
var field =
|
||||
(TextField)
|
||||
pane.lookupAll(".text-field").stream()
|
||||
.filter(n -> n instanceof TextField t && t.getText().equals(caption))
|
||||
.filter(
|
||||
n ->
|
||||
n instanceof TextField t
|
||||
&& t.getText().equals(caption)
|
||||
&& (t.getId() == null
|
||||
|| !t.getId().startsWith("component-property-")))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
field.setText("alpha bravo charlie");
|
||||
pane.applyCss();
|
||||
pane.layout();
|
||||
var result = new StringBuilder();
|
||||
TextSelectionChecks.run(field, result);
|
||||
System.out.print(result);
|
||||
try {
|
||||
TextSelectionChecks.run(field, result);
|
||||
} finally {
|
||||
System.out.print(result);
|
||||
System.out.println(
|
||||
"Caption field: "
|
||||
+ field.getId()
|
||||
+ " width="
|
||||
+ field.getWidth()
|
||||
+ " text="
|
||||
+ field.getText());
|
||||
}
|
||||
field.setText(caption);
|
||||
field.fireEvent(new javafx.event.ActionEvent());
|
||||
return null;
|
||||
@@ -223,6 +238,10 @@ public final class KitWorkflowSmoke {
|
||||
if (!Files.readString(Path.of(args[1])).contains("Native canvas edit"))
|
||||
throw new AssertionError("Host save missing");
|
||||
}
|
||||
try (var document =
|
||||
host.services().documents().open(Path.of(args[1]).toUri()).toCompletableFuture().get()) {
|
||||
ProjectionHostChecks.run(pane, document);
|
||||
}
|
||||
fx(
|
||||
() -> {
|
||||
pane.close();
|
||||
|
||||
Reference in New Issue
Block a user