@shopware-ag/dive 1.19.0 → 1.19.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/dive.cjs +388 -220
- package/build/dive.cjs.map +1 -1
- package/build/dive.js +395 -21946
- package/build/dive.js.map +1 -1
- package/build/dive.mjs +28206 -0
- package/build/dive.mjs.map +1 -0
- package/build/src/ar/AR.d.ts +37 -14
- package/build/src/ar/arquicklook/ARQuickLook.d.ts +5 -6
- package/build/src/ar/sceneviewer/SceneViewer.d.ts +42 -6
- package/build/src/com/actions/scene/launchar.d.ts +5 -2
- package/build/src/converter/Converter.d.ts +21 -0
- package/build/src/dive.d.ts +3 -2
- package/build/src/exporter/Exporter.d.ts +11 -0
- package/build/src/helper/applyMixins/applyMixins.d.ts +22 -6
- package/build/src/info/Info.d.ts +37 -13
- package/build/src/interface/Movable.d.ts +5 -5
- package/build/src/interface/Selectable.d.ts +4 -4
- package/build/src/loader/Loader.d.ts +11 -0
- package/build/src/model/Model.d.ts +2 -2
- package/build/src/node/Node.d.ts +3 -3
- package/build/src/scene/root/Root.d.ts +1 -1
- package/build/src/types/ExporterOptions.d.ts +15 -0
- package/build/src/types/FileTypes.d.ts +27 -0
- package/build/src/types/index.d.ts +4 -0
- package/build/src/types/info/index.d.ts +66 -0
- package/package.json +17 -3
- package/build/src/exporters/usdz/USDZExporter.d.ts +0 -15
- package/build/src/loadingmanager/LoadingManager.d.ts +0 -14
- package/src/__test__/DIVE.test.ts +0 -274
- package/src/animation/AnimationSystem.ts +0 -34
- package/src/animation/__test__/AnimationSystem.test.ts +0 -40
- package/src/ar/AR.ts +0 -98
- package/src/ar/__test__/AR.test.ts +0 -187
- package/src/ar/arquicklook/ARQuickLook.ts +0 -93
- package/src/ar/arquicklook/__test__/ARQuickLook.test.ts +0 -93
- package/src/ar/sceneviewer/SceneViewer.ts +0 -74
- package/src/ar/sceneviewer/__test__/SceneViewer.test.ts +0 -93
- package/src/ar/webxr/WebXR.ts +0 -176
- package/src/ar/webxr/controller/WebXRController.ts +0 -340
- package/src/ar/webxr/crosshair/WebXRCrosshair.ts +0 -35
- package/src/ar/webxr/origin/WebXROrigin.ts +0 -192
- package/src/ar/webxr/overlay/Overlay.ts +0 -50
- package/src/ar/webxr/raycaster/WebXRRaycaster.ts +0 -131
- package/src/ar/webxr/raycaster/ar/WebXRRaycasterAR.ts +0 -102
- package/src/ar/webxr/raycaster/three/WebXRRaycasterTHREE.ts +0 -49
- package/src/ar/webxr/touchscreencontrols/WebXRTouchscreenControls.ts +0 -356
- package/src/axiscamera/AxisCamera.ts +0 -108
- package/src/axiscamera/__test__/AxisCamera.test.ts +0 -150
- package/src/camera/PerspectiveCamera.ts +0 -63
- package/src/camera/__test__/PerspectiveCamera.test.ts +0 -36
- package/src/com/Communication.ts +0 -808
- package/src/com/__test__/Communication.test.ts +0 -1024
- package/src/com/actions/camera/computeencompassingview.ts +0 -10
- package/src/com/actions/camera/getcameratransform.ts +0 -10
- package/src/com/actions/camera/movecamera.ts +0 -18
- package/src/com/actions/camera/resetcamera.ts +0 -5
- package/src/com/actions/camera/setcameralayer.ts +0 -5
- package/src/com/actions/camera/setcameratransform.ts +0 -10
- package/src/com/actions/camera/zoomcamera.ts +0 -5
- package/src/com/actions/index.ts +0 -61
- package/src/com/actions/media/generatemedia.ts +0 -18
- package/src/com/actions/object/addobject.ts +0 -7
- package/src/com/actions/object/deleteobject.ts +0 -7
- package/src/com/actions/object/deselectobject.ts +0 -7
- package/src/com/actions/object/getallobjects.ts +0 -7
- package/src/com/actions/object/getobjects.ts +0 -7
- package/src/com/actions/object/model/dropit.ts +0 -5
- package/src/com/actions/object/model/modelloaded.ts +0 -5
- package/src/com/actions/object/model/placeonfloor.ts +0 -5
- package/src/com/actions/object/selectobject.ts +0 -7
- package/src/com/actions/object/setparent.ts +0 -10
- package/src/com/actions/object/updateobject.ts +0 -7
- package/src/com/actions/renderer/startrender.ts +0 -5
- package/src/com/actions/scene/exportscene.ts +0 -7
- package/src/com/actions/scene/getallscenedata.ts +0 -7
- package/src/com/actions/scene/launchar.ts +0 -7
- package/src/com/actions/scene/setbackground.ts +0 -5
- package/src/com/actions/scene/updatescene.ts +0 -11
- package/src/com/actions/toolbox/select/setgizmomode.ts +0 -5
- package/src/com/actions/toolbox/transform/setgizmoscalelinked.ts +0 -5
- package/src/com/actions/toolbox/transform/setgizmovisible.ts +0 -5
- package/src/com/actions/toolbox/usetool.ts +0 -7
- package/src/com/types/COMBaseEntity.ts +0 -9
- package/src/com/types/COMEntity.ts +0 -7
- package/src/com/types/COMEntityType.ts +0 -1
- package/src/com/types/COMGeometry.ts +0 -8
- package/src/com/types/COMGeometryType.ts +0 -9
- package/src/com/types/COMGroup.ts +0 -9
- package/src/com/types/COMLight.ts +0 -11
- package/src/com/types/COMMaterial.ts +0 -12
- package/src/com/types/COMModel.ts +0 -12
- package/src/com/types/COMPov.ts +0 -8
- package/src/com/types/COMPrimitive.ts +0 -12
- package/src/com/types/index.ts +0 -23
- package/src/constant/AxisHelperColors.ts +0 -7
- package/src/constant/GridColors.ts +0 -2
- package/src/constant/VisibilityLayerMask.ts +0 -5
- package/src/controls/OrbitControls.ts +0 -211
- package/src/controls/__test__/OrbitControls.test.ts +0 -256
- package/src/dive.ts +0 -363
- package/src/events/EventExecutor.ts +0 -35
- package/src/exporters/usdz/USDZExporter.ts +0 -21
- package/src/exporters/usdz/__test__/USDZExporter.test.ts +0 -57
- package/src/gizmo/Gizmo.ts +0 -144
- package/src/gizmo/handles/AxisHandle.ts +0 -153
- package/src/gizmo/handles/RadialHandle.ts +0 -149
- package/src/gizmo/handles/ScaleHandle.ts +0 -195
- package/src/gizmo/plane/GizmoPlane.ts +0 -84
- package/src/gizmo/rotate/RotateGizmo.ts +0 -143
- package/src/gizmo/scale/ScaleGizmo.ts +0 -125
- package/src/gizmo/translate/TranslateGizmo.ts +0 -114
- package/src/grid/Grid.ts +0 -34
- package/src/grid/__test__/Grid.test.ts +0 -28
- package/src/group/Group.ts +0 -184
- package/src/group/__test__/Group.test.ts +0 -212
- package/src/helper/applyMixins/__test__/applyMixins.test.ts +0 -30
- package/src/helper/applyMixins/applyMixins.ts +0 -18
- package/src/helper/findInterface/__test__/findInterface.test.ts +0 -63
- package/src/helper/findInterface/findInterface.ts +0 -13
- package/src/helper/findSceneRecursive/__test__/findSceneRecursive.test.ts +0 -40
- package/src/helper/findSceneRecursive/findSceneRecursive.ts +0 -16
- package/src/helper/getObjectDelta/__test__/getObjectDelta.test.ts +0 -186
- package/src/helper/getObjectDelta/getObjectDelta.ts +0 -105
- package/src/helper/isInterface/__test__/implementsInterface.test.ts +0 -19
- package/src/helper/isInterface/implementsInterface.ts +0 -9
- package/src/info/Info.ts +0 -154
- package/src/info/__test__/Info.test.ts +0 -338
- package/src/interface/Draggable.ts +0 -14
- package/src/interface/Hoverable.ts +0 -14
- package/src/interface/Movable.ts +0 -12
- package/src/interface/Rotatable.ts +0 -10
- package/src/interface/Scalable.ts +0 -10
- package/src/interface/Selectable.ts +0 -11
- package/src/io/IO.ts +0 -62
- package/src/io/__test__/IO.test.ts +0 -116
- package/src/io/gltf/GLTFIO.ts +0 -56
- package/src/io/gltf/__test__/GLTFIO.test.ts +0 -108
- package/src/light/AmbientLight.ts +0 -39
- package/src/light/PointLight.ts +0 -115
- package/src/light/SceneLight.ts +0 -63
- package/src/light/__test__/AmbientLight.test.ts +0 -29
- package/src/light/__test__/PointLight.test.ts +0 -74
- package/src/light/__test__/SceneLight.test.ts +0 -47
- package/src/loadingmanager/LoadingManager.ts +0 -50
- package/src/loadingmanager/__test__/LoadingManager.test.ts +0 -27
- package/src/math/__test__/DIVEMath.test.ts +0 -12
- package/src/math/ceil/__test__/ceilExp.test.ts +0 -12
- package/src/math/ceil/ceilExp.ts +0 -6
- package/src/math/degToRad/__test__/degToRad.test.ts +0 -172
- package/src/math/degToRad/degToRad.ts +0 -5
- package/src/math/floor/__test__/floorExp.test.ts +0 -14
- package/src/math/floor/floorExp.ts +0 -6
- package/src/math/helper/__test__/shift.test.ts +0 -12
- package/src/math/helper/shift.ts +0 -4
- package/src/math/index.ts +0 -28
- package/src/math/radToDeg/__test__/radToDeg.test.ts +0 -155
- package/src/math/radToDeg/radToDeg.ts +0 -5
- package/src/math/round/__test__/roundExp.test.ts +0 -14
- package/src/math/round/roundExp.ts +0 -10
- package/src/math/signedAngleTo/__test__/signedAngleTo.test.ts +0 -20
- package/src/math/signedAngleTo/signedAngleTo.ts +0 -20
- package/src/math/toFixed/__test__/toFixedExp.test.ts +0 -14
- package/src/math/toFixed/toFixedExp.ts +0 -9
- package/src/math/truncate/__test__/truncateExp.test.ts +0 -14
- package/src/math/truncate/truncateExp.ts +0 -9
- package/src/mediacreator/MediaCreator.ts +0 -75
- package/src/mediacreator/__test__/MediaCreator.test.ts +0 -155
- package/src/model/Model.ts +0 -185
- package/src/model/__test__/Model.test.ts +0 -222
- package/src/module/Module.ts +0 -45
- package/src/module/__test__/Module.test.ts +0 -54
- package/src/node/Node.ts +0 -98
- package/src/node/__test__/Node.test.ts +0 -120
- package/src/primitive/Primitive.ts +0 -299
- package/src/primitive/__test__/Primitive.test.ts +0 -281
- package/src/primitive/floor/Floor.ts +0 -45
- package/src/primitive/floor/__test__/Floor.test.ts +0 -24
- package/src/renderer/Renderer.ts +0 -215
- package/src/renderer/__test__/Renderer.test.ts +0 -228
- package/src/scene/Scene.ts +0 -106
- package/src/scene/__test__/Scene.test.ts +0 -124
- package/src/scene/root/Root.ts +0 -426
- package/src/scene/root/__test__/Root.test.ts +0 -903
- package/src/scene/xrroot/XRRoot.ts +0 -56
- package/src/scene/xrroot/xrlightroot/XRLightRoot.ts +0 -80
- package/src/toolbox/BaseTool.ts +0 -319
- package/src/toolbox/Toolbox.ts +0 -129
- package/src/toolbox/__test__/BaseTool.test.ts +0 -627
- package/src/toolbox/__test__/Toolbox.test.ts +0 -143
- package/src/toolbox/select/SelectTool.ts +0 -92
- package/src/toolbox/select/__test__/SelectTool.test.ts +0 -237
- package/src/toolbox/transform/TransformTool.ts +0 -166
- package/src/toolbox/transform/__test__/TransformTool.test.ts +0 -147
- package/src/types/SceneData.ts +0 -26
- package/src/types/SceneObjects.ts +0 -14
- package/src/types/SceneType.ts +0 -14
- package/src/types/index.ts +0 -5
|
@@ -1,903 +0,0 @@
|
|
|
1
|
-
import { DIVERoot } from '../Root';
|
|
2
|
-
import {
|
|
3
|
-
type COMPrimitive,
|
|
4
|
-
type COMLight,
|
|
5
|
-
type COMModel,
|
|
6
|
-
type COMPov,
|
|
7
|
-
type COMEntity,
|
|
8
|
-
type COMGeometry,
|
|
9
|
-
type COMGroup,
|
|
10
|
-
type COMEntityType,
|
|
11
|
-
} from '../../../com/types';
|
|
12
|
-
import { type DIVEScene } from '../../Scene';
|
|
13
|
-
import { DIVECommunication } from '../../../com/Communication';
|
|
14
|
-
import { type DIVESceneObject } from '../../../types';
|
|
15
|
-
import { Vector3, Mesh, Box3, Object3D } from 'three';
|
|
16
|
-
|
|
17
|
-
jest.mock('../../../com/Communication.ts', () => {
|
|
18
|
-
return {
|
|
19
|
-
DIVECommunication: {
|
|
20
|
-
get: jest.fn(() => {
|
|
21
|
-
return {
|
|
22
|
-
PerformAction: jest.fn(),
|
|
23
|
-
};
|
|
24
|
-
}),
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const mock_LoadGLTF = jest.fn().mockResolvedValue({});
|
|
30
|
-
jest.mock('../../../loadingmanager/LoadingManager.ts', () => {
|
|
31
|
-
return {
|
|
32
|
-
DIVELoadingManager: jest.fn(function () {
|
|
33
|
-
this.LoadGLTF = mock_LoadGLTF;
|
|
34
|
-
return this;
|
|
35
|
-
}),
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
jest.mock('../../../primitive/floor/Floor', () => {
|
|
40
|
-
return jest.fn(function () {
|
|
41
|
-
this.isObject3D = true;
|
|
42
|
-
this.parent = null;
|
|
43
|
-
this.dispatchEvent = jest.fn();
|
|
44
|
-
this.removeFromParent = jest.fn();
|
|
45
|
-
this.updateMatrixWorld = jest.fn();
|
|
46
|
-
return this;
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
jest.mock('../../../grid/Grid', () => {
|
|
51
|
-
return jest.fn(function () {
|
|
52
|
-
this.isObject3D = true;
|
|
53
|
-
this.parent = null;
|
|
54
|
-
this.dispatchEvent = jest.fn();
|
|
55
|
-
this.removeFromParent = jest.fn();
|
|
56
|
-
this.updateMatrixWorld = jest.fn();
|
|
57
|
-
return this;
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
jest.mock('../../../light/AmbientLight.ts', () => {
|
|
62
|
-
return jest.fn(function () {
|
|
63
|
-
this.isObject3D = true;
|
|
64
|
-
this.parent = null;
|
|
65
|
-
this.dispatchEvent = jest.fn();
|
|
66
|
-
this.position = {
|
|
67
|
-
set: jest.fn(),
|
|
68
|
-
};
|
|
69
|
-
this.parent = {
|
|
70
|
-
attach: jest.fn(),
|
|
71
|
-
};
|
|
72
|
-
this.attach = jest.fn();
|
|
73
|
-
this.applyMatrix4 = jest.fn();
|
|
74
|
-
this.updateWorldMatrix = jest.fn();
|
|
75
|
-
this.children = [];
|
|
76
|
-
this.SetIntensity = jest.fn();
|
|
77
|
-
this.SetEnabled = jest.fn();
|
|
78
|
-
this.SetColor = jest.fn();
|
|
79
|
-
this.userData = {
|
|
80
|
-
id: undefined,
|
|
81
|
-
};
|
|
82
|
-
this.removeFromParent = jest.fn();
|
|
83
|
-
return this;
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
jest.mock('../../../light/PointLight.ts', () => {
|
|
88
|
-
return jest.fn(function () {
|
|
89
|
-
this.isObject3D = true;
|
|
90
|
-
this.parent = null;
|
|
91
|
-
this.dispatchEvent = jest.fn();
|
|
92
|
-
this.position = {
|
|
93
|
-
set: jest.fn(),
|
|
94
|
-
};
|
|
95
|
-
this.parent = {
|
|
96
|
-
attach: jest.fn(),
|
|
97
|
-
};
|
|
98
|
-
this.attach = jest.fn();
|
|
99
|
-
this.applyMatrix4 = jest.fn();
|
|
100
|
-
this.updateWorldMatrix = jest.fn();
|
|
101
|
-
this.children = [];
|
|
102
|
-
this.SetIntensity = jest.fn();
|
|
103
|
-
this.SetEnabled = jest.fn();
|
|
104
|
-
this.SetColor = jest.fn();
|
|
105
|
-
this.userData = {
|
|
106
|
-
id: undefined,
|
|
107
|
-
};
|
|
108
|
-
this.removeFromParent = jest.fn();
|
|
109
|
-
return this;
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
jest.mock('../../../light/SceneLight.ts', () => {
|
|
114
|
-
return jest.fn(function () {
|
|
115
|
-
this.isObject3D = true;
|
|
116
|
-
this.parent = null;
|
|
117
|
-
this.dispatchEvent = jest.fn();
|
|
118
|
-
this.position = {
|
|
119
|
-
set: jest.fn(),
|
|
120
|
-
};
|
|
121
|
-
this.parent = {
|
|
122
|
-
attach: jest.fn(),
|
|
123
|
-
};
|
|
124
|
-
this.attach = jest.fn();
|
|
125
|
-
this.applyMatrix4 = jest.fn();
|
|
126
|
-
this.updateWorldMatrix = jest.fn();
|
|
127
|
-
this.children = [];
|
|
128
|
-
this.SetIntensity = jest.fn();
|
|
129
|
-
this.SetEnabled = jest.fn();
|
|
130
|
-
this.SetColor = jest.fn();
|
|
131
|
-
this.userData = {
|
|
132
|
-
id: undefined,
|
|
133
|
-
};
|
|
134
|
-
this.removeFromParent = jest.fn();
|
|
135
|
-
return this;
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
jest.mock('../../../model/Model.ts', () => {
|
|
140
|
-
return {
|
|
141
|
-
DIVEModel: jest.fn(function () {
|
|
142
|
-
this.isObject3D = true;
|
|
143
|
-
this.parent = null;
|
|
144
|
-
this.dispatchEvent = jest.fn();
|
|
145
|
-
this.userData = {
|
|
146
|
-
id: undefined,
|
|
147
|
-
};
|
|
148
|
-
this.parent = {
|
|
149
|
-
attach: jest.fn(),
|
|
150
|
-
};
|
|
151
|
-
this.attach = jest.fn();
|
|
152
|
-
this.applyMatrix4 = jest.fn();
|
|
153
|
-
this.updateWorldMatrix = jest.fn();
|
|
154
|
-
this.children = [];
|
|
155
|
-
this.SetModel = jest.fn();
|
|
156
|
-
this.SetPosition = jest.fn();
|
|
157
|
-
this.SetRotation = jest.fn();
|
|
158
|
-
this.SetScale = jest.fn();
|
|
159
|
-
this.SetVisibility = jest.fn();
|
|
160
|
-
this.SetMaterial = jest.fn();
|
|
161
|
-
this.PlaceOnFloor = jest.fn();
|
|
162
|
-
this.removeFromParent = jest.fn();
|
|
163
|
-
return this;
|
|
164
|
-
}),
|
|
165
|
-
};
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
jest.mock('../../../primitive/Primitive.ts', () => {
|
|
169
|
-
return {
|
|
170
|
-
DIVEPrimitive: jest.fn(function () {
|
|
171
|
-
this.isObject3D = true;
|
|
172
|
-
this.parent = null;
|
|
173
|
-
this.dispatchEvent = jest.fn();
|
|
174
|
-
this.userData = {
|
|
175
|
-
id: undefined,
|
|
176
|
-
};
|
|
177
|
-
this.parent = {
|
|
178
|
-
attach: jest.fn(),
|
|
179
|
-
};
|
|
180
|
-
this.attach = jest.fn();
|
|
181
|
-
this.applyMatrix4 = jest.fn();
|
|
182
|
-
this.updateWorldMatrix = jest.fn();
|
|
183
|
-
this.children = [];
|
|
184
|
-
this.SetGeometry = jest.fn();
|
|
185
|
-
this.SetMaterial = jest.fn();
|
|
186
|
-
this.SetPosition = jest.fn();
|
|
187
|
-
this.SetRotation = jest.fn();
|
|
188
|
-
this.SetScale = jest.fn();
|
|
189
|
-
this.SetVisibility = jest.fn();
|
|
190
|
-
this.PlaceOnFloor = jest.fn();
|
|
191
|
-
this.removeFromParent = jest.fn();
|
|
192
|
-
return this;
|
|
193
|
-
}),
|
|
194
|
-
};
|
|
195
|
-
});
|
|
196
|
-
|
|
197
|
-
jest.mock('../../../group/Group.ts', () => {
|
|
198
|
-
return {
|
|
199
|
-
DIVEGroup: jest.fn(function () {
|
|
200
|
-
this.isDIVEGroup = true;
|
|
201
|
-
this.isObject3D = true;
|
|
202
|
-
this.parent = null;
|
|
203
|
-
this.dispatchEvent = jest.fn();
|
|
204
|
-
this.userData = {
|
|
205
|
-
id: undefined,
|
|
206
|
-
};
|
|
207
|
-
this.parent = {
|
|
208
|
-
attach: jest.fn(),
|
|
209
|
-
};
|
|
210
|
-
this.attach = jest.fn();
|
|
211
|
-
this.applyMatrix4 = jest.fn();
|
|
212
|
-
this.updateWorldMatrix = jest.fn();
|
|
213
|
-
this.children = [];
|
|
214
|
-
this.SetGeometry = jest.fn();
|
|
215
|
-
this.SetMaterial = jest.fn();
|
|
216
|
-
this.SetPosition = jest.fn();
|
|
217
|
-
this.SetRotation = jest.fn();
|
|
218
|
-
this.SetScale = jest.fn();
|
|
219
|
-
this.SetVisibility = jest.fn();
|
|
220
|
-
this.SetLinesVisibility = jest.fn();
|
|
221
|
-
this.PlaceOnFloor = jest.fn();
|
|
222
|
-
this.removeFromParent = jest.fn();
|
|
223
|
-
return this;
|
|
224
|
-
}),
|
|
225
|
-
};
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
let root: DIVERoot;
|
|
229
|
-
|
|
230
|
-
let spyConsoleWarn = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
|
231
|
-
|
|
232
|
-
Object3D.prototype.attach = jest.fn();
|
|
233
|
-
|
|
234
|
-
describe('DIVE/scene/root/DIVERoot', () => {
|
|
235
|
-
beforeEach(() => {
|
|
236
|
-
root = new DIVERoot();
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
afterEach(() => {
|
|
240
|
-
jest.clearAllMocks();
|
|
241
|
-
});
|
|
242
|
-
|
|
243
|
-
afterAll(() => {
|
|
244
|
-
spyConsoleWarn.mockRestore();
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
it('should instantiate', () => {
|
|
248
|
-
expect(root).toBeDefined();
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
it('should ComputeSceneBB', () => {
|
|
252
|
-
const bb = root.ComputeSceneBB();
|
|
253
|
-
expect(bb).toBeDefined();
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
it('should get scene object', async () => {
|
|
257
|
-
root.children = [
|
|
258
|
-
{
|
|
259
|
-
userData: {
|
|
260
|
-
id: 'different_id',
|
|
261
|
-
},
|
|
262
|
-
},
|
|
263
|
-
] as unknown as DIVESceneObject[];
|
|
264
|
-
expect(root.GetSceneObject({ id: 'test_id' })).toBeUndefined();
|
|
265
|
-
|
|
266
|
-
expect(() =>
|
|
267
|
-
root.AddSceneObject({
|
|
268
|
-
id: 'test_id',
|
|
269
|
-
name: 'test',
|
|
270
|
-
entityType: 'primitive',
|
|
271
|
-
position: { x: 1, y: 2, z: 3 },
|
|
272
|
-
rotation: { x: 1, y: 2, z: 3 },
|
|
273
|
-
scale: { x: 1, y: 2, z: 3 },
|
|
274
|
-
geometry: {} as COMGeometry,
|
|
275
|
-
visible: true,
|
|
276
|
-
parentId: null,
|
|
277
|
-
}),
|
|
278
|
-
).not.toThrow();
|
|
279
|
-
root.children = [
|
|
280
|
-
{
|
|
281
|
-
userData: {
|
|
282
|
-
id: 'test_id',
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
] as unknown as DIVESceneObject[];
|
|
286
|
-
expect(root.GetSceneObject({ id: 'test_id' })).toBeDefined();
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
it('should add object', () => {
|
|
290
|
-
expect(() =>
|
|
291
|
-
root.AddSceneObject({
|
|
292
|
-
id: 'id',
|
|
293
|
-
name: 'pov',
|
|
294
|
-
entityType: 'pov',
|
|
295
|
-
visible: true,
|
|
296
|
-
} as COMPov),
|
|
297
|
-
).not.toThrow();
|
|
298
|
-
|
|
299
|
-
spyConsoleWarn.mockClear();
|
|
300
|
-
expect(() =>
|
|
301
|
-
root.AddSceneObject({
|
|
302
|
-
id: 'id',
|
|
303
|
-
name: 'light',
|
|
304
|
-
entityType: 'light',
|
|
305
|
-
visible: true,
|
|
306
|
-
} as COMLight),
|
|
307
|
-
).not.toThrow();
|
|
308
|
-
expect(spyConsoleWarn).toHaveBeenCalled();
|
|
309
|
-
|
|
310
|
-
spyConsoleWarn.mockClear();
|
|
311
|
-
expect(() =>
|
|
312
|
-
root.AddSceneObject({
|
|
313
|
-
id: 'id_scene',
|
|
314
|
-
name: 'light',
|
|
315
|
-
entityType: 'light',
|
|
316
|
-
visible: true,
|
|
317
|
-
type: 'scene',
|
|
318
|
-
} as COMLight),
|
|
319
|
-
).not.toThrow();
|
|
320
|
-
expect(spyConsoleWarn).not.toHaveBeenCalled();
|
|
321
|
-
|
|
322
|
-
spyConsoleWarn.mockClear();
|
|
323
|
-
expect(() =>
|
|
324
|
-
root.AddSceneObject({
|
|
325
|
-
id: 'id_ambient',
|
|
326
|
-
name: 'light',
|
|
327
|
-
entityType: 'light',
|
|
328
|
-
visible: true,
|
|
329
|
-
type: 'ambient',
|
|
330
|
-
} as COMLight),
|
|
331
|
-
).not.toThrow();
|
|
332
|
-
expect(spyConsoleWarn).not.toHaveBeenCalled();
|
|
333
|
-
|
|
334
|
-
spyConsoleWarn.mockClear();
|
|
335
|
-
expect(() =>
|
|
336
|
-
root.AddSceneObject({
|
|
337
|
-
id: 'id_point',
|
|
338
|
-
name: 'light',
|
|
339
|
-
entityType: 'light',
|
|
340
|
-
visible: true,
|
|
341
|
-
type: 'point',
|
|
342
|
-
position: { x: 0, y: 0, z: 0 },
|
|
343
|
-
intensity: 1,
|
|
344
|
-
enabled: false,
|
|
345
|
-
color: 0xffffff,
|
|
346
|
-
parentId: 'id',
|
|
347
|
-
} as COMLight),
|
|
348
|
-
).not.toThrow();
|
|
349
|
-
expect(spyConsoleWarn).not.toHaveBeenCalled();
|
|
350
|
-
|
|
351
|
-
expect(() =>
|
|
352
|
-
root.AddSceneObject({
|
|
353
|
-
id: 'id',
|
|
354
|
-
name: 'model',
|
|
355
|
-
entityType: 'model',
|
|
356
|
-
visible: true,
|
|
357
|
-
} as COMModel),
|
|
358
|
-
).not.toThrow();
|
|
359
|
-
expect(() =>
|
|
360
|
-
root.AddSceneObject({
|
|
361
|
-
id: 'id_uri0',
|
|
362
|
-
name: 'model',
|
|
363
|
-
entityType: 'model',
|
|
364
|
-
visible: true,
|
|
365
|
-
uri: 'uri',
|
|
366
|
-
position: { x: 0, y: 0, z: 0 },
|
|
367
|
-
rotation: { x: 0, y: 0, z: 0 },
|
|
368
|
-
scale: { x: 1, y: 1, z: 1 },
|
|
369
|
-
material: {},
|
|
370
|
-
parentId: 'id',
|
|
371
|
-
} as COMModel),
|
|
372
|
-
).not.toThrow();
|
|
373
|
-
jest.spyOn(DIVECommunication, 'get').mockReturnValueOnce(undefined);
|
|
374
|
-
expect(() =>
|
|
375
|
-
root.AddSceneObject({
|
|
376
|
-
id: 'id_uri1',
|
|
377
|
-
name: 'model',
|
|
378
|
-
entityType: 'model',
|
|
379
|
-
visible: true,
|
|
380
|
-
uri: 'uri',
|
|
381
|
-
position: { x: 0, y: 0, z: 0 },
|
|
382
|
-
rotation: { x: 0, y: 0, z: 0 },
|
|
383
|
-
scale: { x: 1, y: 1, z: 1 },
|
|
384
|
-
material: {},
|
|
385
|
-
} as COMModel),
|
|
386
|
-
).not.toThrow();
|
|
387
|
-
|
|
388
|
-
expect(() =>
|
|
389
|
-
root.AddSceneObject({
|
|
390
|
-
id: 'id0',
|
|
391
|
-
name: 'primitive',
|
|
392
|
-
entityType: 'primitive',
|
|
393
|
-
visible: true,
|
|
394
|
-
} as COMPrimitive),
|
|
395
|
-
).not.toThrow();
|
|
396
|
-
expect(() =>
|
|
397
|
-
root.AddSceneObject({
|
|
398
|
-
id: 'id1',
|
|
399
|
-
name: 'primitive',
|
|
400
|
-
entityType: 'primitive',
|
|
401
|
-
visible: true,
|
|
402
|
-
material: {},
|
|
403
|
-
parentId: 'id',
|
|
404
|
-
} as COMPrimitive),
|
|
405
|
-
).not.toThrow();
|
|
406
|
-
|
|
407
|
-
expect(() =>
|
|
408
|
-
root.AddSceneObject({
|
|
409
|
-
id: 'id0',
|
|
410
|
-
name: 'Group',
|
|
411
|
-
entityType: 'group',
|
|
412
|
-
visible: true,
|
|
413
|
-
} as COMGroup),
|
|
414
|
-
).not.toThrow();
|
|
415
|
-
expect(() =>
|
|
416
|
-
root.AddSceneObject({
|
|
417
|
-
id: 'id10',
|
|
418
|
-
name: 'Group',
|
|
419
|
-
entityType: 'group',
|
|
420
|
-
visible: true,
|
|
421
|
-
position: { x: 0, y: 0, z: 0 },
|
|
422
|
-
rotation: { x: 0, y: 0, z: 0 },
|
|
423
|
-
scale: { x: 1, y: 1, z: 1 },
|
|
424
|
-
bbVisible: true,
|
|
425
|
-
parentId: 'id',
|
|
426
|
-
} as COMGroup),
|
|
427
|
-
).not.toThrow();
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
it('should update object', () => {
|
|
431
|
-
root.children = [
|
|
432
|
-
{
|
|
433
|
-
userData: {
|
|
434
|
-
id: 'id',
|
|
435
|
-
},
|
|
436
|
-
SetVisibility: jest.fn(),
|
|
437
|
-
parent: root,
|
|
438
|
-
children: [],
|
|
439
|
-
} as unknown as Object3D,
|
|
440
|
-
{
|
|
441
|
-
userData: {
|
|
442
|
-
id: 'id_groupparent',
|
|
443
|
-
},
|
|
444
|
-
attach: jest.fn(),
|
|
445
|
-
parent: root,
|
|
446
|
-
children: [],
|
|
447
|
-
} as unknown as Object3D,
|
|
448
|
-
{
|
|
449
|
-
userData: {
|
|
450
|
-
id: 'id_modelparent',
|
|
451
|
-
},
|
|
452
|
-
attach: jest.fn(),
|
|
453
|
-
parent: root,
|
|
454
|
-
children: [],
|
|
455
|
-
} as unknown as Object3D,
|
|
456
|
-
{
|
|
457
|
-
userData: {
|
|
458
|
-
id: 'id_groupchild',
|
|
459
|
-
},
|
|
460
|
-
SetVisibility: jest.fn(),
|
|
461
|
-
parent: {
|
|
462
|
-
isDIVEGroup: true,
|
|
463
|
-
remove: jest.fn(),
|
|
464
|
-
},
|
|
465
|
-
children: [],
|
|
466
|
-
} as unknown as Object3D,
|
|
467
|
-
];
|
|
468
|
-
expect(() =>
|
|
469
|
-
root.UpdateSceneObject({
|
|
470
|
-
id: 'id',
|
|
471
|
-
name: 'pov',
|
|
472
|
-
entityType: 'pov',
|
|
473
|
-
visible: true,
|
|
474
|
-
} as COMPov),
|
|
475
|
-
).not.toThrow();
|
|
476
|
-
expect(() =>
|
|
477
|
-
root.UpdateSceneObject({
|
|
478
|
-
id: 'id',
|
|
479
|
-
name: 'light',
|
|
480
|
-
entityType: 'light',
|
|
481
|
-
visible: true,
|
|
482
|
-
} as COMLight),
|
|
483
|
-
).not.toThrow();
|
|
484
|
-
expect(() =>
|
|
485
|
-
root.UpdateSceneObject({
|
|
486
|
-
id: 'id',
|
|
487
|
-
name: 'model',
|
|
488
|
-
entityType: 'model',
|
|
489
|
-
visible: true,
|
|
490
|
-
} as COMModel),
|
|
491
|
-
).not.toThrow();
|
|
492
|
-
expect(() =>
|
|
493
|
-
root.UpdateSceneObject({
|
|
494
|
-
id: 'id',
|
|
495
|
-
name: 'primitive',
|
|
496
|
-
entityType: 'primitive',
|
|
497
|
-
visible: true,
|
|
498
|
-
} as COMPrimitive),
|
|
499
|
-
).not.toThrow();
|
|
500
|
-
expect(() =>
|
|
501
|
-
root.UpdateSceneObject({
|
|
502
|
-
id: 'id',
|
|
503
|
-
name: 'group',
|
|
504
|
-
entityType: 'group',
|
|
505
|
-
visible: true,
|
|
506
|
-
} as COMGroup),
|
|
507
|
-
).not.toThrow();
|
|
508
|
-
|
|
509
|
-
expect(() =>
|
|
510
|
-
root.AddSceneObject({
|
|
511
|
-
id: 'id_groupparent',
|
|
512
|
-
name: 'Group',
|
|
513
|
-
entityType: 'group',
|
|
514
|
-
} as COMGroup),
|
|
515
|
-
).not.toThrow();
|
|
516
|
-
expect(() =>
|
|
517
|
-
root.UpdateSceneObject({
|
|
518
|
-
id: 'id_groupchild',
|
|
519
|
-
name: 'group',
|
|
520
|
-
entityType: 'group',
|
|
521
|
-
parentId: 'id_groupparent',
|
|
522
|
-
} as COMGroup),
|
|
523
|
-
).not.toThrow();
|
|
524
|
-
|
|
525
|
-
expect(() =>
|
|
526
|
-
root.UpdateSceneObject({
|
|
527
|
-
id: 'id_groupchild',
|
|
528
|
-
name: 'group',
|
|
529
|
-
entityType: 'group',
|
|
530
|
-
parentId: null,
|
|
531
|
-
} as COMGroup),
|
|
532
|
-
).not.toThrow();
|
|
533
|
-
expect(() =>
|
|
534
|
-
root.UpdateSceneObject({
|
|
535
|
-
id: 'id_groupchild',
|
|
536
|
-
name: 'group',
|
|
537
|
-
entityType: 'group',
|
|
538
|
-
parentId: 'id_modelparent',
|
|
539
|
-
} as COMGroup),
|
|
540
|
-
).not.toThrow();
|
|
541
|
-
expect(() =>
|
|
542
|
-
root.UpdateSceneObject({
|
|
543
|
-
id: 'id_groupchild',
|
|
544
|
-
name: 'group',
|
|
545
|
-
entityType: 'group',
|
|
546
|
-
parentId: 'does_not_exist',
|
|
547
|
-
} as COMGroup),
|
|
548
|
-
).not.toThrow();
|
|
549
|
-
|
|
550
|
-
jest.spyOn(console, 'warn').mockImplementationOnce(() => {});
|
|
551
|
-
expect(() =>
|
|
552
|
-
root.UpdateSceneObject({
|
|
553
|
-
entityType: 'INVALID' as COMEntityType,
|
|
554
|
-
} as COMPrimitive),
|
|
555
|
-
).not.toThrow();
|
|
556
|
-
expect(console.warn).toHaveBeenCalled();
|
|
557
|
-
|
|
558
|
-
jest.spyOn(console, 'warn').mockImplementationOnce(() => {});
|
|
559
|
-
expect(() =>
|
|
560
|
-
root.UpdateSceneObject({
|
|
561
|
-
entityType: undefined,
|
|
562
|
-
} as unknown as COMPrimitive),
|
|
563
|
-
).not.toThrow();
|
|
564
|
-
expect(console.warn).toHaveBeenCalled();
|
|
565
|
-
});
|
|
566
|
-
|
|
567
|
-
it('should delete object', () => {
|
|
568
|
-
const sceneParent = {
|
|
569
|
-
parent: null,
|
|
570
|
-
remove: jest.fn(),
|
|
571
|
-
children: [
|
|
572
|
-
{
|
|
573
|
-
isTransformControls: true,
|
|
574
|
-
detach: jest.fn(),
|
|
575
|
-
},
|
|
576
|
-
],
|
|
577
|
-
};
|
|
578
|
-
root.parent = sceneParent as unknown as DIVEScene;
|
|
579
|
-
|
|
580
|
-
root.children = [
|
|
581
|
-
{
|
|
582
|
-
userData: {
|
|
583
|
-
id: 'id',
|
|
584
|
-
},
|
|
585
|
-
SetVisibility: jest.fn(),
|
|
586
|
-
parent: root,
|
|
587
|
-
children: [],
|
|
588
|
-
} as unknown as Object3D,
|
|
589
|
-
];
|
|
590
|
-
|
|
591
|
-
spyConsoleWarn.mockClear();
|
|
592
|
-
expect(() =>
|
|
593
|
-
root.DeleteSceneObject({
|
|
594
|
-
id: 'does_not_exist',
|
|
595
|
-
name: 'pov',
|
|
596
|
-
entityType: 'pov',
|
|
597
|
-
visible: true,
|
|
598
|
-
} as COMPov),
|
|
599
|
-
).not.toThrow();
|
|
600
|
-
|
|
601
|
-
spyConsoleWarn.mockClear();
|
|
602
|
-
expect(() =>
|
|
603
|
-
root.DeleteSceneObject({
|
|
604
|
-
id: 'id',
|
|
605
|
-
name: 'pov',
|
|
606
|
-
entityType: 'pov',
|
|
607
|
-
visible: true,
|
|
608
|
-
} as COMPov),
|
|
609
|
-
).not.toThrow();
|
|
610
|
-
expect(spyConsoleWarn).not.toHaveBeenCalled();
|
|
611
|
-
|
|
612
|
-
spyConsoleWarn.mockClear();
|
|
613
|
-
expect(() =>
|
|
614
|
-
root.DeleteSceneObject({
|
|
615
|
-
id: 'does_not_exist',
|
|
616
|
-
name: 'light',
|
|
617
|
-
entityType: 'light',
|
|
618
|
-
visible: true,
|
|
619
|
-
type: 'scene',
|
|
620
|
-
} as COMLight),
|
|
621
|
-
).not.toThrow();
|
|
622
|
-
expect(spyConsoleWarn).toHaveBeenCalled();
|
|
623
|
-
|
|
624
|
-
spyConsoleWarn.mockClear();
|
|
625
|
-
expect(() =>
|
|
626
|
-
root.DeleteSceneObject({
|
|
627
|
-
id: 'id',
|
|
628
|
-
name: 'light',
|
|
629
|
-
entityType: 'light',
|
|
630
|
-
visible: true,
|
|
631
|
-
type: 'scene',
|
|
632
|
-
} as COMLight),
|
|
633
|
-
).not.toThrow();
|
|
634
|
-
expect(spyConsoleWarn).not.toHaveBeenCalled();
|
|
635
|
-
|
|
636
|
-
spyConsoleWarn.mockClear();
|
|
637
|
-
expect(() =>
|
|
638
|
-
root.DeleteSceneObject({
|
|
639
|
-
id: 'does_not_exist',
|
|
640
|
-
name: 'model',
|
|
641
|
-
entityType: 'model',
|
|
642
|
-
visible: true,
|
|
643
|
-
} as COMModel),
|
|
644
|
-
).not.toThrow();
|
|
645
|
-
expect(spyConsoleWarn).toHaveBeenCalled();
|
|
646
|
-
|
|
647
|
-
spyConsoleWarn.mockClear();
|
|
648
|
-
expect(() =>
|
|
649
|
-
root.DeleteSceneObject({
|
|
650
|
-
id: 'id',
|
|
651
|
-
name: 'model',
|
|
652
|
-
entityType: 'model',
|
|
653
|
-
visible: true,
|
|
654
|
-
} as COMModel),
|
|
655
|
-
).not.toThrow();
|
|
656
|
-
|
|
657
|
-
expect(() =>
|
|
658
|
-
root.DeleteSceneObject({
|
|
659
|
-
id: 'does_not_exist',
|
|
660
|
-
name: 'primitive',
|
|
661
|
-
entityType: 'primitive',
|
|
662
|
-
visible: true,
|
|
663
|
-
} as COMPrimitive),
|
|
664
|
-
).not.toThrow();
|
|
665
|
-
expect(spyConsoleWarn).toHaveBeenCalled();
|
|
666
|
-
|
|
667
|
-
spyConsoleWarn.mockClear();
|
|
668
|
-
expect(() =>
|
|
669
|
-
root.DeleteSceneObject({
|
|
670
|
-
id: 'id',
|
|
671
|
-
name: 'primitive',
|
|
672
|
-
entityType: 'primitive',
|
|
673
|
-
visible: true,
|
|
674
|
-
} as COMPrimitive),
|
|
675
|
-
).not.toThrow();
|
|
676
|
-
expect(spyConsoleWarn).toHaveBeenCalled();
|
|
677
|
-
|
|
678
|
-
spyConsoleWarn.mockClear();
|
|
679
|
-
expect(() =>
|
|
680
|
-
root.DeleteSceneObject({
|
|
681
|
-
id: 'does_not_exist',
|
|
682
|
-
name: 'group',
|
|
683
|
-
entityType: 'group',
|
|
684
|
-
visible: true,
|
|
685
|
-
} as COMGroup),
|
|
686
|
-
).not.toThrow();
|
|
687
|
-
expect(spyConsoleWarn).toHaveBeenCalled();
|
|
688
|
-
|
|
689
|
-
spyConsoleWarn.mockClear();
|
|
690
|
-
root['detachTransformControls'] = jest.fn();
|
|
691
|
-
jest.spyOn(root, 'GetSceneObject').mockReturnValueOnce({
|
|
692
|
-
members: [new Object3D()],
|
|
693
|
-
parent: {
|
|
694
|
-
remove: jest.fn(),
|
|
695
|
-
},
|
|
696
|
-
} as unknown as DIVESceneObject);
|
|
697
|
-
|
|
698
|
-
expect(() =>
|
|
699
|
-
root.DeleteSceneObject({
|
|
700
|
-
id: 'id',
|
|
701
|
-
name: 'group',
|
|
702
|
-
entityType: 'group',
|
|
703
|
-
visible: true,
|
|
704
|
-
} as COMGroup),
|
|
705
|
-
).not.toThrow();
|
|
706
|
-
expect(spyConsoleWarn).not.toHaveBeenCalled();
|
|
707
|
-
|
|
708
|
-
const firstFind = root.GetSceneObject({ id: 'id' });
|
|
709
|
-
jest.spyOn(root, 'GetSceneObject').mockReturnValueOnce({
|
|
710
|
-
...firstFind,
|
|
711
|
-
members: [new Object3D()],
|
|
712
|
-
parent: sceneParent,
|
|
713
|
-
children: [
|
|
714
|
-
{
|
|
715
|
-
isObject3D: true,
|
|
716
|
-
},
|
|
717
|
-
],
|
|
718
|
-
} as unknown as DIVESceneObject);
|
|
719
|
-
|
|
720
|
-
expect(() =>
|
|
721
|
-
root.DeleteSceneObject({
|
|
722
|
-
id: 'id',
|
|
723
|
-
name: 'group',
|
|
724
|
-
entityType: 'group',
|
|
725
|
-
visible: true,
|
|
726
|
-
} as COMGroup),
|
|
727
|
-
).not.toThrow();
|
|
728
|
-
|
|
729
|
-
jest.spyOn(console, 'warn').mockImplementationOnce(() => {});
|
|
730
|
-
expect(() =>
|
|
731
|
-
root.DeleteSceneObject({
|
|
732
|
-
entityType: 'INVALID' as COMEntityType,
|
|
733
|
-
} as COMPrimitive),
|
|
734
|
-
).not.toThrow();
|
|
735
|
-
expect(console.warn).toHaveBeenCalled();
|
|
736
|
-
|
|
737
|
-
jest.spyOn(console, 'warn').mockImplementationOnce(() => {});
|
|
738
|
-
expect(() =>
|
|
739
|
-
root.DeleteSceneObject({
|
|
740
|
-
entityType: undefined,
|
|
741
|
-
} as unknown as COMPrimitive),
|
|
742
|
-
).not.toThrow();
|
|
743
|
-
expect(console.warn).toHaveBeenCalled();
|
|
744
|
-
});
|
|
745
|
-
|
|
746
|
-
it('should place object on floor', () => {
|
|
747
|
-
root.children = [
|
|
748
|
-
{
|
|
749
|
-
userData: {
|
|
750
|
-
id: 'id',
|
|
751
|
-
},
|
|
752
|
-
SetVisibility: jest.fn(),
|
|
753
|
-
PlaceOnFloor: jest.fn(),
|
|
754
|
-
parent: root,
|
|
755
|
-
children: [],
|
|
756
|
-
} as unknown as Object3D,
|
|
757
|
-
];
|
|
758
|
-
|
|
759
|
-
expect(() =>
|
|
760
|
-
root.PlaceOnFloor({
|
|
761
|
-
id: 'does_not_exist',
|
|
762
|
-
name: 'pov',
|
|
763
|
-
entityType: 'pov',
|
|
764
|
-
visible: true,
|
|
765
|
-
} as COMPov),
|
|
766
|
-
).not.toThrow();
|
|
767
|
-
expect(() =>
|
|
768
|
-
root.PlaceOnFloor({
|
|
769
|
-
id: 'id',
|
|
770
|
-
name: 'pov',
|
|
771
|
-
entityType: 'pov',
|
|
772
|
-
visible: true,
|
|
773
|
-
} as COMPov),
|
|
774
|
-
).not.toThrow();
|
|
775
|
-
|
|
776
|
-
expect(() =>
|
|
777
|
-
root.PlaceOnFloor({
|
|
778
|
-
id: 'does_not_exist',
|
|
779
|
-
name: 'light',
|
|
780
|
-
entityType: 'light',
|
|
781
|
-
visible: true,
|
|
782
|
-
} as COMLight),
|
|
783
|
-
).not.toThrow();
|
|
784
|
-
expect(() =>
|
|
785
|
-
root.PlaceOnFloor({
|
|
786
|
-
id: 'id',
|
|
787
|
-
name: 'light',
|
|
788
|
-
entityType: 'light',
|
|
789
|
-
visible: true,
|
|
790
|
-
} as COMLight),
|
|
791
|
-
).not.toThrow();
|
|
792
|
-
|
|
793
|
-
expect(() =>
|
|
794
|
-
root.PlaceOnFloor({
|
|
795
|
-
id: 'does_not_exist',
|
|
796
|
-
name: 'model',
|
|
797
|
-
entityType: 'model',
|
|
798
|
-
visible: true,
|
|
799
|
-
} as COMModel),
|
|
800
|
-
).not.toThrow();
|
|
801
|
-
expect(() =>
|
|
802
|
-
root.PlaceOnFloor({
|
|
803
|
-
id: 'id',
|
|
804
|
-
name: 'model',
|
|
805
|
-
entityType: 'model',
|
|
806
|
-
visible: true,
|
|
807
|
-
} as COMModel),
|
|
808
|
-
).not.toThrow();
|
|
809
|
-
|
|
810
|
-
expect(() =>
|
|
811
|
-
root.PlaceOnFloor({
|
|
812
|
-
id: 'does_not_exist',
|
|
813
|
-
name: 'primitive',
|
|
814
|
-
entityType: 'primitive',
|
|
815
|
-
visible: true,
|
|
816
|
-
} as COMPrimitive),
|
|
817
|
-
).not.toThrow();
|
|
818
|
-
expect(() =>
|
|
819
|
-
root.PlaceOnFloor({
|
|
820
|
-
id: 'id',
|
|
821
|
-
name: 'primitive',
|
|
822
|
-
entityType: 'primitive',
|
|
823
|
-
visible: true,
|
|
824
|
-
} as COMPrimitive),
|
|
825
|
-
).not.toThrow();
|
|
826
|
-
|
|
827
|
-
jest.spyOn(console, 'warn').mockImplementationOnce(() => {});
|
|
828
|
-
expect(() =>
|
|
829
|
-
root.PlaceOnFloor({
|
|
830
|
-
entityType: 'INVALID' as COMEntityType,
|
|
831
|
-
} as COMPrimitive),
|
|
832
|
-
).not.toThrow();
|
|
833
|
-
expect(console.warn).toHaveBeenCalled();
|
|
834
|
-
|
|
835
|
-
jest.spyOn(console, 'warn').mockImplementationOnce(() => {});
|
|
836
|
-
expect(() =>
|
|
837
|
-
root.PlaceOnFloor({
|
|
838
|
-
entityType: undefined,
|
|
839
|
-
} as unknown as COMPrimitive),
|
|
840
|
-
).not.toThrow();
|
|
841
|
-
expect(console.warn).toHaveBeenCalled();
|
|
842
|
-
});
|
|
843
|
-
|
|
844
|
-
it('should warn if entity type is invalid while adding object', () => {
|
|
845
|
-
const spy = jest
|
|
846
|
-
.spyOn(console, 'warn')
|
|
847
|
-
.mockImplementationOnce(() => {});
|
|
848
|
-
expect(() =>
|
|
849
|
-
root.AddSceneObject({
|
|
850
|
-
id: 'id',
|
|
851
|
-
name: 'entity',
|
|
852
|
-
entityType: 'INVALID' as COMEntityType,
|
|
853
|
-
visible: true,
|
|
854
|
-
} as COMEntity),
|
|
855
|
-
).not.toThrow();
|
|
856
|
-
expect(spy).toHaveBeenCalled();
|
|
857
|
-
});
|
|
858
|
-
|
|
859
|
-
it('should warn if entity type is invalid while updating object', () => {
|
|
860
|
-
const spy = jest
|
|
861
|
-
.spyOn(console, 'warn')
|
|
862
|
-
.mockImplementationOnce(() => {});
|
|
863
|
-
expect(() =>
|
|
864
|
-
root.UpdateSceneObject({
|
|
865
|
-
id: 'id',
|
|
866
|
-
name: 'entity',
|
|
867
|
-
entityType: 'INVALID' as COMEntityType,
|
|
868
|
-
visible: true,
|
|
869
|
-
} as COMEntity),
|
|
870
|
-
).not.toThrow();
|
|
871
|
-
expect(spy).toHaveBeenCalled();
|
|
872
|
-
});
|
|
873
|
-
|
|
874
|
-
it('should warn if entity type is invalid while deleting object', () => {
|
|
875
|
-
const spy = jest
|
|
876
|
-
.spyOn(console, 'warn')
|
|
877
|
-
.mockImplementationOnce(() => {});
|
|
878
|
-
expect(() =>
|
|
879
|
-
root.DeleteSceneObject({
|
|
880
|
-
id: 'id',
|
|
881
|
-
name: 'entity',
|
|
882
|
-
entityType: 'INVALID' as COMEntityType,
|
|
883
|
-
visible: true,
|
|
884
|
-
} as COMEntity),
|
|
885
|
-
).not.toThrow();
|
|
886
|
-
expect(spy).toHaveBeenCalled();
|
|
887
|
-
});
|
|
888
|
-
|
|
889
|
-
it('should warn if entity type is invalid while placing on floor', () => {
|
|
890
|
-
const spy = jest
|
|
891
|
-
.spyOn(console, 'warn')
|
|
892
|
-
.mockImplementationOnce(() => {});
|
|
893
|
-
expect(() =>
|
|
894
|
-
root.PlaceOnFloor({
|
|
895
|
-
id: 'id',
|
|
896
|
-
name: 'entity',
|
|
897
|
-
entityType: 'INVALID' as COMEntityType,
|
|
898
|
-
visible: true,
|
|
899
|
-
} as COMEntity),
|
|
900
|
-
).not.toThrow();
|
|
901
|
-
expect(spy).toHaveBeenCalled();
|
|
902
|
-
});
|
|
903
|
-
});
|