From c581b8f82386160a205c2ab060a1a08ca61db553 Mon Sep 17 00:00:00 2001 From: ChenX Date: Tue, 6 Mar 2018 11:17:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B5=8B=E8=AF=95=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __test__/FileSystem/file.test.ts | 8 +++----- __test__/Interest/line.test.ts | 23 ++++++++++++----------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/__test__/FileSystem/file.test.ts b/__test__/FileSystem/file.test.ts index 0e9553e47..bf017cd3a 100644 --- a/__test__/FileSystem/file.test.ts +++ b/__test__/FileSystem/file.test.ts @@ -3,14 +3,15 @@ import * as THREE from 'three'; import { BlockTableRecord } from '../../src/DatabaseServices/BlockTableRecord'; import { CADFactory } from '../../src/DatabaseServices/CADFactory'; import { CADFile } from '../../src/DatabaseServices/CADFile'; +import { AllObjectData, CADObject } from '../../src/DatabaseServices/CADObject'; import { CommandHistoryRecord } from '../../src/DatabaseServices/CommandHistoryRecord'; import { CreateObjectData } from '../../src/DatabaseServices/CreateObjectData'; import { Database } from '../../src/DatabaseServices/Database'; +import { Entity } from '../../src/DatabaseServices/Entity'; import { HistorycRecord } from '../../src/DatabaseServices/HistorycRecord'; import { Line } from '../../src/DatabaseServices/Line'; import { ObjectAllDataHistoryRecord } from '../../src/DatabaseServices/ObjectAllDataHistoryRecord'; import { RemoveObjectData } from '../../src/DatabaseServices/RemoveObjectData'; -import { CADObject, AllObjectData } from '../../src/DatabaseServices/CADObject'; function CadObjectToString(obj: CADObject) { @@ -124,7 +125,7 @@ test('xxx', () => db.hm.Redo(); //? db.hm.StartCmd(""); - db.ModelSpace.Remove(db.GetObjectId(1).Object); + db.ModelSpace.Remove(db.GetObjectId(1).Object as Entity); db.hm.Undo(); //? db.hm.Undo(); //? @@ -158,8 +159,6 @@ test('xxx', () => expect(f3.ToString()).toBe(f.ToString());//对象序列化反序列化后 数据应该一样 }); - - test('创建 修改 撤销撤销 重做重做 撤销 重做', () => { let db = new Database(); @@ -184,4 +183,3 @@ test('创建 修改 撤销撤销 重做重做 撤销 重做', () => expect(CadObjectToString(db.hm)).toMatchSnapshot(); }); - diff --git a/__test__/Interest/line.test.ts b/__test__/Interest/line.test.ts index 667e6fe4d..456a32913 100644 --- a/__test__/Interest/line.test.ts +++ b/__test__/Interest/line.test.ts @@ -1,6 +1,7 @@ -import { Line } from "../../src/DatabaseServices/Line"; -import { Vector3 } from "three"; -import { IntersectLineAndLine, Intersect } from "../../src/GraphicsSystem/IntersectWith" +import { Vector3 } from 'three'; + +import { Line } from '../../src/DatabaseServices/Line'; +import { IntersectLineAndLine, IntersectOption } from '../../src/GraphicsSystem/IntersectWith'; @@ -11,16 +12,16 @@ test('直线相交,共线', () => let l2 = new Line(new Vector3(10, 0, 0), new Vector3(15, 0, 0)); - let pts = IntersectLineAndLine(l1, l2, Intersect.ExtendThis); + let pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendThis); expect(pts.length).toBe(0); - pts = IntersectLineAndLine(l1, l2, Intersect.OnBothOperands); + pts = IntersectLineAndLine(l1, l2, IntersectOption.OnBothOperands); expect(pts.length).toBe(0); - pts = IntersectLineAndLine(l1, l2, Intersect.ExtendArg); + pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendArg); expect(pts.length).toBe(1); - pts = IntersectLineAndLine(l1, l2, Intersect.ExtendBoth); + pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendBoth); expect(pts.length).toBe(1); }); @@ -31,15 +32,15 @@ test('直线相交', () => let l2 = new Line(new Vector3(5, 0, 0), new Vector3(0, 5, 0)); - let pts = IntersectLineAndLine(l1, l2, Intersect.ExtendThis); + let pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendThis); expect(pts.length).toBe(1); - pts = IntersectLineAndLine(l1, l2, Intersect.OnBothOperands); + pts = IntersectLineAndLine(l1, l2, IntersectOption.OnBothOperands); expect(pts.length).toBe(1); - pts = IntersectLineAndLine(l1, l2, Intersect.ExtendArg); + pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendArg); expect(pts.length).toBe(1); - pts = IntersectLineAndLine(l1, l2, Intersect.ExtendBoth); + pts = IntersectLineAndLine(l1, l2, IntersectOption.ExtendBoth); expect(pts.length).toBe(1); });