@shopware-ag/dive 1.17.2 → 1.18.0
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/README.md +56 -22
- package/build/dive.cjs +11 -7
- package/build/dive.cjs.map +1 -1
- package/build/dive.d.cts +3 -4
- package/build/dive.d.ts +3 -4
- package/build/dive.js +9 -5
- package/build/dive.js.map +1 -1
- package/package.json +1 -1
- package/src/__test__/DIVE.test.ts +0 -40
- package/src/animation/__test__/AnimationSystem.test.ts +0 -7
- package/src/ar/arquicklook/__test__/ARQuickLook.test.ts +0 -140
- package/src/ar/sceneviewer/__test__/SceneViewer.test.ts +0 -140
- package/src/axiscamera/__test__/AxisCamera.test.ts +0 -76
- package/src/com/__test__/Communication.test.ts +0 -6
- package/src/controls/__test__/OrbitControls.test.ts +0 -87
- package/src/dive.ts +3 -3
- package/src/exporters/usdz/__test__/USDZExporter.test.ts +57 -0
- package/src/group/Group.ts +6 -1
- package/src/group/__test__/Group.test.ts +6 -3
- package/src/io/gltf/__test__/GLTFIO.test.ts +0 -77
- package/src/light/PointLight.ts +1 -1
- package/src/light/__test__/AmbientLight.test.ts +0 -24
- package/src/light/__test__/PointLight.test.ts +0 -61
- package/src/light/__test__/SceneLight.test.ts +0 -89
- package/src/loadingmanager/LoadingManager.ts +2 -1
- package/src/loadingmanager/__test__/LoadingManager.test.ts +0 -30
- package/src/math/degToRad/__test__/degToRad.test.ts +0 -7
- package/src/math/radToDeg/__test__/radToDeg.test.ts +0 -7
- package/src/model/Model.ts +1 -1
- package/src/model/__test__/Model.test.ts +5 -155
- package/src/node/__test__/Node.test.ts +0 -149
- package/src/primitive/__test__/Primitive.test.ts +6 -199
- package/src/primitive/floor/__test__/Floor.test.ts +0 -3
- package/src/renderer/__test__/Renderer.test.ts +16 -46
- package/src/scene/__test__/Scene.test.ts +6 -16
- package/src/scene/root/Root.ts +4 -4
- package/src/scene/root/__test__/Root.test.ts +6 -188
- package/src/toolbox/__test__/BaseTool.test.ts +34 -38
- package/src/toolbox/select/__test__/SelectTool.test.ts +16 -89
- package/src/toolbox/transform/__test__/TransformTool.test.ts +14 -82
|
@@ -7,13 +7,6 @@ import { type DIVEBaseTool } from '../../BaseTool';
|
|
|
7
7
|
import { Tween } from '@tweenjs/tween.js';
|
|
8
8
|
import { DIVEAnimationSystem } from '../../../animation/AnimationSystem';
|
|
9
9
|
|
|
10
|
-
jest.mock('@tweenjs/tween.js', () => {
|
|
11
|
-
return {
|
|
12
|
-
Tween: jest.fn(() => {}),
|
|
13
|
-
update: jest.fn(),
|
|
14
|
-
};
|
|
15
|
-
});
|
|
16
|
-
|
|
17
10
|
jest.mock('../../../renderer/Renderer', () => {
|
|
18
11
|
return jest.fn(function () {
|
|
19
12
|
return this;
|
|
@@ -75,74 +68,6 @@ jest.mock('../../../animation/AnimationSystem', () => {
|
|
|
75
68
|
};
|
|
76
69
|
});
|
|
77
70
|
|
|
78
|
-
const mock_intersectObjects = jest.fn().mockReturnValue([]);
|
|
79
|
-
|
|
80
|
-
jest.mock('three', () => {
|
|
81
|
-
return {
|
|
82
|
-
Vector2: jest.fn(function () {
|
|
83
|
-
return this;
|
|
84
|
-
}),
|
|
85
|
-
Vector3: jest.fn(function () {
|
|
86
|
-
return this;
|
|
87
|
-
}),
|
|
88
|
-
Raycaster: jest.fn(function () {
|
|
89
|
-
this.setFromCamera = jest.fn();
|
|
90
|
-
this.intersectObjects = mock_intersectObjects;
|
|
91
|
-
this.layers = {
|
|
92
|
-
mask: 0,
|
|
93
|
-
};
|
|
94
|
-
return this;
|
|
95
|
-
}),
|
|
96
|
-
};
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
const mock_attach = jest.fn();
|
|
100
|
-
const mock_detach = jest.fn();
|
|
101
|
-
|
|
102
|
-
jest.mock('three/examples/jsm/controls/TransformControls', () => {
|
|
103
|
-
return {
|
|
104
|
-
TransformControls: jest.fn(function () {
|
|
105
|
-
this.isTransformControls = true;
|
|
106
|
-
this.addEventListener = jest.fn(
|
|
107
|
-
(type: string, callback: (e: object) => void) => {
|
|
108
|
-
this.object = null;
|
|
109
|
-
callback({ value: false });
|
|
110
|
-
this.object = {};
|
|
111
|
-
callback({ value: false });
|
|
112
|
-
this.object = {
|
|
113
|
-
isMovable: true,
|
|
114
|
-
};
|
|
115
|
-
callback({ value: false });
|
|
116
|
-
this.object = {
|
|
117
|
-
isMovable: true,
|
|
118
|
-
onMove: jest.fn(),
|
|
119
|
-
onMoveStart: jest.fn(),
|
|
120
|
-
onMoveEnd: jest.fn(),
|
|
121
|
-
};
|
|
122
|
-
callback({ value: false });
|
|
123
|
-
},
|
|
124
|
-
);
|
|
125
|
-
this.attach = mock_attach;
|
|
126
|
-
this.detach = mock_detach;
|
|
127
|
-
this.traverse = jest.fn((callback: (obj: object) => void) => {
|
|
128
|
-
callback(this);
|
|
129
|
-
});
|
|
130
|
-
this.setMode = jest.fn();
|
|
131
|
-
this.getRaycaster = jest.fn().mockReturnValue({
|
|
132
|
-
layers: {
|
|
133
|
-
mask: 0,
|
|
134
|
-
disableAll: jest.fn(),
|
|
135
|
-
enableAll: jest.fn(),
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
this.layers = {
|
|
139
|
-
mask: 0,
|
|
140
|
-
};
|
|
141
|
-
return this;
|
|
142
|
-
}),
|
|
143
|
-
};
|
|
144
|
-
});
|
|
145
|
-
|
|
146
71
|
const mockCamera: DIVEPerspectiveCamera = {} as DIVEPerspectiveCamera;
|
|
147
72
|
const mockRenderer = {
|
|
148
73
|
render: jest.fn(),
|
|
@@ -166,30 +91,37 @@ const mockController: DIVEOrbitControls = new DIVEOrbitControls(
|
|
|
166
91
|
mockAnimSystem,
|
|
167
92
|
);
|
|
168
93
|
|
|
94
|
+
let transformTool: DIVETransformTool;
|
|
95
|
+
let intersectObjectsSpy: jest.SpyInstance;
|
|
96
|
+
|
|
169
97
|
describe('dive/toolbox/select/DIVETransformTool', () => {
|
|
98
|
+
beforeEach(() => {
|
|
99
|
+
transformTool = new DIVETransformTool(mockScene, mockController);
|
|
100
|
+
intersectObjectsSpy = jest
|
|
101
|
+
.spyOn(transformTool['_raycaster'], 'intersectObjects')
|
|
102
|
+
.mockReturnValue([]);
|
|
103
|
+
});
|
|
104
|
+
|
|
170
105
|
it('should test if it is SelectTool', () => {
|
|
171
|
-
const
|
|
172
|
-
|
|
106
|
+
const transformTool = {
|
|
107
|
+
isTransformTool: true,
|
|
108
|
+
} as unknown as DIVEBaseTool;
|
|
109
|
+
expect(isTransformTool(transformTool)).toBeDefined();
|
|
173
110
|
});
|
|
174
111
|
|
|
175
112
|
it('should instantiate', () => {
|
|
176
|
-
const transformTool = new DIVETransformTool(mockScene, mockController);
|
|
177
113
|
expect(transformTool).toBeDefined();
|
|
178
114
|
});
|
|
179
115
|
|
|
180
116
|
it('should activate', () => {
|
|
181
|
-
const transformTool = new DIVETransformTool(mockScene, mockController);
|
|
182
117
|
expect(() => transformTool.Activate()).not.toThrow();
|
|
183
118
|
});
|
|
184
119
|
|
|
185
120
|
it('should set gizmo mode', () => {
|
|
186
|
-
const transformTool = new DIVETransformTool(mockScene, mockController);
|
|
187
121
|
expect(() => transformTool.SetGizmoMode('translate')).not.toThrow();
|
|
188
122
|
});
|
|
189
123
|
|
|
190
124
|
it('should set gizmo active', () => {
|
|
191
|
-
const transformTool = new DIVETransformTool(mockScene, mockController);
|
|
192
|
-
|
|
193
125
|
expect(() => transformTool.SetGizmoVisibility(true)).not.toThrow();
|
|
194
126
|
|
|
195
127
|
// mock that gizmo is in scene
|