mirror of https://gitee.com/cf-fz/WebCAD.git
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.
104 lines
4.8 KiB
104 lines
4.8 KiB
import { Vector3 } from "three";
|
|
import { DrawObliqueWineRackTool } from "../../src/Add-on/DrawWineRack/DrawObliqueWineRackTool";
|
|
import { DrawUprightWineRackTool } from "../../src/Add-on/DrawWineRack/DrawUprightWineRackTool";
|
|
import { Board } from "../../src/DatabaseServices/Entity/Board";
|
|
import { Box3Ext } from "../../src/Geometry/Box";
|
|
import { ISpaceParse } from "../../src/Geometry/SpaceParse/ISpaceParse";
|
|
import { EFullDir, EFullType, EWineRackStyle, EWineRackType, EWRackArrayType, IWineRackOption } from "../../src/UI/Store/WineRackInterface";
|
|
import "../Utils/jest.util";
|
|
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
|
|
const UprightTool = DrawUprightWineRackTool.GetInstance();
|
|
const ObliqueTool = DrawObliqueWineRackTool.GetInstance();
|
|
|
|
const option: IWineRackOption = {
|
|
type: EWineRackType.Oblique,
|
|
wineRackStyle: EWineRackStyle.WholeLattice,
|
|
arrayType: EWRackArrayType.ByWidth,
|
|
fullType: EFullType.ByWidth,
|
|
isFull: false,
|
|
isLock: false,
|
|
fullDir: EFullDir.Left,
|
|
heightCount: 3.5,
|
|
widthCount: 3.5,
|
|
isTotalDepth: true,
|
|
depth: 0,
|
|
gripWidth: 100,
|
|
calcDepth: "W",
|
|
boardThick: 18,
|
|
grooveWidthAdd: 0,
|
|
leftEdge: 1,
|
|
rightEdge: 1,
|
|
topEdge: 1,
|
|
bottomEdge: 1,
|
|
frontCut: 0,
|
|
leftCut: 0,
|
|
rightCut: 0,
|
|
topCut: 0,
|
|
grooveLengthAdd: 3,
|
|
isDrawLy: false,
|
|
isDrawVer: false,
|
|
brThick2: 18,
|
|
isExtendsBH2: false,
|
|
followNarrow: false,
|
|
};
|
|
|
|
describe("酒格功能测试", () =>
|
|
{
|
|
test("斜酒格1", () =>
|
|
{
|
|
let data =
|
|
[2, "Board", 5, 2, 102, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 580.3050847457629, -214.2857142857143, 0, 1], 0, 0, 2, 2000, 600, 18, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [0, 0], 0, [600, 0], 0, [600, 2000], 0, [0, 2000], 0, true, 0, 3, 0, 0, 0, 4, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 580.3050847457629, -214.2857142857143, 0, 1], 1, "右侧板", "主卧", "下柜", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, "Board", 5, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -601.6949152542372, -214.2857142857143, 0, 1], 0, 0, 2, 2000, 600, 18, true, "Polyline", 5, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 2, 4, [0, 0], 0, [600, 0], 0, [600, 2000], 0, [0, 2000], 0, true, 0, 3, 0, 0, 0, 4, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -601.6949152542372, -214.2857142857143, 0, 1], 1, "左侧板", "主卧", "下柜", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0];
|
|
|
|
let spaceParse = new ISpaceParse();
|
|
spaceParse.Boards = LoadEntityFromFileData(data) as Board[];
|
|
spaceParse.SpaceBox = new Box3Ext(new Vector3(), new Vector3(1200, 600, 2000));
|
|
spaceParse.Parse();
|
|
UprightTool.Parse(spaceParse, option);
|
|
ObliqueTool.Parse(spaceParse, option);
|
|
expect(UprightTool.boardlist.length).toMatchSnapshot();
|
|
for (let br of UprightTool.boardlist)
|
|
{
|
|
expect(br.Position.x).toMatchNumberSnapshot(3);
|
|
expect(br.Position.y).toMatchNumberSnapshot(3);
|
|
expect(br.Position.z).toMatchNumberSnapshot(3);
|
|
|
|
expect(br.Height).toMatchNumberSnapshot(3);
|
|
expect(br.Width).toMatchNumberSnapshot(3);
|
|
}
|
|
expect(ObliqueTool.boardlist.length).toMatchSnapshot();
|
|
for (let br of ObliqueTool.boardlist)
|
|
{
|
|
expect(br.Position.x).toMatchNumberSnapshot(3);
|
|
expect(br.Position.y).toMatchNumberSnapshot(3);
|
|
expect(br.Position.z).toMatchNumberSnapshot(3);
|
|
|
|
expect(br.Height).toMatchNumberSnapshot(3);
|
|
expect(br.Width).toMatchNumberSnapshot(3);
|
|
}
|
|
|
|
option.wineRackStyle = EWineRackStyle.WholeLattice;
|
|
UprightTool.Parse(spaceParse, option);
|
|
ObliqueTool.Parse(spaceParse, option);
|
|
expect(UprightTool.boardlist.length).toMatchSnapshot();
|
|
for (let br of UprightTool.boardlist)
|
|
{
|
|
expect(br.Position.x).toMatchNumberSnapshot(3);
|
|
expect(br.Position.y).toMatchNumberSnapshot(3);
|
|
expect(br.Position.z).toMatchNumberSnapshot(3);
|
|
|
|
expect(br.Height).toMatchNumberSnapshot(3);
|
|
expect(br.Width).toMatchNumberSnapshot(3);
|
|
}
|
|
expect(ObliqueTool.boardlist.length).toMatchSnapshot();
|
|
for (let br of ObliqueTool.boardlist)
|
|
{
|
|
expect(br.Position.x).toMatchNumberSnapshot(3);
|
|
expect(br.Position.y).toMatchNumberSnapshot(3);
|
|
expect(br.Position.z).toMatchNumberSnapshot(3);
|
|
|
|
expect(br.Height).toMatchNumberSnapshot(3);
|
|
expect(br.Width).toMatchNumberSnapshot(3);
|
|
}
|
|
});
|
|
});
|