开发:补充测试用例

pull/1477/MERGE
ChenX 2 years ago
parent 6fcb3ea79d
commit 0b427365eb

@ -0,0 +1,108 @@
import { Vector3 } from "three";
import { RoomHolePolyline } from "../../src/DatabaseServices/Room/Entity/Wall/Hole/RoomHolePolyline";
import { RoomWallLine } from "../../src/DatabaseServices/Room/Entity/Wall/RoomWallLine";
import { RoomIHoleParseAndModify } from "../../src/DatabaseServices/Room/ParseService/Hole/RoomIHoleParseAndModify";
import { RoomWallParse, UpdateRelevanceWallHole } from "../../src/ueapi";
import "../Utils/jest.util";
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
LoadEntityFromFileData;
//如果不延迟导入,则导致循环依赖错误
import { Database } from "../../src/DatabaseServices/Database";
import { RoomWallArc } from "../../src/DatabaseServices/Room/Entity/Wall/RoomWallArc";
test('墙洞1', () =>
{
let db = new Database;
let wall1 = new RoomWallLine(new Vector3(0, 0, 0), new Vector3(5000, 0, 0));
let wall2 = new RoomWallLine(new Vector3(0, 0, 0), new Vector3(0, 5000, 0));
db.ModelSpace.Append(wall1);
db.ModelSpace.Append(wall2);
let hole = new RoomHolePolyline();
hole.Points = [
new Vector3(100, 0, 0),
new Vector3(1100, 0, 0),
];
hole.RelevancyWalls = [wall1.Id];
db.ModelSpace.Append(hole);
wall1.RelevancyHoles.push(hole.Id);
new RoomWallParse(true, db, true).Parse([wall1, wall2]);
UpdateRelevanceWallHole([wall1, wall2]);
let m = new RoomIHoleParseAndModify(hole);
expect(m.LeftDist).toMatchNumberSnapshot();
expect(m.RightDist).toMatchNumberSnapshot();
m.LeftDist = 300;
UpdateRelevanceWallHole([wall1, wall2]);
m = new RoomIHoleParseAndModify(hole);
expect(m.LeftDist).toMatchNumberSnapshot();
expect(m.RightDist).toMatchNumberSnapshot();
m.RightDist = 300;
UpdateRelevanceWallHole([wall1, wall2]);
m = new RoomIHoleParseAndModify(hole);
expect(m.LeftDist).toMatchNumberSnapshot();
expect(m.RightDist).toMatchNumberSnapshot();
m.LeftDist = 0;
UpdateRelevanceWallHole([wall1, wall2]);
m = new RoomIHoleParseAndModify(hole);
expect(m.LeftDist).toMatchNumberSnapshot();
expect(m.RightDist).toMatchNumberSnapshot();
m.RightDist = 0;
UpdateRelevanceWallHole([wall1, wall2]);
m = new RoomIHoleParseAndModify(hole);
expect(m.LeftDist).toMatchNumberSnapshot();
expect(m.RightDist).toMatchNumberSnapshot();
});
test('圆弧I洞', () =>
{
let db = new Database;
let wall = new RoomWallArc(new Vector3(0, 0, 0), 5000, 0, Math.PI);
db.ModelSpace.Append(wall);
new RoomWallParse(true, db, true).Parse([wall]);
let hole = new RoomHolePolyline();
hole.Points = [
wall.GetPointAtDistance(100),
wall.GetPointAtDistance(600),
];
hole.RelevancyWalls = [wall.Id];
db.ModelSpace.Append(hole);
wall.RelevancyHoles.push(hole.Id);
UpdateRelevanceWallHole([wall]);
let m = new RoomIHoleParseAndModify(hole);
expect(m.Length).toMatchNumberSnapshot();
m.LeftDist = 0;
UpdateRelevanceWallHole([wall]);
m = new RoomIHoleParseAndModify(hole);
expect(m.Length).toMatchNumberSnapshot();
expect(m.LeftDist).toMatchNumberSnapshot();
expect(m.RightDist).toMatchNumberSnapshot();
});

@ -0,0 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`圆弧I洞 1`] = `"500.00000"`;
exports[`圆弧I洞 2`] = `"500.00000"`;
exports[`圆弧I洞 3`] = `"0.00000"`;
exports[`圆弧I洞 4`] = `"15207.96327"`;
exports[`墙洞1 1`] = `"40.00000"`;
exports[`墙洞1 2`] = `"3900.00000"`;
exports[`墙洞1 3`] = `"300.00000"`;
exports[`墙洞1 4`] = `"3640.00000"`;
exports[`墙洞1 5`] = `"3640.00000"`;
exports[`墙洞1 6`] = `"300.00000"`;
exports[`墙洞1 7`] = `"0.00000"`;
exports[`墙洞1 8`] = `"3940.00000"`;
exports[`墙洞1 9`] = `"3940.00000"`;
exports[`墙洞1 10`] = `"0.00000"`;

@ -1,13 +1,12 @@
import { Factory } from './CADFactory';
import { CADFiler } from './CADFiler';
import { CADObject } from './CADObject';
import { ISerialize } from './ISerialize';
/**
* ,.
*/
@Factory
export class HistorycRecord extends CADObject
export class HistorycRecord
{
//指定撤销时所需要的数据
undoData: ISerialize;

Loading…
Cancel
Save