完善 PNVO001 与 PNRP17 前端图标及端口交互
按 AMESim 参考样式重绘孔板与气动活塞图标,调整端口锚点和旋转后的连接方向,并补充组件图标及接触连接回归测试。
This commit is contained in:
1 parent
1f4027573f
commit
11093613c5
5 files changed
+202
-72
No files matched your search
@@ -63,6 +63,22 @@ function signalPort(
|
||||
};
|
||||
}
|
||||
|
||||
function mechanicalPort(
|
||||
name: string,
|
||||
side: "left" | "right",
|
||||
order: number,
|
||||
) {
|
||||
return {
|
||||
name,
|
||||
kind: "physical",
|
||||
domain: "mechanical",
|
||||
nominalRole: "bidirectional",
|
||||
positiveFlowDirection: "intoComponent",
|
||||
side,
|
||||
order,
|
||||
};
|
||||
}
|
||||
|
||||
function portsForSymbol(modelType: string) {
|
||||
if (modelType === "amesim_pnor001") {
|
||||
return [
|
||||
@@ -80,6 +96,15 @@ function portsForSymbol(modelType: string) {
|
||||
if (modelType === "amesim_step0") {
|
||||
return [signalPort("out", "right", "output", 10)];
|
||||
}
|
||||
if (modelType === "amesim_pnrp17") {
|
||||
return [
|
||||
physicalPort("port_1", "left", 10),
|
||||
mechanicalPort("port_3", "left", 20),
|
||||
mechanicalPort("port_4", "left", 30),
|
||||
mechanicalPort("port_2", "right", 40),
|
||||
mechanicalPort("port_5", "right", 50),
|
||||
];
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -277,6 +302,33 @@ test("全部已移植 AMESim 模型使用专属图标及正确领域配色", asy
|
||||
}
|
||||
});
|
||||
|
||||
test("PNRP17 图标匹配参考结构并将五个端口放在对应接口", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
|
||||
const paletteSymbol = page.locator(
|
||||
'aside.palette [data-component-symbol="amesim_pnrp17"]',
|
||||
);
|
||||
await expect(paletteSymbol).toHaveCount(1);
|
||||
await expect(
|
||||
paletteSymbol.locator('[stroke="#00af00"], [fill="#00af00"]'),
|
||||
).toHaveCount(0);
|
||||
|
||||
const piston = await dragSymbolToCanvas(page, "amesim_pnrp17", {
|
||||
x: 430,
|
||||
y: 300,
|
||||
});
|
||||
await expectSymbolAnchors(piston, [
|
||||
{ portName: "port_1", x: 25.5, y: 48 },
|
||||
{ portName: "port_3", x: 2, y: 4.4 },
|
||||
{ portName: "port_4", x: 2, y: 24.1 },
|
||||
{ portName: "port_2", x: 62, y: 4.4 },
|
||||
{ portName: "port_5", x: 62, y: 24.1 },
|
||||
]);
|
||||
await expect(
|
||||
piston.locator('.port-handle[data-port-name="port_1"]'),
|
||||
).toHaveClass(/react-flow__handle-bottom/);
|
||||
});
|
||||
|
||||
test("AMESim canvas nodes use icon anchors and highlight only compatible free ports", async ({
|
||||
page,
|
||||
}) => {
|
||||
@@ -320,9 +372,9 @@ test("AMESim canvas nodes use icon anchors and highlight only compatible free po
|
||||
];
|
||||
await expectSymbolAnchors(firstOrifice, firstOrificeAnchors);
|
||||
await expectSymbolAnchors(signalOrifice, [
|
||||
{ portName: "res", x: 2, y: 16 },
|
||||
{ portName: "port_2", x: 2, y: 32 },
|
||||
{ portName: "port_3", x: 62, y: 25 },
|
||||
{ portName: "res", x: 26, y: 46 },
|
||||
{ portName: "port_2", x: 2, y: 24 },
|
||||
{ portName: "port_3", x: 62, y: 24 },
|
||||
]);
|
||||
|
||||
await firstOrifice.locator(".node-symbol").click({ position: { x: 56, y: 42 } });
|
||||
@@ -350,6 +402,7 @@ test("AMESim canvas nodes use icon anchors and highlight only compatible free po
|
||||
const signalInput = signalOrifice.locator(
|
||||
'.port-handle[data-port-name="res"]',
|
||||
);
|
||||
await expect(signalInput).toHaveClass(/react-flow__handle-bottom/);
|
||||
const pneumaticInput = signalOrifice.locator(
|
||||
'.port-handle[data-port-name="port_2"]',
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user