update
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Description: Static and helper regression tests for MXPIC EDA frontend/backend integration contracts.
|
||||
* Inside functions: N/A - assertion-based test/module script.
|
||||
* Developer : Qin Yue @ 2026
|
||||
* Organization : OptiHK Limited
|
||||
*/
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const canvasHtml = fs.readFileSync(path.join(root, 'frontend', 'canvas.html'), 'utf8');
|
||||
|
||||
assert(
|
||||
canvasHtml.includes('buildInstancesYaml'),
|
||||
'canvas.html should use buildInstancesYaml for layout instance export'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('buildCanvasPinsYaml(page.nodes)'),
|
||||
'canvas.html should export pins from active canvas port nodes'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('buildPageComponentPorts(page.port, page.nodes)'),
|
||||
'canvas library entries should expose ports from their page-port data'
|
||||
);
|
||||
assert(
|
||||
!canvasHtml.includes("activePage.nodes.filter(n => n.type === 'rotatableNode' && n.data?.type === 'composite')"),
|
||||
'project layout export should not filter out regular PDK instances'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('Cells: cellEntries') &&
|
||||
canvasHtml.includes('Basic: basicEntries') &&
|
||||
canvasHtml.includes('PDK: library || {}'),
|
||||
'library tree should expose top-level Cells, Basic, and PDK groups'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes("__name__: 'Port'") && canvasHtml.includes("__name__: 'Anchor'"),
|
||||
'Basic folder should expose Port and Anchor as separate virtual components'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('isDirectLeafGrid') &&
|
||||
canvasHtml.includes('childData.__cell__ === true || childData.__element__ === true || childData.__basic__ === true') &&
|
||||
canvasHtml.includes('<div className="category-grid">'),
|
||||
'Cells and Basic folders should bypass category grouping and render direct draggable leaves in a 2D grid'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('element-card-icon port-icon') && canvasHtml.includes('element-card-icon anchor-icon'),
|
||||
'virtual element cards should render distinct generated icons for Port and Anchor'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('const selectedIsVirtualElement = selectedNode?.data?.elementType ==='),
|
||||
'right inspector should classify virtual elements separately from PDK/forge components'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('const canChooseComponent = !selectedIsVirtualElement && availableComponentsFromNode.length > 0;'),
|
||||
'virtual elements should not show PDK or generate_with_forge component selection'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('buildElementsYaml(page.nodes)'),
|
||||
'canvas layout export should include an elements section'
|
||||
);
|
||||
assert(
|
||||
!canvasHtml.includes("activePage.nodes.filter(n => n.selected && n.id !== 'page-port')"),
|
||||
'copy/delete should not exclude port nodes'
|
||||
);
|
||||
Reference in New Issue
Block a user