Routing problem for multi-pin port and anchors are debugged
This commit is contained in:
@@ -16,8 +16,8 @@ assert(
|
||||
'canvas.html should use buildInstancesYaml for layout instance export'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('buildCanvasPortsYaml(page.nodes)'),
|
||||
'canvas.html should export ports from active canvas port nodes'
|
||||
canvasHtml.includes('buildCanvasPinsYaml(page.nodes)'),
|
||||
'canvas.html should export pins from active canvas port nodes'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('buildPageComponentPorts(page.port, page.nodes)'),
|
||||
|
||||
+147
-14
@@ -24,8 +24,12 @@ assert.deepStrictEqual(handles.filter(handle => handle.position === 'right').map
|
||||
assert.deepStrictEqual(handles.find(handle => handle.name === 'ep2b').position, 'top');
|
||||
assert.deepStrictEqual(handles.find(handle => handle.name === 'ep2a').position, 'bottom');
|
||||
assert.strictEqual(handles.find(handle => handle.name === 'a1').style.top, '15%');
|
||||
assert.strictEqual(handles.find(handle => handle.name === 'a1').style.left, 0);
|
||||
assert.strictEqual(handles.find(handle => handle.name === 'a2').style.top, '85%');
|
||||
assert.strictEqual(handles.find(handle => handle.name === 'b1').style.left, '100%');
|
||||
assert.strictEqual(handles.find(handle => handle.name === 'ep2b').style.left, '50%');
|
||||
assert.strictEqual(handles.find(handle => handle.name === 'ep2b').style.top, 0);
|
||||
assert.strictEqual(handles.find(handle => handle.name === 'ep2a').style.top, '100%');
|
||||
|
||||
const uniformLeftHandles = helpers.buildPortHandles({
|
||||
p_top: { x: -10, y: 300, a: 180 },
|
||||
@@ -37,6 +41,46 @@ assert.deepStrictEqual(
|
||||
['15%', '50%', '85%'],
|
||||
'ports on the same side should be uniformly spaced after sorting'
|
||||
);
|
||||
const exactCenteredHandles = helpers.buildPortHandles({
|
||||
a1: { x: -91.7, y: 4.475, a: 180 },
|
||||
a2: { x: -91.7, y: -4.475, a: 180 },
|
||||
b1: { x: 91.7, y: 4.475, a: 0 },
|
||||
b2: { x: 91.7, y: -4.475, a: 0 },
|
||||
}, { boxSize: { width: 183.4, height: 29.65 } });
|
||||
assert.strictEqual(
|
||||
exactCenteredHandles.find(handle => handle.name === 'a1').style.top,
|
||||
'34.907%',
|
||||
'box_size-aware handles should use exact centered PDK y coordinates instead of uniform spacing'
|
||||
);
|
||||
assert.strictEqual(exactCenteredHandles.find(handle => handle.name === 'a2').style.top, '65.093%');
|
||||
assert.strictEqual(exactCenteredHandles.find(handle => handle.name === 'b1').style.left, '100%');
|
||||
const exactPositiveHandles = helpers.buildPortHandles({
|
||||
a1: { x: 0, y: 10, a: 180 },
|
||||
b1: { x: 150.4, y: 10, a: 0 },
|
||||
a2: { x: 0, y: -10, a: 180 },
|
||||
b2: { x: 150.4, y: -10, a: 0 },
|
||||
}, { boxSize: { width: 150.4, height: 40 } });
|
||||
assert.strictEqual(exactPositiveHandles.find(handle => handle.name === 'a1').style.top, '25%');
|
||||
assert.strictEqual(exactPositiveHandles.find(handle => handle.name === 'a2').style.top, '75%');
|
||||
const exactPortObjectHandles = helpers.buildPortHandles({
|
||||
port_1: { x: 0, y: 10, a: 0 },
|
||||
port_2: { x: 0, y: 0, a: 0 },
|
||||
port_3: { x: 0, y: -10, a: 0 },
|
||||
}, { boxSize: { width: 47, height: 58 } });
|
||||
assert.deepStrictEqual(
|
||||
exactPortObjectHandles.map(handle => handle.style.top),
|
||||
['32.759%', '50%', '67.241%'],
|
||||
'standalone Port handles should use their actual y offsets inside the Port body'
|
||||
);
|
||||
const exactAnchorHandles = helpers.buildPortHandles(
|
||||
helpers.buildElementPorts('anchor', { portNumber: 3, pitch: 10 }),
|
||||
{ boxSize: { width: 16, height: 58 } }
|
||||
);
|
||||
assert.deepStrictEqual(
|
||||
exactAnchorHandles.filter(handle => handle.name.startsWith('a')).map(handle => handle.style.top),
|
||||
['32.759%', '50%', '67.241%'],
|
||||
'standalone Anchor handles should be centered around the Anchor body'
|
||||
);
|
||||
|
||||
assert.deepStrictEqual(
|
||||
helpers.normalizeBoxSize({ box_size: [946, 75] }),
|
||||
@@ -168,6 +212,34 @@ assert.strictEqual(
|
||||
'bottom',
|
||||
'rotating a component should rotate vertical port handle sides'
|
||||
);
|
||||
const quarterTurnHandles = helpers.buildPortHandles({
|
||||
out: { x: 50, y: 0, a: 0 },
|
||||
up: { x: 0, y: 20, a: 90 },
|
||||
}, { rotation: 90 });
|
||||
assert.strictEqual(
|
||||
quarterTurnHandles.find(handle => handle.name === 'out').position,
|
||||
'bottom',
|
||||
'90 degree canvas rotation should move a right-facing port direction to the bottom side'
|
||||
);
|
||||
assert.strictEqual(
|
||||
quarterTurnHandles.find(handle => handle.name === 'up').position,
|
||||
'right',
|
||||
'90 degree canvas rotation should move a top-facing port direction to the right side'
|
||||
);
|
||||
const negativeQuarterTurnHandles = helpers.buildPortHandles({
|
||||
out: { x: 50, y: 0, a: 0 },
|
||||
down: { x: 0, y: -20, a: -90 },
|
||||
}, { rotation: -90 });
|
||||
assert.strictEqual(
|
||||
negativeQuarterTurnHandles.find(handle => handle.name === 'out').position,
|
||||
'top',
|
||||
'-90 degree canvas rotation should move a right-facing port direction to the top side'
|
||||
);
|
||||
assert.strictEqual(
|
||||
negativeQuarterTurnHandles.find(handle => handle.name === 'down').position,
|
||||
'right',
|
||||
'-90 degree canvas rotation should move a bottom-facing port direction to the right side'
|
||||
);
|
||||
|
||||
const args = helpers.createForgeArguments();
|
||||
assert(Object.keys(args).length >= 10);
|
||||
@@ -230,8 +302,10 @@ assert.deepStrictEqual(
|
||||
const ninetyBendHandles = helpers.buildPortHandles(helpers.buildBasicComponentPorts('90 bend', { radius: 15 }));
|
||||
assert.strictEqual(ninetyBendHandles.find(handle => handle.name === 'a1').position, 'left');
|
||||
assert.strictEqual(ninetyBendHandles.find(handle => handle.name === 'a1').style.top, '50%');
|
||||
assert.strictEqual(ninetyBendHandles.find(handle => handle.name === 'a1').style.left, 0);
|
||||
assert.strictEqual(ninetyBendHandles.find(handle => handle.name === 'b1').position, 'top');
|
||||
assert.strictEqual(ninetyBendHandles.find(handle => handle.name === 'b1').style.left, '50%');
|
||||
assert.strictEqual(ninetyBendHandles.find(handle => handle.name === 'b1').style.top, 0);
|
||||
assert.deepStrictEqual(
|
||||
helpers.getBasicComponentMetadata('180 bend', { radius: 15 }).box_size,
|
||||
[25, 50],
|
||||
@@ -318,14 +392,17 @@ assert(projectInstancesYaml.includes('cell_1:'));
|
||||
assert(projectInstancesYaml.includes('component: canvas_1'));
|
||||
|
||||
const pagePortsYaml = helpers.buildPortsYaml({ x: 50, y: 150, a: 90 });
|
||||
assert(pagePortsYaml.includes('- name: port'));
|
||||
assert(pagePortsYaml.includes('pins:'));
|
||||
assert(!pagePortsYaml.includes('ports:'));
|
||||
assert(pagePortsYaml.includes('- name: port_io1'));
|
||||
assert(pagePortsYaml.includes('pin: io1'));
|
||||
assert(pagePortsYaml.includes('x: 50.0'));
|
||||
assert(pagePortsYaml.includes('y: -150.0'));
|
||||
assert(pagePortsYaml.includes('angle: -90.0'));
|
||||
|
||||
const componentPorts = helpers.buildPageComponentPorts({ x: 12, y: -6, a: 180 });
|
||||
assert.deepStrictEqual(componentPorts, {
|
||||
port: { x: 12, y: -6, a: 0, width: 0.5 }
|
||||
port_io1: { element: 'port', pin: 'io1', x: 12, y: -6, a: 0, width: 0.5 }
|
||||
});
|
||||
|
||||
const elementNodes = [
|
||||
@@ -373,8 +450,9 @@ assert.deepStrictEqual(Object.keys(helpers.buildElementPorts('port', { portNumbe
|
||||
assert.deepStrictEqual(helpers.buildElementPorts('port', { portNumber: 3, pitch: 10 }).port_1, { x: 0, y: 10, a: 0, width: 0.5 });
|
||||
assert.deepStrictEqual(helpers.buildElementPorts('port', { portNumber: 3 }).port_1, { x: 0, y: 10, a: 0, width: 0.5 });
|
||||
assert.deepStrictEqual(Object.keys(helpers.buildElementPorts('anchor', { portNumber: 2, pitch: 12 })), ['a1', 'b1', 'a2', 'b2']);
|
||||
assert.deepStrictEqual(helpers.buildElementPorts('anchor', { portNumber: 2, pitch: 12 }).b2, { x: 0, y: -21, a: 0, width: 0.5 });
|
||||
assert.deepStrictEqual(helpers.buildElementPorts('anchor', { portNumber: 2, pitch: 12 }).a2, { x: 0, y: -21, a: 180, width: 0.5 });
|
||||
assert.deepStrictEqual(helpers.buildElementPorts('anchor', { portNumber: 2, pitch: 12 }).a1, { x: 0, y: 6, a: 180, width: 0.5 });
|
||||
assert.deepStrictEqual(helpers.buildElementPorts('anchor', { portNumber: 2, pitch: 12 }).b2, { x: 0, y: -6, a: 0, width: 0.5 });
|
||||
assert.deepStrictEqual(helpers.buildElementPorts('anchor', { portNumber: 2, pitch: 12 }).a2, { x: 0, y: -6, a: 180, width: 0.5 });
|
||||
assert.deepStrictEqual(
|
||||
helpers.getNodePortCanvasPoint({
|
||||
id: 'anchor-rotated',
|
||||
@@ -391,10 +469,31 @@ assert.deepStrictEqual(
|
||||
{ x: 115, y: 200 },
|
||||
'Anchor port endpoint coordinates should rotate with the anchor body'
|
||||
);
|
||||
assert.deepStrictEqual(helpers.buildElementBoxSize({ portNumber: 1 }), { width: 30, height: 30 });
|
||||
assert.deepStrictEqual(helpers.buildElementBoxSize({ elementType: 'anchor', portNumber: 1 }), { width: 8, height: 30 });
|
||||
assert.deepStrictEqual(helpers.buildElementBoxSize({ elementType: 'anchor', portNumber: 4, pitch: 10 }), { width: 8, height: 72 });
|
||||
assert.deepStrictEqual(helpers.buildElementBoxSize({ portNumber: 4, pitch: 10 }), { width: 30, height: 72 });
|
||||
assert.deepStrictEqual(
|
||||
helpers.getNodePortCanvasPoint({
|
||||
id: 'port-rotated',
|
||||
type: 'portNode',
|
||||
position: { x: 100, y: 200 },
|
||||
data: {
|
||||
elementType: 'port',
|
||||
angle: 180,
|
||||
portNumber: 3,
|
||||
pitch: 10,
|
||||
ports: helpers.buildElementPorts('port', { angle: 180, portNumber: 3, pitch: 10 })
|
||||
}
|
||||
}, 'port_1'),
|
||||
{ x: 100, y: 210 },
|
||||
'Port pin endpoint coordinates should rotate with the Port body'
|
||||
);
|
||||
assert.deepStrictEqual(helpers.buildElementBoxSize({ portNumber: 1 }), { width: 47, height: 30 });
|
||||
assert.deepStrictEqual(helpers.buildElementBoxSize({ elementType: 'anchor', portNumber: 1 }), { width: 16, height: 30 });
|
||||
assert.deepStrictEqual(helpers.buildElementBoxSize({ elementType: 'anchor', portNumber: 4, pitch: 10 }), { width: 16, height: 72 });
|
||||
assert.deepStrictEqual(helpers.buildElementBoxSize({ portNumber: 4, pitch: 10 }), { width: 47, height: 72 });
|
||||
assert.deepStrictEqual(
|
||||
helpers.buildElementBoxSize({ elementType: 'port', portName: 'input_port' }),
|
||||
{ width: 82, height: 30 },
|
||||
'Port object width should grow to fit the displayed port instance name'
|
||||
);
|
||||
assert.deepStrictEqual(
|
||||
helpers.buildPageComponentPorts(null, [{
|
||||
id: 'port-array',
|
||||
@@ -403,14 +502,44 @@ assert.deepStrictEqual(
|
||||
data: { componentDisplayName: 'array', elementType: 'port', portNumber: 3, pitch: 10, width: 0.6 }
|
||||
}]),
|
||||
{
|
||||
array_1: { x: 100, y: 190, a: 180, width: 0.6 },
|
||||
array_2: { x: 100, y: 200, a: 180, width: 0.6 },
|
||||
array_3: { x: 100, y: 210, a: 180, width: 0.6 }
|
||||
array_io1: { element: 'array', pin: 'io1', x: 100, y: 190, a: 180, width: 0.6 },
|
||||
array_io2: { element: 'array', pin: 'io2', x: 100, y: 200, a: 180, width: 0.6 },
|
||||
array_io3: { element: 'array', pin: 'io3', x: 100, y: 210, a: 180, width: 0.6 }
|
||||
}
|
||||
);
|
||||
assert.deepStrictEqual(
|
||||
helpers.buildPageComponentPorts(null, [{
|
||||
id: 'port-array-rotated-90',
|
||||
type: 'portNode',
|
||||
position: { x: 100, y: 200 },
|
||||
data: { componentDisplayName: 'array', elementType: 'port', angle: 90, portNumber: 2, pitch: 10, width: 0.6 }
|
||||
}]),
|
||||
{
|
||||
array_io1: { element: 'array', pin: 'io1', x: 95, y: 200, a: -90, width: 0.6 },
|
||||
array_io2: { element: 'array', pin: 'io2', x: 105, y: 200, a: -90, width: 0.6 }
|
||||
}
|
||||
);
|
||||
assert.deepStrictEqual(
|
||||
helpers.buildPageComponentPorts(null, [{
|
||||
id: 'port-array-rotated',
|
||||
type: 'portNode',
|
||||
position: { x: 100, y: 200 },
|
||||
data: { componentDisplayName: 'array', elementType: 'port', angle: 180, portNumber: 3, pitch: 10, width: 0.6 }
|
||||
}]),
|
||||
{
|
||||
array_io1: { element: 'array', pin: 'io1', x: 100, y: 210, a: 0, width: 0.6 },
|
||||
array_io2: { element: 'array', pin: 'io2', x: 100, y: 200, a: 0, width: 0.6 },
|
||||
array_io3: { element: 'array', pin: 'io3', x: 100, y: 190, a: 0, width: 0.6 }
|
||||
},
|
||||
'Rotated Port object pins should export rotated coordinates along with their rotated angle'
|
||||
);
|
||||
|
||||
const canvasPortsYaml = helpers.buildCanvasPortsYaml(elementNodes);
|
||||
assert(canvasPortsYaml.includes('name: in0'));
|
||||
assert(canvasPortsYaml.includes('pins:'));
|
||||
assert(!canvasPortsYaml.includes('ports:'));
|
||||
assert(canvasPortsYaml.includes('name: in0_io1'));
|
||||
assert(canvasPortsYaml.includes('element: in0'));
|
||||
assert(canvasPortsYaml.includes('pin: io1'));
|
||||
assert(canvasPortsYaml.includes('description: "input port"'));
|
||||
assert(canvasPortsYaml.includes('width: 0.7'));
|
||||
assert(canvasPortsYaml.includes('y: -20.0'));
|
||||
@@ -422,7 +551,11 @@ assert(elementsYaml.includes('type: port'));
|
||||
assert(elementsYaml.includes('anchor_1:'));
|
||||
assert(elementsYaml.includes('type: anchor'));
|
||||
assert(elementsYaml.includes('y: -20.0'));
|
||||
assert(elementsYaml.includes('port_number: 1'));
|
||||
assert(elementsYaml.includes('pin_number: 1'));
|
||||
assert(elementsYaml.includes('name: in0_io1'));
|
||||
assert(elementsYaml.includes('role: io1'));
|
||||
assert(elementsYaml.includes('name: anchor_1_a1'));
|
||||
assert(elementsYaml.includes('role: a1'));
|
||||
assert(elementsYaml.includes('pitch: 10'));
|
||||
|
||||
const instancesWithoutElements = helpers.buildInstancesYaml({
|
||||
@@ -435,7 +568,7 @@ assert(instancesWithoutElements.includes('component_1:'));
|
||||
assert(instancesWithoutElements.includes('y: -60.0'));
|
||||
|
||||
const multiPortComponentPorts = helpers.buildPageComponentPorts(null, elementNodes);
|
||||
assert.deepStrictEqual(multiPortComponentPorts.in0, { x: 10, y: 20, a: 0, width: 0.7 });
|
||||
assert.deepStrictEqual(multiPortComponentPorts.in0_io1, { element: 'in0', pin: 'io1', x: 10, y: 20, a: 0, width: 0.7 });
|
||||
|
||||
const technologyManifest = {
|
||||
defaults: { xsection: 'strip', width: 0.45, radius: 10, routing_type: 'euler_bend' },
|
||||
|
||||
@@ -90,22 +90,41 @@ assert(
|
||||
gdsBuilderPy.includes('_cells_have_links') && gdsBuilderPy.includes('Routed Build GDS requires mxpic_router'),
|
||||
'Build GDS should not silently fall back to unrouted gdstk when links are present'
|
||||
);
|
||||
assert(
|
||||
gdsBuilderPy.includes('_cells_have_elements') &&
|
||||
gdsBuilderPy.includes('Build GDS with Port/Anchor elements requires Nazca') &&
|
||||
gdsBuilderPy.indexOf('if _cells_have_elements(cells):') < gdsBuilderPy.indexOf('return _build_with_gdstk'),
|
||||
'Build GDS should route layouts with Port/Anchor elements through Nazca so element pins survive as cell metadata'
|
||||
);
|
||||
assert(
|
||||
gdsBuilderPy.includes('_build_nazca_element_cells') &&
|
||||
gdsBuilderPy.includes('_build_nazca_element_cell') &&
|
||||
gdsBuilderPy.includes('element.get("pin_number"') &&
|
||||
gdsBuilderPy.includes('_element_pin_names') &&
|
||||
gdsBuilderPy.includes('nd.Pin(pin_name, width=width).put(0.0, y, 180.0)') &&
|
||||
gdsBuilderPy.includes('nd.Pin(anchor_pin_names[index * 2], width=width).put(0.0, y, 180.0)') &&
|
||||
gdsBuilderPy.includes('nd.Pin(anchor_pin_names[index * 2 + 1], width=width).put(0.0, y, 0.0)') &&
|
||||
gdsBuilderPy.includes('element_cell.put(x, y, rotation)'),
|
||||
'Nazca fallback should model Port and Anchor objects as placed element cells with named local nd.Pin definitions'
|
||||
);
|
||||
|
||||
const routerDir = path.resolve(root, '..', 'mxpic_router', 'mxpic_router');
|
||||
if (fs.existsSync(routerDir)) {
|
||||
const routerLoaderPy = fs.readFileSync(path.join(routerDir, 'eda_loader.py'), 'utf8');
|
||||
const routerBuilderPy = fs.readFileSync(path.join(routerDir, 'builder.py'), 'utf8');
|
||||
assert(
|
||||
routerLoaderPy.includes('port_number: int = 1') &&
|
||||
routerLoaderPy.includes('pins: Dict[str, PinSpec]') &&
|
||||
routerLoaderPy.includes('pin_number') &&
|
||||
routerLoaderPy.includes('pitch: float = 10.0') &&
|
||||
routerLoaderPy.includes('port_number=_int(element.get("port_number"'),
|
||||
'mxpic_router loader should parse multi-port anchor metadata from exported elements'
|
||||
routerLoaderPy.includes('pins=_pins(element.get("pins"))'),
|
||||
'mxpic_router loader should parse pins-only layout metadata from exported elements'
|
||||
);
|
||||
assert(
|
||||
routerBuilderPy.includes('for index in range(port_number):') &&
|
||||
routerBuilderPy.includes('a{index + 1}') &&
|
||||
routerBuilderPy.includes('b{index + 1}'),
|
||||
'mxpic_router builder should register aN/bN pins for multi-port anchors'
|
||||
routerBuilderPy.includes('_port_element_pin_entries') &&
|
||||
routerBuilderPy.includes('_anchor_element_pin_entries') &&
|
||||
routerBuilderPy.includes('_metadata_pins') &&
|
||||
routerBuilderPy.includes('link.src_pin'),
|
||||
'mxpic_router builder should register named element pins and route through pin endpoints'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -213,21 +213,20 @@ assert(
|
||||
canvasHtml.includes('const anchorRotation = data.rotation || 0') &&
|
||||
canvasHtml.includes('const anchorVisualRotation = -Number(anchorRotation || 0)') &&
|
||||
canvasHtml.includes('transform: `rotate(${anchorVisualRotation}deg)`') &&
|
||||
canvasHtml.includes('buildPortHandles(localAnchorHandlePorts, { rotation: 0') &&
|
||||
canvasHtml.includes('buildPortHandles(localAnchorHandlePorts, { rotation: 0, boxSize: elementSize') &&
|
||||
canvasHtml.includes('anchorDirectionHandles') &&
|
||||
canvasHtml.includes('rotation: Number(anchorRotation || 0)') &&
|
||||
canvasHtml.includes('rotation: -Number(anchorRotation || 0)') &&
|
||||
canvasHtml.includes('anchorHandleVisualStyle(portHandle') &&
|
||||
canvasHtml.includes('anchorPortVisualSide') &&
|
||||
canvasHtml.includes('portHandle.name') &&
|
||||
canvasHtml.includes('visualSide === \'left\' ? 0 : elementSize.width') &&
|
||||
canvasHtml.includes('anchorPortVisualTop') &&
|
||||
canvasHtml.includes('(index - 1) / (portCount - 1)') &&
|
||||
canvasHtml.includes('elementSize.height - baseHandleStyle.height') &&
|
||||
canvasHtml.includes('transform: \'translate(-50%, -50%)\'') &&
|
||||
canvasHtml.includes("portHandle.style?.top || '50%'") &&
|
||||
canvasHtml.includes('localLeft') &&
|
||||
canvasHtml.includes('localTop') &&
|
||||
canvasHtml.includes('handlePositionMap[anchorDirectionHandles.get(portHandle.name) || portHandle.position]') &&
|
||||
canvasHtml.includes('getAnchorHandleRouteDirection') &&
|
||||
canvasHtml.includes('rotation: Number(node.data?.rotation || 0)') &&
|
||||
canvasHtml.includes('rotation: -Number(node.data?.rotation || 0)') &&
|
||||
canvasHtml.includes('directionToReactFlowPosition') &&
|
||||
canvasHtml.includes('sourcePosition: directionToReactFlowPosition(sourceDirection)') &&
|
||||
canvasHtml.includes('targetPosition: directionToReactFlowPosition(targetDirection)') &&
|
||||
@@ -282,6 +281,16 @@ assert(
|
||||
canvasHtml.includes('component-floating-label') && canvasHtml.includes('component-visual-body'),
|
||||
'component labels should float outside the rotated body'
|
||||
);
|
||||
assert(
|
||||
!canvasHtml.includes('const visualPortHandles = useMemo(') &&
|
||||
canvasHtml.includes('buildPortHandles(data.ports, { rotation: data.rotation || 0, flip: Boolean(data.flip), flop: Boolean(data.flop), boxSize: componentSize })') &&
|
||||
canvasHtml.includes('const portDirectionMap = useMemo(') &&
|
||||
canvasHtml.includes('position: \'absolute\', inset: 0') &&
|
||||
canvasHtml.includes('pointerEvents: \'none\'') &&
|
||||
canvasHtml.includes('pointerEvents: \'all\'') &&
|
||||
canvasHtml.includes('handlePositionMap[portDirectionMap.get(portHandle.name) || portHandle.position]'),
|
||||
'component port circles should use transformed pin positions so rendered sides follow pin angles'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('canvasTextVisible') &&
|
||||
canvasHtml.includes('toggleCanvasText') &&
|
||||
@@ -353,11 +362,26 @@ assert(
|
||||
assert(
|
||||
canvasHtml.includes('Ruler') &&
|
||||
canvasHtml.includes('rulerMode') &&
|
||||
canvasHtml.includes('onPaneClick={handleRulerPaneClick}') &&
|
||||
canvasHtml.includes('onNodeClick={handleRulerPaneClick}') &&
|
||||
canvasHtml.includes('onPaneMouseMove={handleRulerMouseMove}'),
|
||||
canvasHtml.includes('onPaneClick={handleCanvasPaneClick}') &&
|
||||
canvasHtml.includes('onNodeClick={handleCanvasNodeClick}') &&
|
||||
canvasHtml.includes('onPaneMouseMove={handleCanvasMouseMove}'),
|
||||
'canvas should expose a ruler mode controlled from the top toolbar, allow measuring on component bodies, and preview to the mouse'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('mouseCanvasPoint') &&
|
||||
canvasHtml.includes('canvasOrigin') &&
|
||||
canvasHtml.includes('originPickMode') &&
|
||||
canvasHtml.includes('displayMousePoint') &&
|
||||
canvasHtml.includes('toggleOriginPickMode') &&
|
||||
canvasHtml.includes('onMouseMoveCapture={handleCanvasMouseMove}') &&
|
||||
canvasHtml.includes('handleCanvasPaneClick') &&
|
||||
canvasHtml.includes('handleCanvasNodeClick') &&
|
||||
canvasHtml.includes('origin-select-btn') &&
|
||||
canvasHtml.includes('Select canvas origin') &&
|
||||
canvasHtml.includes('className="coordinate-readout"') &&
|
||||
canvasHtml.includes('className="origin-crosshair"'),
|
||||
'canvas should show live mouse coordinates and support one-click origin selection with a crosshair preview'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('createRulerMeasurement') &&
|
||||
canvasHtml.includes('rulerPointNode') &&
|
||||
@@ -442,11 +466,42 @@ assert(
|
||||
canvasHtml.includes('font-size: 0.4rem;') &&
|
||||
canvasHtml.includes('font-size: 0.32rem;') &&
|
||||
canvasHtml.includes("font: 600 0.5rem/1.35") &&
|
||||
canvasHtml.includes('width: 8, height: 8') &&
|
||||
canvasHtml.includes('width: 6,') &&
|
||||
canvasHtml.includes('width: 6, height: 6') &&
|
||||
canvasHtml.includes("border: '1px solid var(--accent)'") &&
|
||||
canvasHtml.includes('width: 5,') &&
|
||||
canvasHtml.includes('fontSize: 8'),
|
||||
'canvas labels and port circles should render smaller than the previous sizing'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('const portDisplayName = data.portName || data.componentDisplayName || data.label || \'port\';') &&
|
||||
canvasHtml.includes('const canvasAngle = -Number(angle || 0);') &&
|
||||
canvasHtml.includes('const pinLabelFromPortName =') &&
|
||||
canvasHtml.includes('buildPortHandles(localHandlePorts, { rotation: canvasAngle })') &&
|
||||
canvasHtml.includes('buildPortHandles(localHandlePorts, { rotation: 0, boxSize: elementSize })') &&
|
||||
canvasHtml.includes('style={{ ...baseHandleStyle, ...portHandle.style }}') &&
|
||||
canvasHtml.includes('borderRadius: 7') &&
|
||||
canvasHtml.includes('boxSizing: \'border-box\'') &&
|
||||
canvasHtml.includes('width: elementSize.width, height: elementSize.height, position: \'relative\'') &&
|
||||
canvasHtml.includes('className="component-floating-label"') &&
|
||||
canvasHtml.includes('className="port-pin-label"') &&
|
||||
canvasHtml.includes('pinLabelFromPortName(portHandle.name)') &&
|
||||
canvasHtml.includes('pinLabelStyle(portHandle') &&
|
||||
canvasHtml.includes('transform: `rotate(${canvasAngle}deg) scaleX(${data.flop ? -1 : 1}) scaleY(${data.flip ? -1 : 1})`') &&
|
||||
canvasHtml.includes('{portDisplayName}'),
|
||||
'standalone Port nodes should render pin labels at their circles while the port instance name floats outside the rotated body'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('const anchorDisplayName = data.componentDisplayName || data.label || \'anchor\';') &&
|
||||
canvasHtml.includes('className="anchor-node-shell"') &&
|
||||
canvasHtml.includes('className="anchor-visual-body"') &&
|
||||
canvasHtml.includes("const localLeft = visualSide === 'left' ? 0 : elementSize.width") &&
|
||||
canvasHtml.includes("transform: 'translate(-50%, -50%)'") &&
|
||||
canvasHtml.includes('pinLabelFromPortName(portHandle.name)') &&
|
||||
canvasHtml.includes('pinLabelStyle(portHandle') &&
|
||||
canvasHtml.includes('className="port-pin-label"') &&
|
||||
canvasHtml.includes('{anchorDisplayName}'),
|
||||
'standalone Anchor nodes should use the same outside name label and per-pin labels as Port nodes'
|
||||
);
|
||||
assert(
|
||||
canvasHtml.includes('ParallelRouteEdge') &&
|
||||
canvasHtml.includes('parallelOffset') &&
|
||||
|
||||
Reference in New Issue
Block a user