前端进度条性能优化、仿真结束后后处理优化;后端C代码生成流程优化:先识别来源,再按照已知未知量需求排序,最后局部求解

This commit is contained in:
ljz committed 2026-09-11 11:27:54 +08:00
1 parent 0dcb465d84
commit 91bd9fb252
77 files changed
+11223 -551

No files matched your search

+24 -37
View File
@@ -1439,7 +1439,6 @@ test("PNCH012 按参考图使用 45% 结构与独立 15px 文字", async ({
test("不同尺寸档位使用紧凑节点框且旋转时保持中心", async ({ page }) => {
await page.goto("/");
await page.getByRole("button", { name: "关闭网格吸附", exact: true }).click();
const paneBounds = await page.locator(".flow-canvas .react-flow__pane").boundingBox();
expect(paneBounds).not.toBeNull();
@@ -1554,41 +1553,26 @@ test("不同尺寸档位使用紧凑节点框且旋转时保持中心", async ({
);
}
await page.getByRole("button", { name: "开启网格吸附", exact: true }).click();
const snappedTarget = { x: 600, y: 610 };
const snappedNode = await dragSymbolToCanvas(
const placedTarget = { x: 601, y: 613 };
const placedNode = await dragSymbolToCanvas(
page,
"amesim_f000",
snappedTarget,
placedTarget,
);
const snappedBounds = await snappedNode.boundingBox();
expect(snappedBounds).not.toBeNull();
const placedBounds = await placedNode.boundingBox();
expect(placedBounds).not.toBeNull();
expect(
Math.abs(
snappedBounds!.x + snappedBounds!.width / 2 -
(paneBounds!.x + snappedTarget.x),
placedBounds!.x + placedBounds!.width / 2 -
(paneBounds!.x + placedTarget.x),
),
).toBeLessThanOrEqual(10);
).toBeLessThan(2);
expect(
Math.abs(
snappedBounds!.y + snappedBounds!.height / 2 -
(paneBounds!.y + snappedTarget.y),
placedBounds!.y + placedBounds!.height / 2 -
(paneBounds!.y + placedTarget.y),
),
).toBeLessThanOrEqual(10);
await expect
.poll(() =>
page.evaluate(() => {
const raw = window.localStorage.getItem(
"system-simulation-flow:autosave",
);
const project = raw ? JSON.parse(raw) : null;
const position = project?.nodes?.at(-1)?.position;
return position
? { xRemainder: position.x % 18, yRemainder: position.y % 18 }
: null;
}),
)
.toEqual({ xRemainder: 0, yRemainder: 0 });
).toBeLessThan(2);
});
test("LMECHN1 按右侧端口数展开工作区画布且组件库图标保持固定", async ({
@@ -1895,7 +1879,6 @@ test("旧版 LMECHN1 工程会把固定参考端口迁移到动态最大编号",
test("LMECHN1 动态参考端口使用实际锚点参与接触吸附", async ({ page }) => {
await page.goto("/");
await page.getByRole("button", { name: "关闭网格吸附", exact: true }).click();
const node = await dragSymbolToCanvas(page, "amesim_lmechn1", {
x: 600,
@@ -2953,8 +2936,8 @@ test("AMESim canvas nodes use icon anchors and highlight only compatible free po
await expectSymbolAnchors(firstOrifice, firstOrificeAnchors);
await expectSymbolAnchors(signalOrifice, [
{ portName: "res", x: 27.35, y: 43.2 },
{ portName: "port_2", x: 12.8, y: 24 },
{ portName: "port_3", x: 51.2, y: 24 },
{ portName: "port_2", x: 51.2, y: 24 },
{ portName: "port_3", x: 12.8, y: 24 },
]);
await firstOrifice.locator('[data-symbol-envelope="true"]').click();
@@ -3143,13 +3126,17 @@ test("AMESim canvas nodes use icon anchors and highlight only compatible free po
await signalOutput.click();
await expect(signalOutput).toHaveAttribute("data-connection-state", "origin");
await clickLocatorCenter(page, firstPhysicalOutput);
await expectNoActivePortConnection(page);
await expect(signalOutput).toHaveAttribute("data-connection-state", "origin");
await expect(manualDraft.locator(".manual-connection-waypoint")).toHaveCount(1);
await expect(page.locator(".flow-canvas .react-flow__edge")).toHaveCount(1);
await expect(firstPhysicalOutput).toHaveAttribute("data-connected", "true");
await expect(compatiblePhysicalPort).toHaveAttribute("data-connected", "true");
await expect(physicalEdge).not.toHaveClass(/selected|editor-edge-selected/);
await clickLocatorCenter(page, compatiblePhysicalPort);
await expect(signalOutput).toHaveAttribute("data-connection-state", "origin");
await expect(manualDraft.locator(".manual-connection-waypoint")).toHaveCount(2);
await page.keyboard.press("Escape");
await expectNoActivePortConnection(page);
await expect(physicalEdge).not.toHaveClass(/selected|editor-edge-selected/);
@@ -3507,7 +3494,6 @@ test("兼容接口接近时吸附为无连线接触连接,拖开后自动断
page,
}) => {
await page.goto("/");
await page.getByRole("button", { name: "关闭网格吸附", exact: true }).click();
const firstOrifice = await dragSymbolToCanvas(page, "amesim_pnor001", {
x: 280,
@@ -3597,11 +3583,16 @@ test("兼容接口接近时吸附为无连线接触连接,拖开后自动断
await unusedPort.click();
await expect(unusedPort).toHaveAttribute("data-connection-state", "origin");
await page.mouse.click(firstPortCenter.x, firstPortCenter.y);
await expectNoActivePortConnection(page);
// 连线模式下点击已连接端口所在元件只确定转角,不取消连线或改选元件。
await expect(unusedPort).toHaveAttribute("data-connection-state", "origin");
await expect(page.locator(".manual-connection-waypoint")).toHaveCount(1);
await expect(contactEdge).not.toHaveClass(/selected|editor-edge-selected/);
await expect(page.locator(".flow-canvas .react-flow__edge")).toHaveCount(1);
await expect(firstPort).toHaveAttribute("data-connected", "true");
await expect(secondPort).toHaveAttribute("data-connected", "true");
await page.keyboard.press("Escape");
await expectNoActivePortConnection(page);
await secondOrifice.locator(".node-symbol").click();
await page.getByRole("button", { name: "生成系统 XML", exact: true }).click();
await expandSimulationConsole(page);
@@ -3658,7 +3649,6 @@ test("PNCH012 四端口接触连接后主体各方向仍可直接选中", async
page,
}) => {
await page.goto("/");
await page.getByRole("button", { name: "关闭网格吸附", exact: true }).click();
const chamber = await dragSymbolToCanvas(page, "amesim_pnch012", {
x: 500,
@@ -3835,7 +3825,6 @@ test("信号输出连接后隐藏且拒绝第二条连接", async ({ page }) =>
test("一次拖动会吸附同一落点内的全部兼容接口", async ({ page }) => {
await page.goto("/");
await page.getByRole("button", { name: "关闭网格吸附", exact: true }).click();
const targetChamber = await dragSymbolToCanvas(page, "amesim_pnch023", {
x: 300,
@@ -3929,7 +3918,6 @@ test("一次拖动会吸附同一落点内的全部兼容接口", async ({ page
test("不同类型接口接近时不会吸附或建立逻辑连接", async ({ page }) => {
await page.goto("/");
await page.getByRole("button", { name: "关闭网格吸附", exact: true }).click();
const orifice = await dragSymbolToCanvas(page, "amesim_pnor001", {
x: 280,
@@ -3966,7 +3954,6 @@ test("不同类型接口接近时不会吸附或建立逻辑连接", async ({ pa
test("旋转后的接口可以与方向不同的兼容接口接触连接", async ({ page }) => {
await page.goto("/");
await page.getByRole("button", { name: "关闭网格吸附", exact: true }).click();
const horizontalOrifice = await dragSymbolToCanvas(page, "amesim_pnor001", {
x: 300,