mirror of https://gitee.com/cf-fz/WebCAD.git
parent
e02e3bde76
commit
afd724b4dd
@ -0,0 +1,25 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`补充bug测试#IKWGF 1`] = `1.1376402440608806`;
|
||||
|
||||
exports[`补充bug测试#IKWGF 2`] = `0.44573816538516137`;
|
||||
|
||||
exports[`补充bug测试#IKWGF 3`] = `10.733056812077686`;
|
||||
|
||||
exports[`补充bug测试#IKWGF 4`] = `12.786755410504352`;
|
||||
|
||||
exports[`补充bug测试#IKWGF 5`] = `0.6246933329215183`;
|
||||
|
||||
exports[`补充bug测试#IKWGF 6`] = `10.586543051841131`;
|
||||
|
||||
exports[`补充bug测试#IKWGF 7`] = `14.066950838248612`;
|
||||
|
||||
exports[`补充bug测试#IKWGF 8`] = `2.16930889523746`;
|
||||
|
||||
exports[`补充bug测试#IKWGF 9`] = `11.890848111457423`;
|
||||
|
||||
exports[`补充bug测试#IKWGF 10`] = `1.0803373815793473`;
|
||||
|
||||
exports[`补充bug测试#IKWGF 11`] = `0.3947454693903588`;
|
||||
|
||||
exports[`补充bug测试#IKWGF 12`] = `10.698715561269278`;
|
@ -0,0 +1,62 @@
|
||||
import { Factory } from "../../src/DatabaseServices/CADFactory";
|
||||
import { CADFile } from "../../src/DatabaseServices/CADFile";
|
||||
import { Curve } from "../../src/DatabaseServices/Curve";
|
||||
import { Polyline } from "../../src/DatabaseServices/Polyline";
|
||||
Factory(Polyline);
|
||||
function loadFile(data)
|
||||
{
|
||||
let file = new CADFile();
|
||||
file.Data = data;
|
||||
let cus: Curve[] = [];
|
||||
let count = file.Read();
|
||||
for (let i = 0; i < count; i++)
|
||||
{
|
||||
cus.push(file.ReadObject(undefined) as Curve);
|
||||
}
|
||||
return cus;
|
||||
}
|
||||
test('补充bug测试#IKWGF', () =>
|
||||
{
|
||||
//https://gitee.com/BearCAD/WebThreeJs/issues/IKWGF
|
||||
let data =
|
||||
[1, ["Polyline", 1, 1, 28, false, 7, -1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1.073087818696886, -6.460623229461753, 0, 1], 2, 13, [2.913294797687863, 5.657009425680781], -0.10216571300036134, [3.0668619767188887, 5.578034682080925], 0, [4.6094463694365295, 5.578034682080925], -2.632498680881094, [4.609446369436524, 3.627167630057804], 0, [2.4566473988439355, 3.627167630057804], 0, [2.4566473988439355, 3.627167630057804], 0, [2.4566473988439355, 4.990312071734102], -0.11795690250598688, [2.37813156168231, 5.1728323699421965], 0, [1.8884393063583844, 5.1728323699421965], 0, [1.8884393063583844, 5.1728323699421965], 0, [1.8884393063583844, 6.15606936416185], 0, [2.913294797687864, 6.15606936416185], 0, [2.913294797687864, 5.657009425680784], 0, false]];
|
||||
|
||||
let pl = loadFile(data)[0];
|
||||
|
||||
//situation 1
|
||||
let cus = pl.GetOffsetCurves(0.3743);
|
||||
expect(cus.length).toBe(3);
|
||||
expect(cus[0].Length).toMatchSnapshot();
|
||||
expect(cus[1].Length).toMatchSnapshot();
|
||||
expect(cus[2].Length).toMatchSnapshot();
|
||||
|
||||
//situation 2
|
||||
cus = pl.GetOffsetCurves(0.3602);
|
||||
expect(cus.length).toBe(1);
|
||||
expect(cus[0].Length).toMatchSnapshot();
|
||||
|
||||
//situation 3
|
||||
cus = pl.GetOffsetCurves(0.4269);
|
||||
expect(cus.length).toBe(2);
|
||||
expect(cus[0].Length).toMatchSnapshot();
|
||||
expect(cus[1].Length).toMatchSnapshot();
|
||||
|
||||
//situation 4
|
||||
cus = pl.GetOffsetCurves(0.2286);
|
||||
expect(cus.length).toBe(1);
|
||||
expect(cus[0].Length).toMatchSnapshot();
|
||||
|
||||
//situation 5
|
||||
cus = pl.GetOffsetCurves(0.2309);
|
||||
expect(cus.length).toBe(2);
|
||||
expect(cus[0].Length).toMatchSnapshot();
|
||||
expect(cus[1].Length).toMatchSnapshot();
|
||||
|
||||
//situation 6
|
||||
cus = pl.GetOffsetCurves(0.3792);
|
||||
expect(cus.length).toBe(3);
|
||||
expect(cus[0].Length).toMatchSnapshot();
|
||||
expect(cus[1].Length).toMatchSnapshot();
|
||||
expect(cus[2].Length).toMatchSnapshot();
|
||||
|
||||
})
|
Loading…
Reference in new issue