mirror of https://gitee.com/cf-fz/WebCAD.git
parent
212443af75
commit
30d3bd9a94
@ -0,0 +1,34 @@
|
|||||||
|
import { CADFiler } from "../../src/api";
|
||||||
|
import "../Utils/jest.util";
|
||||||
|
import { LoadEntityFromFileData } from "../Utils/LoadEntity.util";
|
||||||
|
LoadEntityFromFileData;
|
||||||
|
//如果不延迟导入,则导致循环依赖错误
|
||||||
|
import { inflateBase64 } from "../../src/Common/inflate";
|
||||||
|
import { Database } from "../../src/DatabaseServices/Database";
|
||||||
|
import { RoomWallBase } from "../../src/DatabaseServices/Room/Entity/Wall/RoomWallBase";
|
||||||
|
import { RoomWallLine } from "../../src/DatabaseServices/Room/Entity/Wall/RoomWallLine";
|
||||||
|
import { RoomWallParse } from "../../src/ueapi";
|
||||||
|
|
||||||
|
test('网洞绘制错误', () =>
|
||||||
|
{
|
||||||
|
|
||||||
|
let str = "WebCADSuperCopy:eJy9U7tOxEAM/JetncizL3v/gIIC0VCcrrgiSEgLkeAo+HucXAghdydFQpBkk1lr7MzI6x3IKZIjJXAkkLf1eKhvHbEh5yzg50Akd9/3zw+HWm+fXjpnjGCZlsM8kUBixB3sdbovov34Ob6+d5uo8EMIbPLE/hSDllYzRx9zQUhKWdBiedE5q1CDJNIyQ6BpeGTQOlq66Wt319ePOtnyky1ss7VFUeaNxhuIB7cIJUkKrDlSiqty39WQDA1ST10I1CjzXK/JfL1n/h97ZqLaopJTDJ4NbOvZZdZVQ+GvDfHvzJwdwKxDSZurrwnz4wo/9rC8EaY5zOMRzau9rCdXFwRPZUUHr/nAgsL7T0ws5zA=";
|
||||||
|
str = str.substr(16);
|
||||||
|
str = inflateBase64(str);
|
||||||
|
|
||||||
|
let f = new CADFiler(JSON.parse(str));
|
||||||
|
f.Read();
|
||||||
|
f.Read();
|
||||||
|
|
||||||
|
let db = new Database;
|
||||||
|
|
||||||
|
db.FileRead(f);
|
||||||
|
|
||||||
|
let walls = db.ModelSpace.Entitys.filter(e => e instanceof RoomWallBase) as RoomWallLine[];
|
||||||
|
new RoomWallParse(false, undefined, false).Parse(walls);
|
||||||
|
|
||||||
|
for (let w of walls)
|
||||||
|
{
|
||||||
|
expect(w.MeshGeometry.vertices.length).toMatchSnapshot();
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,7 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`网洞绘制错误 1`] = `"8.00000"`;
|
||||||
|
|
||||||
|
exports[`网洞绘制错误 2`] = `"8.00000"`;
|
||||||
|
|
||||||
|
exports[`网洞绘制错误 3`] = `"8.00000"`;
|
@ -0,0 +1,9 @@
|
|||||||
|
import pako from "pako";
|
||||||
|
|
||||||
|
//解压base64
|
||||||
|
export function inflateBase64(base64: string)
|
||||||
|
{
|
||||||
|
let binaryString = atob(base64);
|
||||||
|
let data = pako.inflate(binaryString, { to: "string" });
|
||||||
|
return data;
|
||||||
|
}
|
Loading…
Reference in new issue