Qualify Archiver management commands and reader actions in IntelliJ
This commit is contained in:
@@ -0,0 +1,388 @@
|
||||
package qualification;
|
||||
|
||||
import java.nio.file.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
import javafx.application.Platform;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.*;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.shape.SVGPath;
|
||||
import javafx.stage.*;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
/** Acts on the actual controls in the interactive Archiver worker. */
|
||||
public final class ManagementReadersTargetProbe {
|
||||
public static void premain(String dir) {
|
||||
if (System.getProperty("sun.java.command", "")
|
||||
.startsWith("de.neitzel.fxdesigner.target.WorkerMain "))
|
||||
Thread.ofPlatform().daemon().start(() -> Worker.run(Path.of(dir)));
|
||||
}
|
||||
|
||||
private static final class Worker {
|
||||
private static <T> T fx(Callable<T> action) throws Exception {
|
||||
var task = new FutureTask<>(action);
|
||||
Platform.runLater(task);
|
||||
return task.get(10, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
private static void require(boolean value, String message) {
|
||||
if (!value) throw new AssertionError(message);
|
||||
}
|
||||
|
||||
private static void run(Path dir) {
|
||||
try {
|
||||
Stage stage = null;
|
||||
while (stage == null) {
|
||||
Thread.sleep(120);
|
||||
try {
|
||||
stage =
|
||||
fx(
|
||||
() ->
|
||||
Window.getWindows().stream()
|
||||
.filter(
|
||||
w ->
|
||||
w instanceof Stage s
|
||||
&& s.isShowing()
|
||||
&& s.getOpacity() > 0
|
||||
&& s.getTitle() != null
|
||||
&& s.getTitle().startsWith("Neitzel preview"))
|
||||
.map(Stage.class::cast)
|
||||
.findFirst()
|
||||
.orElse(null));
|
||||
} catch (IllegalStateException starting) {
|
||||
}
|
||||
}
|
||||
Stage shown = stage;
|
||||
var attempt = Files.readString(dir.resolve("management-case"));
|
||||
boolean management = attempt.startsWith("accounts-") || attempt.startsWith("trash-");
|
||||
var root =
|
||||
fx(
|
||||
() -> {
|
||||
shown.setWidth(management ? 900 : 920);
|
||||
shown.setHeight(management ? 600 : 135);
|
||||
var r = shown.getScene().getRoot();
|
||||
r.applyCss();
|
||||
r.layout();
|
||||
return r;
|
||||
});
|
||||
String result =
|
||||
fx(
|
||||
() ->
|
||||
switch (attempt) {
|
||||
case "accounts-idle", "accounts-busy", "accounts-idle-edited" ->
|
||||
accounts(root, attempt, dir);
|
||||
case "trash-full", "trash-empty", "trash-full-edited" ->
|
||||
trash(root, attempt, dir);
|
||||
default -> reader(root, attempt, dir);
|
||||
});
|
||||
if (attempt.equals("accounts-idle")) {
|
||||
fx(
|
||||
() -> {
|
||||
root.applyCss();
|
||||
root.layout();
|
||||
var display = (javafx.scene.text.Text) root.lookup("#details").lookup(".text");
|
||||
require(
|
||||
display.getText().contains("mail.example.invalid"),
|
||||
"Account endpoint clipped: " + display.getText());
|
||||
image(root, dir.resolve("management-accounts.png"));
|
||||
return null;
|
||||
});
|
||||
}
|
||||
if (attempt.equals("slides")) {
|
||||
verifyPlayback(root);
|
||||
result += " · automatischer Bildwechsel und Stillstand nach Pause";
|
||||
}
|
||||
Files.writeString(dir.resolve("result-" + attempt), result);
|
||||
} catch (Throwable failure) {
|
||||
var trace = new java.io.StringWriter();
|
||||
failure.printStackTrace(new java.io.PrintWriter(trace));
|
||||
try {
|
||||
Files.writeString(dir.resolve("target-error.txt"), trace.toString());
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void verifyPlayback(Node root) throws Exception {
|
||||
// Begin on the last slide so one advance also exercises automatic wraparound.
|
||||
fx(
|
||||
() -> {
|
||||
button(root, "next").fire();
|
||||
button(root, "next").fire();
|
||||
button(root, "playback").fire();
|
||||
return null;
|
||||
});
|
||||
long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(12);
|
||||
while (!fx(() -> label(root, "reader-sample").startsWith("1 / 3"))) {
|
||||
if (System.nanoTime() > deadline) throw new AssertionError("No automatic advance");
|
||||
Thread.sleep(80);
|
||||
}
|
||||
fx(
|
||||
() -> {
|
||||
button(root, "playback").fire();
|
||||
return null;
|
||||
});
|
||||
Thread.sleep(4500);
|
||||
require(
|
||||
fx(
|
||||
() ->
|
||||
label(root, "reader-sample").startsWith("1 / 3")
|
||||
&& button(root, "playback").getAccessibleText().equals("Abspielen")),
|
||||
"Advanced during pause");
|
||||
}
|
||||
|
||||
private static Button button(Node root, String id) {
|
||||
return (Button) Objects.requireNonNull(root.lookup("#" + id), id);
|
||||
}
|
||||
|
||||
private static String label(Node root, String id) {
|
||||
return ((Label) root.lookup("#" + id)).getText();
|
||||
}
|
||||
|
||||
private static void enabled(Node root, String id, boolean expected) {
|
||||
require(!button(root, id).isDisabled() == expected, id + " enabled=" + expected);
|
||||
}
|
||||
|
||||
private static String accounts(Node root, String attempt, Path dir) throws Exception {
|
||||
var list = (ListView<?>) root.lookup("#accounts");
|
||||
require(
|
||||
list.getItems().stream().map(Object::toString).toList().equals(List.of("Privat", "Büro")),
|
||||
"Accounts");
|
||||
if (attempt.endsWith("busy")) {
|
||||
require(list.isDisabled() && label(root, "status").contains("läuft"), "Busy list/status");
|
||||
for (var id :
|
||||
List.of(
|
||||
"create",
|
||||
"configure",
|
||||
"activate",
|
||||
"fetch",
|
||||
"verify",
|
||||
"release",
|
||||
"revoke",
|
||||
"expire",
|
||||
"close")) {
|
||||
enabled(root, id, false);
|
||||
button(root, id).fire();
|
||||
}
|
||||
require(label(root, "status").contains("läuft"), "Busy action ran");
|
||||
return "Abruf läuft · alle neun Commands und Kontenauswahl gesperrt";
|
||||
}
|
||||
require(label(root, "details").contains("kein Serverprofil"), "Local details");
|
||||
enabled(root, "configure", true);
|
||||
enabled(root, "fetch", false);
|
||||
list.getSelectionModel().select(1);
|
||||
require(
|
||||
label(root, "details").contains("mail.example.invalid")
|
||||
&& label(root, "details").contains("30 Tage"),
|
||||
"Office details");
|
||||
if (attempt.endsWith("edited")) {
|
||||
button(root, "configure").fire();
|
||||
require(
|
||||
label(root, "status").equals("Beispielaktion · CREATE · Büro"), "Remapped configure");
|
||||
return "configure → create nach Wiederöffnen am Konto Büro ausgelöst";
|
||||
}
|
||||
button(root, "configure").fire();
|
||||
require(label(root, "status").contains("CONFIGURE · Büro"), "Configure office");
|
||||
button(root, "fetch").fire();
|
||||
require(label(root, "status").contains("CONFIGURE · Büro"), "Disabled fetch executed");
|
||||
for (var action :
|
||||
List.of(
|
||||
"activate", "fetch", "verify", "release", "expire", "revoke", "create", "close")) {
|
||||
enabled(root, action, true);
|
||||
button(root, action).fire();
|
||||
require(
|
||||
label(root, "status").contains(action.toUpperCase(Locale.ROOT) + " · Büro"), action);
|
||||
}
|
||||
enabled(root, "expire", false);
|
||||
return "Privat ohne Serverprofil, Büro mit IMAP · Aktivierung, Abruf, Prüflauf, Freigabe,"
|
||||
+ " Löschlauf und Widerruf geprüft";
|
||||
}
|
||||
|
||||
private static String trash(Node root, String attempt, Path dir) throws Exception {
|
||||
var items = (TableView<?>) root.lookup("#trash-items");
|
||||
var files = (TableView<?>) root.lookup("#trash-files");
|
||||
if (attempt.endsWith("empty")) {
|
||||
require(
|
||||
items.getItems().isEmpty()
|
||||
&& files.getItems().isEmpty()
|
||||
&& label(root, "summary").equals("0 Einträge · 0 Dateien"),
|
||||
"Empty trash");
|
||||
enabled(root, "trash-delete", false);
|
||||
enabled(root, "trash-empty", false);
|
||||
return "Leerer Papierkorb · beide Commands gesperrt";
|
||||
}
|
||||
require(label(root, "summary").equals("2 Einträge · 3 Dateien"), "Initial summary");
|
||||
items.getSelectionModel().clearSelection();
|
||||
require(files.getItems().isEmpty(), "Files without selection");
|
||||
enabled(root, "trash-delete", false);
|
||||
enabled(root, "trash-empty", true);
|
||||
items.getSelectionModel().select(0);
|
||||
require(
|
||||
files.getItems().size() == 2
|
||||
&& files.getItems().getFirst().toString().contains("Rechnung.pdf")
|
||||
&& files.getItems().getLast().toString().contains("Lieferschein.md"),
|
||||
"Folder file list");
|
||||
enabled(root, "trash-delete", true);
|
||||
items.getSelectionModel().select(1);
|
||||
require(
|
||||
files.getItems().size() == 3
|
||||
&& files.getItems().getLast().toString().contains("Notiz.txt"),
|
||||
"Multiple file list");
|
||||
if (attempt.endsWith("edited")) {
|
||||
button(root, "trash-delete").fire();
|
||||
require(
|
||||
label(root, "example-trash-action").equals("Wiederherstellen · Belege, Notiz.txt"),
|
||||
"Restore selection");
|
||||
require(
|
||||
items.getItems().isEmpty() && files.getItems().isEmpty(), "Restored items retained");
|
||||
return "delete → restoreSelection nach Wiederöffnen · Belege und Notiz.txt"
|
||||
+ " wiederhergestellt";
|
||||
}
|
||||
image(root, dir.resolve("management-trash.png"));
|
||||
items.getSelectionModel().clearAndSelect(1);
|
||||
button(root, "trash-delete").fire();
|
||||
require(
|
||||
label(root, "example-trash-action").equals("Löschen · Notiz.txt")
|
||||
&& label(root, "summary").equals("1 Einträge · 2 Dateien"),
|
||||
"Delete selection");
|
||||
button(root, "trash-empty").fire();
|
||||
require(
|
||||
label(root, "example-trash-action").equals("Leeren · Belege")
|
||||
&& items.getItems().isEmpty()
|
||||
&& files.getItems().isEmpty()
|
||||
&& label(root, "summary").equals("0 Einträge · 0 Dateien"),
|
||||
"Empty action");
|
||||
enabled(root, "trash-empty", false);
|
||||
enabled(root, "trash-delete", false);
|
||||
return "0/1/2 ausgewählte Einträge · Dateilisten und Summary geprüft · Notiz gelöscht und"
|
||||
+ " Ordner geleert";
|
||||
}
|
||||
|
||||
private static String reader(Node root, String attempt, Path dir) throws Exception {
|
||||
if (attempt.equals("attachment")) {
|
||||
var pick = (ComboBox<?>) root.lookup("#example-attachments");
|
||||
for (var id : List.of("open-attachment", "save-attachment")) enabled(root, id, false);
|
||||
pick.getSelectionModel().selectFirst();
|
||||
for (var id : List.of("open-attachment", "save-attachment")) {
|
||||
enabled(root, id, true);
|
||||
button(root, id).fire();
|
||||
String verb = id.startsWith("open") ? "Geöffnet" : "Gespeichert";
|
||||
require(
|
||||
label(root, "attachment-result")
|
||||
.equals(verb + " · Lieferschein.txt · LS-018 · Drei Archivkartons"),
|
||||
id);
|
||||
}
|
||||
image(root, dir.resolve("reader-attachment.png"));
|
||||
pick.getSelectionModel().clearSelection();
|
||||
for (var id : List.of("open-attachment", "save-attachment")) enabled(root, id, false);
|
||||
return "Ohne Auswahl gesperrt · Lieferschein.txt geöffnet und Sitzungskopie mit gleichem"
|
||||
+ " Inhalt gespeichert";
|
||||
}
|
||||
var suffix =
|
||||
switch (attempt) {
|
||||
case "pdf" -> "-page";
|
||||
case "epub" -> "-chapter";
|
||||
case "images" -> "-image";
|
||||
default -> "";
|
||||
};
|
||||
var back = button(root, "previous" + suffix);
|
||||
var next = button(root, "next" + suffix);
|
||||
var state = attempt.equals("images") ? "image-position" : "reader-sample";
|
||||
var names =
|
||||
switch (attempt) {
|
||||
case "pdf" -> List.of("Deckblatt", "Rechnungspositionen", "Zahlungsziel");
|
||||
case "epub" -> List.of("Ankunft", "Im Archiv", "Heimweg");
|
||||
default -> List.of("Eingang.jpg", "Regal.jpg", "Ausgang.jpg");
|
||||
};
|
||||
for (int i = 0; i < 3; i++) {
|
||||
require(
|
||||
back.isDisabled() == (i == 0) && next.isDisabled() == (i == 2), "Boundaries at " + i);
|
||||
require(label(root, state).equals((i + 1) + " / 3 · " + names.get(i)), label(root, state));
|
||||
if (i == 2) break;
|
||||
next.fire();
|
||||
}
|
||||
next.fire();
|
||||
for (int i = 2; i >= 0; i--) {
|
||||
require(
|
||||
label(root, state).startsWith((i + 1) + " / 3") && back.isDisabled() == (i == 0),
|
||||
"Return " + i);
|
||||
back.fire();
|
||||
}
|
||||
switch (attempt) {
|
||||
case "images" -> {
|
||||
var svg = (SVGPath) back.getGraphic().lookup("SVGPath");
|
||||
require(
|
||||
"Bild zurück".equals(back.getAccessibleText())
|
||||
&& "Bild zurück".equals(back.getTooltip().getText())
|
||||
&& svg.getContent().startsWith("M1 8 Q8"),
|
||||
"Saved accessible text / VIEW graphic");
|
||||
image(root, dir.resolve("reader-icon.png"));
|
||||
}
|
||||
case "pdf" -> {
|
||||
var page = (TextField) root.lookup("#page-number");
|
||||
page.setText("3");
|
||||
page.fireEvent(new ActionEvent());
|
||||
require(
|
||||
next.isDisabled()
|
||||
&& page.getText().equals("3")
|
||||
&& label(root, state).contains("Zahlungsziel"),
|
||||
"Page entry");
|
||||
page.setText("99");
|
||||
page.fireEvent(new ActionEvent());
|
||||
require(page.getText().equals("3"), "Out-of-range page");
|
||||
((ChoiceBox<?>) root.lookup("#page-zoom")).getSelectionModel().select(3);
|
||||
require(
|
||||
((Label) root.lookup("#reader-sample")).getFont().getSize() == 24, "150 % page zoom");
|
||||
}
|
||||
case "epub" -> {
|
||||
((ChoiceBox<?>) root.lookup("#chapters")).getSelectionModel().select(1);
|
||||
require(label(root, state).contains("Im Archiv"), "Chapter choice");
|
||||
var sample = (Label) root.lookup("#reader-sample");
|
||||
button(root, "larger").fire();
|
||||
require(sample.getFont().getSize() == 20, "Larger font");
|
||||
button(root, "smaller").fire();
|
||||
require(sample.getFont().getSize() == 18, "Smaller font");
|
||||
}
|
||||
case "slides" -> {
|
||||
var play = button(root, "playback");
|
||||
var playPath = ((SVGPath) play.getGraphic().lookup("SVGPath")).getContent();
|
||||
require("Abspielen".equals(play.getAccessibleText()), "Play action");
|
||||
play.fire();
|
||||
require(
|
||||
"Pause".equals(play.getAccessibleText())
|
||||
&& !playPath.equals(((SVGPath) play.getGraphic().lookup("SVGPath")).getContent()),
|
||||
"Pause action");
|
||||
play.fire();
|
||||
require(
|
||||
"Abspielen".equals(play.getAccessibleText())
|
||||
&& playPath.equals(((SVGPath) play.getGraphic().lookup("SVGPath")).getContent()),
|
||||
"Restored Play");
|
||||
}
|
||||
}
|
||||
if (!attempt.equals("images")) image(root, dir.resolve("reader-" + attempt + ".png"));
|
||||
return switch (attempt) {
|
||||
case "images" ->
|
||||
"1 → 2 → 3 → 2 → 1 · Bildnamen, Grenzsperren, gespeichertes VIEW-Symbol und"
|
||||
+ " Beschreibung geprüft";
|
||||
case "pdf" -> "Seitennavigation und Grenzsperren · Eingabe Seite 3 · Zoom 150 %";
|
||||
case "epub" ->
|
||||
"Kapitelnavigation und Grenzsperren · Kapitel Im Archiv · Schrift 18 → 20 → 18";
|
||||
default ->
|
||||
"Bildnavigation und Grenzsperren · Abspielen → Pause → Abspielen mit wechselnder"
|
||||
+ " Grafik";
|
||||
};
|
||||
}
|
||||
|
||||
private static void image(Node node, Path path) throws Exception {
|
||||
var img = node.snapshot(null, null);
|
||||
int w = (int) img.getWidth(), h = (int) img.getHeight();
|
||||
var out = new java.awt.image.BufferedImage(w, h, java.awt.image.BufferedImage.TYPE_INT_ARGB);
|
||||
int[] pixels = new int[w * h];
|
||||
img.getPixelReader()
|
||||
.getPixels(0, 0, w, h, javafx.scene.image.PixelFormat.getIntArgbInstance(), pixels, 0, w);
|
||||
out.setRGB(0, 0, w, h, pixels, 0, w);
|
||||
ImageIO.write(out, "png", path.toFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package qualification;
|
||||
|
||||
import static qualification.WorkflowProbe.*;
|
||||
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.oracle.javafx.scenebuilder.kit.fxom.FXOMFxIdIndex;
|
||||
import de.neitzel.fxdesigner.workflow.DesignerWorkflow.Example;
|
||||
import java.nio.file.*;
|
||||
import javafx.embed.swing.SwingFXUtils;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
/** Changes the draft via the registered inspector, then exercises its managed worker. */
|
||||
public final class ManagementReadersWorkflowProbe extends FormWorkflowProbe {
|
||||
private Project project;
|
||||
|
||||
void verify(Project project) throws Exception {
|
||||
this.project = project;
|
||||
management(
|
||||
"MailControls", "accounts-idle", "accounts-busy", "configure", "configure", "create", 9);
|
||||
management(
|
||||
"TrashPane",
|
||||
"trash-full",
|
||||
"trash-empty",
|
||||
"delete",
|
||||
"deleteSelection",
|
||||
"restoreSelection",
|
||||
2);
|
||||
open("ReaderNavigation");
|
||||
attribute("symbol", "VIEW");
|
||||
attribute("accessibleText", "Bild zurück");
|
||||
reopen("ReaderNavigation", "accessibleText=\"Bild zurück\"");
|
||||
build("reader-images");
|
||||
interactive("reader-images", "images");
|
||||
for (String[] reader :
|
||||
new String[][] {
|
||||
{"PdfToolbar", "pdf"},
|
||||
{"EpubToolbar", "epub"},
|
||||
{"SlideshowToolbar", "slides"},
|
||||
{"AttachmentToolbar", "attachment"}
|
||||
}) {
|
||||
open(reader[0]);
|
||||
String id = "reader-" + reader[1];
|
||||
build(id);
|
||||
interactive(id, reader[1]);
|
||||
}
|
||||
Files.writeString(output.resolve("SUCCESS.txt"), Files.readString(output.resolve("steps.txt")));
|
||||
}
|
||||
|
||||
private void open(String name) throws Exception {
|
||||
var path =
|
||||
Path.of(project.getBasePath(), "src/main/resources/de/neitzel/archiver/ui", name + ".fxml");
|
||||
file = edt(() -> LocalFileSystem.getInstance().refreshAndFindFileByNioFile(path));
|
||||
pane = openDesigner(project, file);
|
||||
if (!source().contains("<?neitzel-model de.neitzel.archiver.ui."))
|
||||
throw new AssertionError(name);
|
||||
}
|
||||
|
||||
private void build(String id) throws Exception {
|
||||
click(pane, "Form preview");
|
||||
click(pane, "Build and Refresh");
|
||||
await(
|
||||
() ->
|
||||
fx(
|
||||
() ->
|
||||
((ComboBox<?>) pane.lookup("#preview-example"))
|
||||
.getItems().stream().anyMatch(item -> item.toString().contains(id))));
|
||||
}
|
||||
|
||||
private void interactive(String id, String attempt) throws Exception {
|
||||
choose("preview-example", id);
|
||||
await(
|
||||
() ->
|
||||
fx(
|
||||
() -> {
|
||||
var state = ((Label) pane.lookup("#preview-state")).getText();
|
||||
if (state.startsWith("Preview failed")
|
||||
|| state.startsWith("Preview blocked")
|
||||
|| state.startsWith("Preview unavailable"))
|
||||
throw new AssertionError(id + " · " + state);
|
||||
var choice = (Example) ((ComboBox<?>) pane.lookup("#preview-example")).getValue();
|
||||
return ((ImageView) pane.lookup("#full-preview-image")).getImage() != null
|
||||
&& state.contains(choice.label());
|
||||
}));
|
||||
Files.writeString(output.resolve("management-case"), attempt);
|
||||
click(pane, "Interactive preview");
|
||||
String name = "result-" + attempt;
|
||||
awaitTarget(name);
|
||||
step(id + " · " + Files.readString(output.resolve(name)));
|
||||
click(pane, "Stop preview");
|
||||
}
|
||||
|
||||
private void reopen(String form, String saved) throws Exception {
|
||||
click(pane, "Save");
|
||||
await(() -> Files.readString(Path.of(file.getPath())).contains(saved));
|
||||
edt(
|
||||
() -> {
|
||||
FileEditorManager.getInstance(project).closeFile(file);
|
||||
return null;
|
||||
});
|
||||
open(form);
|
||||
if (!source().contains(saved)) throw new AssertionError("Reopened " + form);
|
||||
}
|
||||
|
||||
private void commands(String control, String path, int count) throws Exception {
|
||||
fx(
|
||||
() -> {
|
||||
var group =
|
||||
(TitledPane)
|
||||
pane.lookupAll(".titled-pane").stream()
|
||||
.filter(n -> n instanceof TitledPane t && "Bindings".equals(t.getText()))
|
||||
.findFirst()
|
||||
.orElseThrow();
|
||||
group.setExpanded(true);
|
||||
var tabs = (TabPane) group.getContent();
|
||||
tabs.getSelectionModel()
|
||||
.select(
|
||||
tabs.getTabs().stream()
|
||||
.filter(t -> t.getText().equals("Command bindings"))
|
||||
.findFirst()
|
||||
.orElseThrow());
|
||||
pane.applyCss();
|
||||
pane.layout();
|
||||
var list = (ListView<?>) pane.lookup("#command-bindings");
|
||||
if (list.getItems().size() != count) throw new AssertionError(list.getItems());
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (list.getItems().get(i).toString().startsWith(control + " ←"))
|
||||
list.getSelectionModel().select(i);
|
||||
}
|
||||
if (!control.equals(((TextField) pane.lookup("#command-control")).getText())
|
||||
|| !path.equals(((TextField) pane.lookup("#command-path")).getText()))
|
||||
throw new AssertionError(control + " → " + path);
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
private void management(
|
||||
String form,
|
||||
String data,
|
||||
String other,
|
||||
String control,
|
||||
String path,
|
||||
String replacement,
|
||||
int count)
|
||||
throws Exception {
|
||||
open(form);
|
||||
build(data);
|
||||
interactive(data, data);
|
||||
interactive(other, other);
|
||||
commands(control, path, count);
|
||||
fx(
|
||||
() -> {
|
||||
((TextField) pane.lookup("#command-path")).setText(replacement);
|
||||
return null;
|
||||
});
|
||||
click(pane, "Apply Command binding");
|
||||
String edited = "control=\"" + control + "\" path=\"" + replacement + "\"";
|
||||
await(() -> source().contains(edited));
|
||||
reopen(form, edited);
|
||||
commands(control, replacement, count);
|
||||
if (form.equals("MailControls")) {
|
||||
fx(
|
||||
() -> {
|
||||
ImageIO.write(
|
||||
SwingFXUtils.fromFXImage(pane.snapshot(null, null), null),
|
||||
"png",
|
||||
output.resolve("intellij.png").toFile());
|
||||
return null;
|
||||
});
|
||||
}
|
||||
build(data);
|
||||
interactive(data, data + "-edited");
|
||||
}
|
||||
|
||||
private void attribute(String name, String value) throws Exception {
|
||||
fx(
|
||||
() -> {
|
||||
var kit = pane.kit().editor();
|
||||
kit.getSelection().select(new FXOMFxIdIndex(kit.getFxomDocument()).lookup("previous"));
|
||||
return null;
|
||||
});
|
||||
await(() -> fx(() -> pane.lookup("#component-property-" + name) != null));
|
||||
fx(
|
||||
() -> {
|
||||
var field = (TextField) pane.lookup("#component-property-" + name);
|
||||
field.setText(value);
|
||||
field.fireEvent(new ActionEvent());
|
||||
return null;
|
||||
});
|
||||
await(() -> source().contains(name + "=\"" + value + "\""));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user