补充公共表格视觉验收
This commit is contained in:
+6
-5
@@ -23,7 +23,7 @@ import static org.junit.jupiter.api.Assertions.fail;
|
|||||||
class NativeUiSceneVisualAcceptanceFixtureTest {
|
class NativeUiSceneVisualAcceptanceFixtureTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void capturesTenDistinctRealJavaFxScenesWithoutSynthesizingNativeChrome() throws Exception {
|
void capturesElevenDistinctRealJavaFxScenesWithoutSynthesizingNativeChrome() throws Exception {
|
||||||
Assumptions.assumeTrue(NativeUiVisualAcceptanceFixture.captureEnabled(),
|
Assumptions.assumeTrue(NativeUiVisualAcceptanceFixture.captureEnabled(),
|
||||||
() -> "Enable explicitly with -D"
|
() -> "Enable explicitly with -D"
|
||||||
+ NativeUiVisualAcceptanceFixture.ENABLED_PROPERTY + "=true");
|
+ NativeUiVisualAcceptanceFixture.ENABLED_PROPERTY + "=true");
|
||||||
@@ -34,7 +34,7 @@ class NativeUiSceneVisualAcceptanceFixtureTest {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<Object> captures = (List<Object>) capture.invoke(null);
|
List<Object> captures = (List<Object>) capture.invoke(null);
|
||||||
|
|
||||||
assertEquals(10, captures.size());
|
assertEquals(11, captures.size());
|
||||||
List<String> actualNames = new ArrayList<>();
|
List<String> actualNames = new ArrayList<>();
|
||||||
Set<String> imageHashes = new HashSet<>();
|
Set<String> imageHashes = new HashSet<>();
|
||||||
for (Object captured : captures) {
|
for (Object captured : captures) {
|
||||||
@@ -68,14 +68,15 @@ class NativeUiSceneVisualAcceptanceFixtureTest {
|
|||||||
"scene-selected-expanded-1440.png",
|
"scene-selected-expanded-1440.png",
|
||||||
"scene-selected-collapsed-1440.png",
|
"scene-selected-collapsed-1440.png",
|
||||||
"scene-selected-expanded-1024.png",
|
"scene-selected-expanded-1024.png",
|
||||||
"scene-selected-collapsed-1024.png"), actualNames);
|
"scene-selected-collapsed-1024.png",
|
||||||
assertEquals(10, imageHashes.size(),
|
"scene-running-1100.png"), actualNames);
|
||||||
|
assertEquals(11, imageHashes.size(),
|
||||||
"Every real Scene state and width must produce a distinct image");
|
"Every real Scene state and width must produce a distinct image");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void assertSceneDimensions(Path path, int width, int height) {
|
private static void assertSceneDimensions(Path path, int width, int height) {
|
||||||
String name = path.getFileName().toString();
|
String name = path.getFileName().toString();
|
||||||
int stageWidth = name.contains("1440") ? 1440 : 1024;
|
int stageWidth = name.contains("1440") ? 1440 : name.contains("1100") ? 1100 : 1024;
|
||||||
int stageHeight = name.contains("1440") ? 900 : 768;
|
int stageHeight = name.contains("1440") ? 900 : 768;
|
||||||
assertTrue(width <= stageWidth && width >= stageWidth - 32,
|
assertTrue(width <= stageWidth && width >= stageWidth - 32,
|
||||||
() -> "Unexpected Scene width for " + path + ": " + width);
|
() -> "Unexpected Scene width for " + path + ": " + width);
|
||||||
|
|||||||
@@ -7,8 +7,12 @@ import com.example.workutils.system.ui.async.OperationState;
|
|||||||
import com.example.workutils.system.ui.async.OperationStatusPane;
|
import com.example.workutils.system.ui.async.OperationStatusPane;
|
||||||
import com.example.workutils.system.ui.icon.AppIcon;
|
import com.example.workutils.system.ui.icon.AppIcon;
|
||||||
import com.example.workutils.system.ui.icon.IconFactory;
|
import com.example.workutils.system.ui.icon.IconFactory;
|
||||||
|
import com.example.workutils.system.ui.history.ExportHistoryPane;
|
||||||
|
import com.example.workutils.system.ui.history.HistoryFileCommands;
|
||||||
|
import com.example.workutils.system.ui.history.HistoryItem;
|
||||||
import com.example.workutils.system.ui.shell.NavigationRail;
|
import com.example.workutils.system.ui.shell.NavigationRail;
|
||||||
import com.example.workutils.system.ui.shell.PageHeader;
|
import com.example.workutils.system.ui.shell.PageHeader;
|
||||||
|
import javafx.collections.FXCollections;
|
||||||
import javafx.embed.swing.SwingFXUtils;
|
import javafx.embed.swing.SwingFXUtils;
|
||||||
import javafx.geometry.Bounds;
|
import javafx.geometry.Bounds;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
@@ -215,8 +219,20 @@ final class NativeUiVisualAcceptanceFixture {
|
|||||||
LoadingButtonBinder.bind(operationButton, operationController, "开始生成");
|
LoadingButtonBinder.bind(operationButton, operationController, "开始生成");
|
||||||
operationStatusPane.setId("visual-fixture-status");
|
operationStatusPane.setId("visual-fixture-status");
|
||||||
|
|
||||||
|
ExportHistoryPane historyPane = new ExportHistoryPane(
|
||||||
|
"导出格式",
|
||||||
|
"文件数",
|
||||||
|
FXCollections.observableArrayList(
|
||||||
|
history("1", "HTML", "D:/exports/compensatory-core-api.html", "1", "2026-07-31 20:06:30"),
|
||||||
|
history("2", "HTML", "D:/exports/api_custom_batch.html", "1", "2026-07-31 20:05:42"),
|
||||||
|
history("3", "Markdown", "D:/exports/public-api.md", "8", "2026-07-31 20:05:36")),
|
||||||
|
new HistoryFileCommands(
|
||||||
|
ignored -> { }, ignored -> { }, ignored -> { }, ignored -> { }),
|
||||||
|
DesignTokens.FONT_BODY);
|
||||||
|
|
||||||
runningPane = new VBox(Theme.S4,
|
runningPane = new VBox(Theme.S4,
|
||||||
new PageHeader("任务执行", "无业务副作用的视觉验收状态"),
|
new PageHeader("API 接口文档导出", "公共历史表格视觉验收"),
|
||||||
|
historyPane,
|
||||||
operationButton,
|
operationButton,
|
||||||
operationStatusPane);
|
operationStatusPane);
|
||||||
runningPane.setPadding(new Insets(Theme.S6));
|
runningPane.setPadding(new Insets(Theme.S6));
|
||||||
@@ -234,6 +250,11 @@ final class NativeUiVisualAcceptanceFixture {
|
|||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static HistoryItem history(
|
||||||
|
String index, String format, String file, String count, String time) {
|
||||||
|
return new HistoryItem(index, format, file, count, time);
|
||||||
|
}
|
||||||
|
|
||||||
static FixtureWindow open(Path outputDirectory) throws ReflectiveOperationException {
|
static FixtureWindow open(Path outputDirectory) throws ReflectiveOperationException {
|
||||||
assertTrue(javafx.application.Platform.isFxApplicationThread());
|
assertTrue(javafx.application.Platform.isFxApplicationThread());
|
||||||
Theme.initTheme();
|
Theme.initTheme();
|
||||||
@@ -449,6 +470,8 @@ final class NativeUiVisualAcceptanceFixture {
|
|||||||
"selected-expanded-1024.png", View.SELECTED, true, 1024, 768));
|
"selected-expanded-1024.png", View.SELECTED, true, 1024, 768));
|
||||||
specs.add(new CaptureSpec(
|
specs.add(new CaptureSpec(
|
||||||
"selected-collapsed-1024.png", View.SELECTED, false, 1024, 768));
|
"selected-collapsed-1024.png", View.SELECTED, false, 1024, 768));
|
||||||
|
specs.add(new CaptureSpec(
|
||||||
|
"running-1100.png", View.RUNNING, true, 1100, 768));
|
||||||
return List.copyOf(specs);
|
return List.copyOf(specs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -59,7 +59,8 @@ class NativeUiVisualAcceptanceFixtureContractTest {
|
|||||||
"scene-selected-expanded-1440.png",
|
"scene-selected-expanded-1440.png",
|
||||||
"scene-selected-collapsed-1440.png",
|
"scene-selected-collapsed-1440.png",
|
||||||
"scene-selected-expanded-1024.png",
|
"scene-selected-expanded-1024.png",
|
||||||
"scene-selected-collapsed-1024.png"),
|
"scene-selected-collapsed-1024.png",
|
||||||
|
"scene-running-1100.png"),
|
||||||
requiredSceneImageNames.invoke(null));
|
requiredSceneImageNames.invoke(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user