You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
WebCAD/__test__/Booloperate/more_sub.test.ts

19 lines
1.0 KiB

import { Contour } from "../../src/DatabaseServices/Contour";
import { Polyline } from "../../src/DatabaseServices/Entity/Polyline";
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
test('多个布尔错误', () =>
{
let d =
[2, "Polyline", 8, 2, 0, false, 0, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 142, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 2, 8, [942, -142], 0, [942, 202], 0, [430, 202], 0, [430.0000000000002, 18], 0, [430.0000000000002, 18], 0, [430.0000000000002, 0], 0, [0, 0], 0, [0, -142], 0, true, "Polyline", 8, 2, 0, false, 0, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 142, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 142, 0, 1], 0, 2, 4, [0, 0], 0, [698, 0], 0, [698, 18], 0, [0, 18], 0, true];
let pls = LoadEntityFromFileData(d) as Polyline[];
let cons = pls.map(pl => Contour.CreateContour(pl));
let res = cons[0].GetSubtractListByMoreTargets(cons.slice(1));
expect(res.outlines.length).toBe(1);
expect(res.holes.length).toBe(0);
});