mirror of https://gitee.com/cf-fz/WebCAD.git
parent
12f34053ed
commit
8ff9d6b0e1
@ -0,0 +1,30 @@
|
|||||||
|
import { RoomWallBase } from "../../src/DatabaseServices/Room/Entity/Wall/RoomWallBase";
|
||||||
|
import { RoomWallRemoveDuplicate } from "../../src/DatabaseServices/Room/ParseService/RoomWallRemoveDuplicate";
|
||||||
|
import "../Utils/jest.util";
|
||||||
|
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
|
||||||
|
|
||||||
|
|
||||||
|
test('简单的墙体删除重复', () =>
|
||||||
|
{
|
||||||
|
let d1 =
|
||||||
|
{ "file": [4, "RoomWallLine", 1, 3, 8, 2, 116, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 0, 2700, 0, 2000, 0, 0, 0, 0, "RoomWallLine", 1, 3, 8, 2, 117, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 0, 2700, 0, 0, 0, 2000, 0, 0, "RoomWallLine", 1, 3, 8, 2, 118, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 0, 2700, 2000, 0, 0, 2000, 2000, 0, "RoomWallLine", 1, 3, 8, 2, 119, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 0, 2700, 2000, 2000, 0, 0, 2000, 0], "basePt": { "x": -60, "y": -60, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
|
||||||
|
let d2 =
|
||||||
|
{ "file": [4, "RoomWallLine", 1, 3, 8, 2, 126, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 0, 2700, 1300, 0, 0, 1300, 1000, 0, "RoomWallLine", 1, 3, 8, 2, 127, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 0, 2700, 1300, 1000, 0, 300, 1000, 0, "RoomWallLine", 1, 3, 8, 2, 124, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 0, 2700, 300, 1000, 0, 300, 0, 0, "RoomWallLine", 1, 3, 8, 2, 125, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 120, 0, 2700, 300, 0, 0, 1300, 0, 0], "basePt": { "x": 240, "y": -60, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
|
||||||
|
|
||||||
|
let walls1 = LoadEntityFromFileData<RoomWallBase>(d1);
|
||||||
|
let walls2 = LoadEntityFromFileData<RoomWallBase>(d2);
|
||||||
|
|
||||||
|
let rrd = new RoomWallRemoveDuplicate(walls1, walls2);
|
||||||
|
expect(rrd.SplitWalls.length).toMatchSnapshot();
|
||||||
|
for (let w of rrd.SplitWalls)
|
||||||
|
expect(w.Length).toMatchNumberSnapshot();
|
||||||
|
|
||||||
|
walls1 = LoadEntityFromFileData<RoomWallBase>(d1);
|
||||||
|
walls2 = LoadEntityFromFileData<RoomWallBase>(d2);
|
||||||
|
let rrd2 = new RoomWallRemoveDuplicate(walls2, walls1);
|
||||||
|
|
||||||
|
expect(rrd2.SplitWalls.length).toMatchSnapshot();
|
||||||
|
for (let w of rrd2.SplitWalls)
|
||||||
|
expect(w.Length).toMatchNumberSnapshot();
|
||||||
|
|
||||||
|
});
|
@ -0,0 +1,21 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`简单的墙体删除重复 1`] = `5`;
|
||||||
|
|
||||||
|
exports[`简单的墙体删除重复 2`] = `"300.00000"`;
|
||||||
|
|
||||||
|
exports[`简单的墙体删除重复 3`] = `"700.00000"`;
|
||||||
|
|
||||||
|
exports[`简单的墙体删除重复 4`] = `"2000.00000"`;
|
||||||
|
|
||||||
|
exports[`简单的墙体删除重复 5`] = `"2000.00000"`;
|
||||||
|
|
||||||
|
exports[`简单的墙体删除重复 6`] = `"2000.00000"`;
|
||||||
|
|
||||||
|
exports[`简单的墙体删除重复 7`] = `3`;
|
||||||
|
|
||||||
|
exports[`简单的墙体删除重复 8`] = `"1000.00000"`;
|
||||||
|
|
||||||
|
exports[`简单的墙体删除重复 9`] = `"1000.00000"`;
|
||||||
|
|
||||||
|
exports[`简单的墙体删除重复 10`] = `"1000.00000"`;
|
Loading…
Reference in new issue