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, EWineRackType, EWRackArrayType, IWineRackOption } from "../../src/UI/Store/WineRackInterface"; import { LoadEntityFromFileData } from "../Utils/LoadEntity.util"; const UprightTool = DrawUprightWineRackTool.GetInstance() as DrawUprightWineRackTool; const ObliqueTool = DrawObliqueWineRackTool.GetInstance() as DrawObliqueWineRackTool; const option: IWineRackOption = { type: EWineRackType.Oblique, 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, }; 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(); expect(ObliqueTool.boardlist.length).toMatchSnapshot(); }); });