Updated
This commit is contained in:
@@ -145,3 +145,87 @@ assert(instancesWithoutElements.includes('component_1:'));
|
||||
|
||||
const multiPortComponentPorts = helpers.buildPageComponentPorts(null, elementNodes);
|
||||
assert.deepStrictEqual(multiPortComponentPorts.in0, { x: 10, y: 20, a: 180, width: 0.7 });
|
||||
|
||||
const technologyManifest = {
|
||||
defaults: { xsection: 'strip', width: 0.45, radius: 10, routing_type: 'euler_bend' },
|
||||
xsections: {
|
||||
strip: { family: 'optical', default_width: 0.45 },
|
||||
rib_low: { family: 'optical', default_width: 0.5 },
|
||||
metal_1: { family: 'electrical', default_width: 5 },
|
||||
metal_2: { family: 'electrical', default_width: 6 }
|
||||
},
|
||||
routing_types: ['euler_bend', 'standard_bend']
|
||||
};
|
||||
|
||||
const routeDefaults = helpers.createRouteSettings(technologyManifest);
|
||||
assert.deepStrictEqual(routeDefaults, {
|
||||
xsection: 'strip',
|
||||
family: 'optical',
|
||||
width: 0.45,
|
||||
radius: 10,
|
||||
routing_type: 'euler_bend',
|
||||
widthEdited: false
|
||||
});
|
||||
|
||||
const metalRoute = helpers.updateRouteXsection(routeDefaults, 'metal_1', technologyManifest);
|
||||
assert.strictEqual(metalRoute.family, 'electrical');
|
||||
assert.strictEqual(metalRoute.width, 5);
|
||||
|
||||
const manuallyEditedWidth = helpers.updateRouteField(routeDefaults, 'width', 0.62, technologyManifest);
|
||||
const changedXsection = helpers.updateRouteXsection(manuallyEditedWidth, 'rib_low', technologyManifest);
|
||||
assert.strictEqual(changedXsection.width, 0.62);
|
||||
assert.strictEqual(changedXsection.family, 'optical');
|
||||
|
||||
const styledStrip = helpers.routeStyleForSettings({ xsection: 'strip', family: 'optical' }, false);
|
||||
const styledMetal = helpers.routeStyleForSettings({ xsection: 'metal_1', family: 'electrical' }, true);
|
||||
assert.notStrictEqual(styledStrip.style.stroke, styledMetal.style.stroke);
|
||||
assert(styledMetal.style.strokeDasharray, 'electrical routes should use a visibly different line treatment');
|
||||
assert(styledMetal.style.strokeWidth > styledStrip.style.strokeWidth);
|
||||
|
||||
const routeYaml = helpers.buildBundlesYaml({
|
||||
nodes: [
|
||||
{ id: 'a', data: { componentDisplayName: 'inst_a' } },
|
||||
{ id: 'b', data: { componentDisplayName: 'inst_b' } }
|
||||
],
|
||||
edges: [{
|
||||
id: 'edge-a-b',
|
||||
source: 'a',
|
||||
target: 'b',
|
||||
sourceHandle: 'out',
|
||||
targetHandle: 'in',
|
||||
data: { route: { xsection: 'metal_1', family: 'electrical', width: 5, radius: 20, routing_type: 'standard_bend' } }
|
||||
}]
|
||||
}, technologyManifest);
|
||||
assert(routeYaml.includes('xsection: metal_1'));
|
||||
assert(routeYaml.includes('family: electrical'));
|
||||
assert(routeYaml.includes('radius: 20'));
|
||||
assert(routeYaml.includes('routing_type: standard_bend'));
|
||||
|
||||
const edgeA = {
|
||||
id: 'edge-a-b',
|
||||
source: 'a',
|
||||
target: 'b',
|
||||
data: { route: { family: 'optical' } }
|
||||
};
|
||||
const edgeB = {
|
||||
id: 'edge-c-d',
|
||||
source: 'c',
|
||||
target: 'd',
|
||||
data: { route: { family: 'optical' } }
|
||||
};
|
||||
const edgeC = {
|
||||
id: 'edge-e-f',
|
||||
source: 'e',
|
||||
target: 'f',
|
||||
data: { route: { family: 'electrical' } }
|
||||
};
|
||||
const crossingNodes = {
|
||||
a: { position: { x: 0, y: 0 } },
|
||||
b: { position: { x: 100, y: 100 } },
|
||||
c: { position: { x: 0, y: 100 } },
|
||||
d: { position: { x: 100, y: 0 } },
|
||||
e: { position: { x: 0, y: 100 } },
|
||||
f: { position: { x: 100, y: 0 } }
|
||||
};
|
||||
assert.strictEqual(helpers.findSameFamilyRouteCrossing(edgeB, [edgeA], crossingNodes).conflictEdge.id, 'edge-a-b');
|
||||
assert.strictEqual(helpers.findSameFamilyRouteCrossing(edgeC, [edgeA], crossingNodes), null);
|
||||
|
||||
Reference in New Issue
Block a user