@3cr/viewer-browser 0.0.52 → 0.0.55
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 +108 -81
- package/__tests__/index.spec.ts +31 -0
- package/components.d.ts +2 -2
- package/coverage/3cr-viewer-browser/index.html +116 -0
- package/coverage/3cr-viewer-browser/index.ts.html +211 -0
- package/coverage/3cr-viewer-browser/src/App.vue.html +313 -0
- package/coverage/3cr-viewer-browser/src/components/WebGL3DR.vue.html +442 -0
- package/coverage/3cr-viewer-browser/src/components/icons/index.html +116 -0
- package/coverage/3cr-viewer-browser/src/components/icons/liver.vue.html +148 -0
- package/coverage/3cr-viewer-browser/src/components/index.html +116 -0
- package/coverage/3cr-viewer-browser/src/components/loading/LoadingSpinner.vue.html +556 -0
- package/coverage/3cr-viewer-browser/src/components/loading/index.html +116 -0
- package/coverage/3cr-viewer-browser/src/components/modal/MftpWebGL3DRModal.vue.html +3931 -0
- package/coverage/3cr-viewer-browser/src/components/modal/index.html +116 -0
- package/coverage/3cr-viewer-browser/src/components/selectors/ValueSelector.vue.html +331 -0
- package/coverage/3cr-viewer-browser/src/components/selectors/index.html +116 -0
- package/coverage/3cr-viewer-browser/src/components/sliders/DoubleSliderSelector.vue.html +445 -0
- package/coverage/3cr-viewer-browser/src/components/sliders/VerticalSliderSelector.vue.html +349 -0
- package/coverage/3cr-viewer-browser/src/components/sliders/index.html +131 -0
- package/coverage/3cr-viewer-browser/src/helpers/index.html +146 -0
- package/coverage/3cr-viewer-browser/src/helpers/layoutOverlayStyle.ts.html +406 -0
- package/coverage/3cr-viewer-browser/src/helpers/modelHelper.ts.html +412 -0
- package/coverage/3cr-viewer-browser/src/helpers/utils.ts.html +133 -0
- package/coverage/3cr-viewer-browser/src/index.html +131 -0
- package/coverage/3cr-viewer-browser/src/main.ts.html +124 -0
- package/coverage/3cr-viewer-browser/src/plugins/index.html +131 -0
- package/coverage/3cr-viewer-browser/src/plugins/index.ts.html +130 -0
- package/coverage/3cr-viewer-browser/src/plugins/vuetify.ts.html +220 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +251 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/dist/Viewer3CR.js +17 -11
- package/dist/Viewer3CR.mjs +5352 -5183
- package/dist/Viewer3CR.umd.js +17 -11
- package/index.html +4 -1
- package/index.ts +16 -12
- package/package.json +8 -3
- package/src/App.vue +1 -9
- package/src/__tests__/app.spec.ts +27 -0
- package/src/components/WebGL3DR.vue +49 -37
- package/src/components/__tests__/webgl3dr.spec.ts +56 -0
- package/src/components/icons/liver.vue +21 -0
- package/src/components/loading/__tests__/loading-spinner.spec.ts +11 -0
- package/src/components/modal/MftpWebGL3DRModal.vue +662 -394
- package/src/components/modal/__tests__/mftp-webgl-3dr-modal.spec.ts +690 -0
- package/src/components/selectors/__tests__/value-selector.spec.ts +35 -0
- package/src/components/sliders/DoubleSliderSelector.vue +30 -24
- package/src/components/sliders/VerticalSliderSelector.vue +25 -21
- package/src/components/sliders/__tests__/double-slider-selector.spec.ts +72 -0
- package/src/components/sliders/__tests__/vertical-slider-selector.spec.ts +61 -0
- package/src/helpers/__tests__/layout-overlay-style.spec.ts +288 -0
- package/src/helpers/__tests__/model-helper.spec.ts +118 -0
- package/src/helpers/__tests__/utils.spec.ts +70 -0
- package/src/helpers/layoutOverlayStyle.ts +50 -30
- package/src/plugins/__tests__/index.spec.ts +19 -0
- package/src/plugins/__tests__/vuetify.spec.ts +8 -0
- package/src/plugins/vuetify.ts +25 -8
- package/test/helper.ts +35 -0
- package/test/setup.ts +1 -0
- package/tsconfig.json +5 -2
- package/vite.config.mts +1 -0
- package/vitest.config.mts +44 -0
- package/README2.md +0 -201
- package/src/components/expansion-panels/ExpansionHeaderMiniMenu.vue +0 -19
- package/src/helpers/models.ts +0 -69
- /package/src/components/{sliders/SliderSelector.vue → selectors/ValueSelector.vue} +0 -0
|
@@ -0,0 +1,690 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { shallowMountVuetify } from "~/helper";
|
|
3
|
+
import MftpWebGL3DRModal from "../MftpWebGL3DRModal.vue";
|
|
4
|
+
import {
|
|
5
|
+
inflateInitialScanState,
|
|
6
|
+
inflateScanState,
|
|
7
|
+
} from "@/helpers/modelHelper";
|
|
8
|
+
import {
|
|
9
|
+
AnchorPoint,
|
|
10
|
+
FileManagementActions,
|
|
11
|
+
FrontEndInterfaces,
|
|
12
|
+
PositionData,
|
|
13
|
+
PresetsActions,
|
|
14
|
+
ScanMovementActions,
|
|
15
|
+
ScanOrientationActions,
|
|
16
|
+
ScanStateActions,
|
|
17
|
+
ScanView,
|
|
18
|
+
SlidersActions,
|
|
19
|
+
} from "@3cr/types-ts";
|
|
20
|
+
import { flushPromises } from "@vue/test-utils";
|
|
21
|
+
|
|
22
|
+
vi.mock("@3cr/sdk-browser", async (importOriginal) => {
|
|
23
|
+
const mod = (await importOriginal()) as object;
|
|
24
|
+
return {
|
|
25
|
+
...mod,
|
|
26
|
+
registerVersion: vi.fn(),
|
|
27
|
+
createInstance: vi.fn(),
|
|
28
|
+
executePayload: vi.fn(),
|
|
29
|
+
registerOnPayloadHandler: vi.fn(),
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe("MftpWebGL3DRModal.vue", () => {
|
|
34
|
+
let wrapper = shallowMountVuetify(
|
|
35
|
+
MftpWebGL3DRModal,
|
|
36
|
+
{}
|
|
37
|
+
// { WebGL3DR: true, LoadingSpinner: true }
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
beforeEach(() => {
|
|
41
|
+
wrapper = shallowMountVuetify(
|
|
42
|
+
MftpWebGL3DRModal,
|
|
43
|
+
{}
|
|
44
|
+
// { WebGL3DR: true, LoadingSpinner: true }
|
|
45
|
+
);
|
|
46
|
+
// wrapper.vm.alterValue(true);
|
|
47
|
+
vi.useFakeTimers();
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
afterEach(() => {
|
|
51
|
+
vi.useRealTimers();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("inflates", () => {
|
|
55
|
+
expect(wrapper).toBeTruthy();
|
|
56
|
+
});
|
|
57
|
+
describe("watchers", () => {
|
|
58
|
+
it("scanState.value.Display.Brightness", async () => {
|
|
59
|
+
await testWatcherForDisplay(wrapper, "Brightness", SlidersActions.sl01);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("scanState.value.Display.Contrast", async () => {
|
|
63
|
+
await testWatcherForDisplay(wrapper, "Contrast", SlidersActions.sl02);
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it("scanState.value.Display.Opacity", async () => {
|
|
67
|
+
await testWatcherForDisplay(wrapper, "Opacity", SlidersActions.sl03);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("scanState.value.Display.WindowLower", async () => {
|
|
71
|
+
await testWatcherForDisplay(wrapper, "WindowLower", SlidersActions.sl04);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it("scanState.value.Display.WindowUpper", async () => {
|
|
75
|
+
await testWatcherForDisplay(wrapper, "WindowUpper", SlidersActions.sl05);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("scanState.value.Display.ThresholdLower", async () => {
|
|
79
|
+
await testWatcherForDisplay(
|
|
80
|
+
wrapper,
|
|
81
|
+
"ThresholdLower",
|
|
82
|
+
SlidersActions.sl06
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it("scanState.value.Display.ThresholdUpper", async () => {
|
|
87
|
+
await testWatcherForDisplay(
|
|
88
|
+
wrapper,
|
|
89
|
+
"ThresholdUpper",
|
|
90
|
+
SlidersActions.sl07
|
|
91
|
+
);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it("scanState.value.Slice.TransverseLower", async () => {
|
|
95
|
+
await testWatcherForSlice(
|
|
96
|
+
wrapper,
|
|
97
|
+
"TransverseLower",
|
|
98
|
+
SlidersActions.sl08
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it("scanState.value.Orientations.Transverse.Slice", async () => {
|
|
103
|
+
await testWatcherForOrientation(
|
|
104
|
+
wrapper,
|
|
105
|
+
"Transverse",
|
|
106
|
+
SlidersActions.sl09
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("scanState.value.Slice.TransverseUpper", async () => {
|
|
111
|
+
await testWatcherForSlice(
|
|
112
|
+
wrapper,
|
|
113
|
+
"TransverseUpper",
|
|
114
|
+
SlidersActions.sl10
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it("scanState.value.Slice.SagittalLower", async () => {
|
|
119
|
+
await testWatcherForSlice(wrapper, "SagittalLower", SlidersActions.sl11);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("scanState.value.Orientations.Sagittal.Slice", async () => {
|
|
123
|
+
await testWatcherForOrientation(wrapper, "Sagittal", SlidersActions.sl12);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it("scanState.value.Slice.SagittalUpper", async () => {
|
|
127
|
+
await testWatcherForSlice(wrapper, "SagittalUpper", SlidersActions.sl13);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("scanState.value.Slice.CoronalLower", async () => {
|
|
131
|
+
await testWatcherForSlice(wrapper, "CoronalLower", SlidersActions.sl14);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it("scanState.value.Orientations.Coronal.Slice", async () => {
|
|
135
|
+
await testWatcherForOrientation(wrapper, "Coronal", SlidersActions.sl15);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("scanState.value.Slice.CoronalUpper", async () => {
|
|
139
|
+
await testWatcherForSlice(wrapper, "CoronalUpper", SlidersActions.sl16);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it("scanState.value.Slice.CoronalUpper transaction disabled", async () => {
|
|
143
|
+
wrapper.vm.transactionStarted = true;
|
|
144
|
+
await testWatcherForSlice(wrapper, "CoronalUpper", SlidersActions.sl16);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it("scanState.value.InteractionSettings.PanSensivitity transaction disabled", async () => {
|
|
148
|
+
wrapper.vm.transactionStarted = true;
|
|
149
|
+
await testWatcherForInteractionSettings(
|
|
150
|
+
wrapper,
|
|
151
|
+
"PanSensivitity",
|
|
152
|
+
ScanMovementActions.sm05
|
|
153
|
+
);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it("scanState.value.InteractionSettings.PanSensivitity", async () => {
|
|
157
|
+
await testWatcherForInteractionSettings(
|
|
158
|
+
wrapper,
|
|
159
|
+
"PanSensivitity",
|
|
160
|
+
ScanMovementActions.sm05
|
|
161
|
+
);
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it("scanState.value.InteractionSettings.ZoomSensitivity", async () => {
|
|
165
|
+
await testWatcherForInteractionSettings(
|
|
166
|
+
wrapper,
|
|
167
|
+
"ZoomSensitivity",
|
|
168
|
+
ScanMovementActions.sm08
|
|
169
|
+
);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it("scanState.value.InteractionSettings.RotateSensitivity", async () => {
|
|
173
|
+
await testWatcherForInteractionSettings(
|
|
174
|
+
wrapper,
|
|
175
|
+
"RotateSensitivity",
|
|
176
|
+
ScanMovementActions.sm10
|
|
177
|
+
);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it("scanState.value.InteractionSettings.CameraRotateSensitivity", async () => {
|
|
181
|
+
await testWatcherForInteractionSettings(
|
|
182
|
+
wrapper,
|
|
183
|
+
"CameraRotateSensitivity",
|
|
184
|
+
ScanMovementActions.sm10
|
|
185
|
+
);
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
it("watches scanState", () => {
|
|
189
|
+
expect(wrapper).toBeTruthy();
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it("getIconForPreset Bone", () => {
|
|
193
|
+
expect(wrapper.vm.getIconForPreset("Bone")).toBe("fa:fas fa-bone");
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it("getIconForPreset Brain", () => {
|
|
197
|
+
expect(wrapper.vm.getIconForPreset("Brain")).toBe("fa:fas fa-brain");
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it("getIconForPreset Liver", () => {
|
|
201
|
+
expect(wrapper.vm.getIconForPreset("Liver")).toBe("custom:liver_icon");
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it("getIconForPreset Lungs", () => {
|
|
205
|
+
expect(wrapper.vm.getIconForPreset("Lungs")).toBe("fa:fas fa-lungs");
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it("getIconForPreset Muscle", () => {
|
|
209
|
+
expect(wrapper.vm.getIconForPreset("Muscle")).toBe("custom:muscle_icon");
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
it("getIconForPreset Temporal Bones", () => {
|
|
213
|
+
expect(wrapper.vm.getIconForPreset("Temporal Bones")).toBe(
|
|
214
|
+
"custom:temporal_bones_icon"
|
|
215
|
+
);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it("getIconForPreset Soft Tissue", () => {
|
|
219
|
+
expect(wrapper.vm.getIconForPreset("Soft Tissue")).toBe(
|
|
220
|
+
"custom:torso_icon"
|
|
221
|
+
);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it("getIconForPreset Skin", () => {
|
|
225
|
+
expect(wrapper.vm.getIconForPreset("Skin")).toBe("custom:skin_icon");
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it("getIconForPreset AKJSDHLKAJSDLJ", () => {
|
|
229
|
+
expect(wrapper.vm.getIconForPreset("AKJSDHLKAJSDLJ")).toBe(undefined);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it("windowSlider should be set", () => {
|
|
233
|
+
expect(wrapper.vm.windowSlider).toStrictEqual([0, 100]);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
it("thresholdSlider should be set", () => {
|
|
237
|
+
expect(wrapper.vm.thresholdSlider).toStrictEqual([0, 100]);
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
it("tSlider should be set", () => {
|
|
241
|
+
expect(wrapper.vm.tSlider).toStrictEqual([0, 0]);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
it("sSlider should be set", () => {
|
|
245
|
+
expect(wrapper.vm.sSlider).toStrictEqual([0, 0]);
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it("cSlider should be set", () => {
|
|
249
|
+
expect(wrapper.vm.cSlider).toStrictEqual([0, 0]);
|
|
250
|
+
});
|
|
251
|
+
|
|
252
|
+
it("windowSlider should set", async () => {
|
|
253
|
+
const newVals = [20, 20];
|
|
254
|
+
wrapper.vm.windowSlider = newVals;
|
|
255
|
+
await flushPromises();
|
|
256
|
+
expect(wrapper.vm.windowSlider).toStrictEqual(newVals);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it("thresholdSlider should set", async () => {
|
|
260
|
+
const newVals = [20, 20];
|
|
261
|
+
wrapper.vm.thresholdSlider = newVals;
|
|
262
|
+
await flushPromises();
|
|
263
|
+
expect(wrapper.vm.thresholdSlider).toStrictEqual(newVals);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
it("tSlider should set", async () => {
|
|
267
|
+
const newVals = [0, 0];
|
|
268
|
+
wrapper.vm.tSlider = newVals;
|
|
269
|
+
await flushPromises();
|
|
270
|
+
expect(wrapper.vm.tSlider).toStrictEqual(newVals);
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it("sSlider should set", async () => {
|
|
274
|
+
const newVals = [0, 0];
|
|
275
|
+
wrapper.vm.sSlider = newVals;
|
|
276
|
+
await flushPromises();
|
|
277
|
+
expect(wrapper.vm.sSlider).toStrictEqual(newVals);
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
it("cSlider should set", async () => {
|
|
281
|
+
const newVals = [0, 0];
|
|
282
|
+
wrapper.vm.cSlider = newVals;
|
|
283
|
+
await flushPromises();
|
|
284
|
+
expect(wrapper.vm.cSlider).toStrictEqual(newVals);
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
it("should closeModal", async () => {
|
|
288
|
+
wrapper.vm.closeModal();
|
|
289
|
+
wrapper.vm.m_closeDialog = true;
|
|
290
|
+
|
|
291
|
+
await flushPromises();
|
|
292
|
+
wrapper.findComponent("#close-dialog-prompt");
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
it("should handleOnPayload file_management", async () => {
|
|
296
|
+
wrapper.vm.handleOnPayload(
|
|
297
|
+
FrontEndInterfaces.file_management,
|
|
298
|
+
"123",
|
|
299
|
+
"123"
|
|
300
|
+
);
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
it("should handleOnPayload file_management", async () => {
|
|
304
|
+
wrapper.vm.handleOnPayload(
|
|
305
|
+
FrontEndInterfaces.file_management,
|
|
306
|
+
FileManagementActions.fm02,
|
|
307
|
+
JSON.stringify(inflateInitialScanState())
|
|
308
|
+
);
|
|
309
|
+
});
|
|
310
|
+
it("should handleOnPayload notifications", async () => {
|
|
311
|
+
wrapper.vm.handleOnPayload(FrontEndInterfaces.notifications, "123", "123");
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
it("should handleOnPayload scan_state", async () => {
|
|
315
|
+
wrapper.vm.handleOnPayload(
|
|
316
|
+
FrontEndInterfaces.scan_state,
|
|
317
|
+
ScanStateActions.ss01,
|
|
318
|
+
JSON.stringify(inflateScanState())
|
|
319
|
+
);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
it("should isLayout2x2", async () => {
|
|
323
|
+
const scanState = inflateScanState();
|
|
324
|
+
scanState.Layout.PositionData = [
|
|
325
|
+
{ Anchor: AnchorPoint.TOP_LEFT } as PositionData,
|
|
326
|
+
{ Anchor: AnchorPoint.TOP_RIGHT } as PositionData,
|
|
327
|
+
{ Anchor: AnchorPoint.BOTTOM_LEFT } as PositionData,
|
|
328
|
+
{ Anchor: AnchorPoint.BOTTOM_RIGHT } as PositionData,
|
|
329
|
+
];
|
|
330
|
+
|
|
331
|
+
wrapper.vm.setScanState(JSON.stringify(scanState));
|
|
332
|
+
|
|
333
|
+
expect(wrapper.vm.isLayout2x2).toBeTruthy();
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
it("should isLayout1x3", async () => {
|
|
337
|
+
const scanState = inflateScanState();
|
|
338
|
+
scanState.Layout.PositionData = [
|
|
339
|
+
{ Anchor: AnchorPoint.CENTER } as PositionData,
|
|
340
|
+
{ Anchor: AnchorPoint.TOP_RIGHT } as PositionData,
|
|
341
|
+
{ Anchor: AnchorPoint.RIGHT } as PositionData,
|
|
342
|
+
{ Anchor: AnchorPoint.BOTTOM_RIGHT } as PositionData,
|
|
343
|
+
];
|
|
344
|
+
|
|
345
|
+
wrapper.vm.setScanState(JSON.stringify(scanState));
|
|
346
|
+
|
|
347
|
+
expect(wrapper.vm.isLayout1x3).toBeTruthy();
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
it("should snap", async () => {
|
|
351
|
+
await wrapper.vm.snap();
|
|
352
|
+
|
|
353
|
+
expect(wrapper.emitted()["snap"]).toStrictEqual([[]]);
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
it("should getCurrentGreyscalePreset", async () => {
|
|
357
|
+
const initial = inflateInitialScanState();
|
|
358
|
+
|
|
359
|
+
initial.GreyscalePresets = [
|
|
360
|
+
{ Name: "testing", Lower: 30, Upper: 60, Version: "1.0.0" },
|
|
361
|
+
];
|
|
362
|
+
|
|
363
|
+
wrapper.vm.handleOnPayload(
|
|
364
|
+
FrontEndInterfaces.file_management,
|
|
365
|
+
FileManagementActions.fm02,
|
|
366
|
+
JSON.stringify(initial)
|
|
367
|
+
);
|
|
368
|
+
await flushPromises();
|
|
369
|
+
|
|
370
|
+
const scanState = inflateScanState();
|
|
371
|
+
scanState.Display.WindowLower = 30;
|
|
372
|
+
scanState.Display.WindowUpper = 60;
|
|
373
|
+
|
|
374
|
+
wrapper.vm.setScanState(JSON.stringify(scanState));
|
|
375
|
+
await flushPromises();
|
|
376
|
+
expect(wrapper.vm.getCurrentGreyscalePreset()).toBe("testing");
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
it("should getCurrentGreyscalePreset", async () => {
|
|
380
|
+
const initial = inflateInitialScanState();
|
|
381
|
+
|
|
382
|
+
initial.GreyscalePresets = [
|
|
383
|
+
{ Name: "testing", Lower: 30, Upper: 60, Version: "1.0.0" },
|
|
384
|
+
];
|
|
385
|
+
initial.HuLower = 40;
|
|
386
|
+
initial.HuUpper = 50;
|
|
387
|
+
|
|
388
|
+
wrapper.vm.handleOnPayload(
|
|
389
|
+
FrontEndInterfaces.file_management,
|
|
390
|
+
FileManagementActions.fm02,
|
|
391
|
+
JSON.stringify(initial)
|
|
392
|
+
);
|
|
393
|
+
await flushPromises();
|
|
394
|
+
|
|
395
|
+
const scanState = inflateScanState();
|
|
396
|
+
scanState.Display.WindowLower = 40;
|
|
397
|
+
scanState.Display.WindowUpper = 50;
|
|
398
|
+
|
|
399
|
+
wrapper.vm.setScanState(JSON.stringify(scanState));
|
|
400
|
+
await flushPromises();
|
|
401
|
+
expect(wrapper.vm.getCurrentGreyscalePreset()).toBe("testing");
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
it("should getCurrentGreyscalePreset", async () => {
|
|
405
|
+
const initial = inflateInitialScanState();
|
|
406
|
+
|
|
407
|
+
initial.GreyscalePresets = [
|
|
408
|
+
{ Name: "testing", Lower: 30, Upper: 60, Version: "1.0.0" },
|
|
409
|
+
];
|
|
410
|
+
initial.HuLower = 40;
|
|
411
|
+
initial.HuUpper = 50;
|
|
412
|
+
|
|
413
|
+
wrapper.vm.handleOnPayload(
|
|
414
|
+
FrontEndInterfaces.file_management,
|
|
415
|
+
FileManagementActions.fm02,
|
|
416
|
+
JSON.stringify(initial)
|
|
417
|
+
);
|
|
418
|
+
await flushPromises();
|
|
419
|
+
|
|
420
|
+
const scanState = inflateScanState();
|
|
421
|
+
scanState.Display.WindowLower = 45;
|
|
422
|
+
scanState.Display.WindowUpper = 46;
|
|
423
|
+
|
|
424
|
+
wrapper.vm.setScanState(JSON.stringify(scanState));
|
|
425
|
+
await flushPromises();
|
|
426
|
+
expect(wrapper.vm.getCurrentGreyscalePreset()).toBe(undefined);
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
it("should rotateByDeg", async () => {
|
|
430
|
+
const view = ScanView.Coronal;
|
|
431
|
+
const deg = 10;
|
|
432
|
+
|
|
433
|
+
vi.spyOn(wrapper.vm, "sendPayload").mockImplementation(
|
|
434
|
+
(it: string, a: string, m: any) => {
|
|
435
|
+
expect(it).toBe(FrontEndInterfaces.scan_orientation);
|
|
436
|
+
expect(a).toBe(ScanOrientationActions.so01);
|
|
437
|
+
expect(m).toStrictEqual({
|
|
438
|
+
Version: "0.0.1",
|
|
439
|
+
View: view,
|
|
440
|
+
Angle: deg,
|
|
441
|
+
});
|
|
442
|
+
return Promise.resolve();
|
|
443
|
+
}
|
|
444
|
+
);
|
|
445
|
+
|
|
446
|
+
await wrapper.vm.rotateByDeg(view, deg);
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
it("should fullscreenLayout", async () => {
|
|
450
|
+
const view = ScanView.Coronal;
|
|
451
|
+
|
|
452
|
+
vi.spyOn(wrapper.vm, "sendPayload")
|
|
453
|
+
.mockImplementationOnce((it: string, a: string, m: any) => {
|
|
454
|
+
expect(it).toBe(FrontEndInterfaces.layout);
|
|
455
|
+
expect(a).toBe("lo_01");
|
|
456
|
+
expect(m).toStrictEqual({
|
|
457
|
+
Version: "0.0.1",
|
|
458
|
+
});
|
|
459
|
+
return Promise.resolve();
|
|
460
|
+
})
|
|
461
|
+
.mockImplementationOnce((it: string, a: string, m: any) => {
|
|
462
|
+
expect(it).toBe(FrontEndInterfaces.view_selection);
|
|
463
|
+
expect(a).toBe(`vs_0${view + 1}`);
|
|
464
|
+
expect(m).toStrictEqual({
|
|
465
|
+
Version: "0.0.1",
|
|
466
|
+
});
|
|
467
|
+
return Promise.resolve();
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
await wrapper.vm.fullscreenLayout(view);
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
it("should layouts", async () => {
|
|
474
|
+
vi.spyOn(wrapper.vm, "sendPayload").mockImplementationOnce(
|
|
475
|
+
(it: string, a: string, m: any) => {
|
|
476
|
+
expect(it).toBe(FrontEndInterfaces.layout);
|
|
477
|
+
expect(a).toBe("lo_02");
|
|
478
|
+
expect(m).toStrictEqual({
|
|
479
|
+
Version: "0.0.1",
|
|
480
|
+
});
|
|
481
|
+
return Promise.resolve();
|
|
482
|
+
}
|
|
483
|
+
);
|
|
484
|
+
|
|
485
|
+
await wrapper.vm.layouts("lo_02");
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
it("should setPreset", async () => {
|
|
489
|
+
const action = PresetsActions.pr01;
|
|
490
|
+
const preset = {};
|
|
491
|
+
|
|
492
|
+
vi.spyOn(wrapper.vm, "sendPayload").mockImplementationOnce(
|
|
493
|
+
(it: string, a: string, m: any) => {
|
|
494
|
+
expect(it).toBe(FrontEndInterfaces.presets);
|
|
495
|
+
expect(a).toBe(action);
|
|
496
|
+
expect(m).toStrictEqual(preset);
|
|
497
|
+
return Promise.resolve();
|
|
498
|
+
}
|
|
499
|
+
);
|
|
500
|
+
|
|
501
|
+
await wrapper.vm.setPreset(action, preset);
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
it("should setPreset pr02", async () => {
|
|
505
|
+
const action = PresetsActions.pr02;
|
|
506
|
+
const preset = {};
|
|
507
|
+
|
|
508
|
+
vi.spyOn(wrapper.vm, "sendPayload").mockImplementationOnce(
|
|
509
|
+
(it: string, a: string, m: any) => {
|
|
510
|
+
expect(it).toBe(FrontEndInterfaces.presets);
|
|
511
|
+
expect(a).toBe(action);
|
|
512
|
+
expect(m).toStrictEqual(preset);
|
|
513
|
+
return Promise.resolve();
|
|
514
|
+
}
|
|
515
|
+
);
|
|
516
|
+
|
|
517
|
+
await wrapper.vm.setPreset(action, preset);
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
it("should getCurrentGreyscalePreset", async () => {
|
|
521
|
+
expect(wrapper.vm.getCurrentGreyscalePreset()).toBe(undefined);
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
it("should getViewName 3D Volume", async () => {
|
|
525
|
+
expect(wrapper.vm.getViewName(0)).toBe("3D Volume");
|
|
526
|
+
});
|
|
527
|
+
|
|
528
|
+
it("should getViewName Sagittal", async () => {
|
|
529
|
+
expect(wrapper.vm.getViewName(2)).toBe("Sagittal");
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
it("should getCurrentActiveView Sagittal", async () => {
|
|
533
|
+
expect(
|
|
534
|
+
wrapper.vm.getCurrentActiveView({
|
|
535
|
+
Anchor: AnchorPoint.CENTER,
|
|
536
|
+
ActiveView: true,
|
|
537
|
+
AspectRatio: 1,
|
|
538
|
+
MaxSize: {
|
|
539
|
+
Version: "0.0.1",
|
|
540
|
+
X: 1,
|
|
541
|
+
Y: 1,
|
|
542
|
+
},
|
|
543
|
+
DefaultView: ScanView.Coronal,
|
|
544
|
+
Priority: 1,
|
|
545
|
+
Version: "0.0.1",
|
|
546
|
+
Offset: {
|
|
547
|
+
Version: "0.0.1",
|
|
548
|
+
X: 1,
|
|
549
|
+
Y: 1,
|
|
550
|
+
},
|
|
551
|
+
})
|
|
552
|
+
).toBe(3);
|
|
553
|
+
});
|
|
554
|
+
|
|
555
|
+
it("should getCurrentActiveView Sagittal", async () => {
|
|
556
|
+
const initalState = inflateScanState();
|
|
557
|
+
initalState.Layout.PositionData = [
|
|
558
|
+
{
|
|
559
|
+
Anchor: AnchorPoint.CENTER,
|
|
560
|
+
ActiveView: true,
|
|
561
|
+
AspectRatio: 1,
|
|
562
|
+
MaxSize: {
|
|
563
|
+
Version: "1.0.0",
|
|
564
|
+
X: 1,
|
|
565
|
+
Y: 1,
|
|
566
|
+
},
|
|
567
|
+
DefaultView: ScanView.Coronal,
|
|
568
|
+
Priority: 1,
|
|
569
|
+
Offset: {
|
|
570
|
+
Version: "1.0.0",
|
|
571
|
+
X: 1,
|
|
572
|
+
Y: 1,
|
|
573
|
+
},
|
|
574
|
+
Version: "1.0.0",
|
|
575
|
+
},
|
|
576
|
+
];
|
|
577
|
+
await wrapper.vm.setScanState(JSON.stringify(initalState));
|
|
578
|
+
|
|
579
|
+
expect(
|
|
580
|
+
wrapper.vm.getCurrentActiveView({
|
|
581
|
+
Anchor: AnchorPoint.CENTER,
|
|
582
|
+
ActiveView: true,
|
|
583
|
+
AspectRatio: 1,
|
|
584
|
+
MaxSize: {
|
|
585
|
+
Version: "0.0.1",
|
|
586
|
+
X: 1,
|
|
587
|
+
Y: 1,
|
|
588
|
+
},
|
|
589
|
+
DefaultView: ScanView.Coronal,
|
|
590
|
+
Priority: 1,
|
|
591
|
+
Version: "0.0.1",
|
|
592
|
+
Offset: {
|
|
593
|
+
Version: "0.0.1",
|
|
594
|
+
X: 1,
|
|
595
|
+
Y: 1,
|
|
596
|
+
},
|
|
597
|
+
})
|
|
598
|
+
).toBe(0);
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
it("should footerItems", async () => {
|
|
602
|
+
for (const footerItem of wrapper.vm.footerItems) {
|
|
603
|
+
const promise = footerItem.click();
|
|
604
|
+
expect(promise).toBeTruthy();
|
|
605
|
+
await promise;
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
async function testWatcherForDisplay(
|
|
611
|
+
wrapper: any,
|
|
612
|
+
key: string,
|
|
613
|
+
action: SlidersActions
|
|
614
|
+
) {
|
|
615
|
+
const scanState = inflateScanState();
|
|
616
|
+
(scanState.Display as any)[key] = 60;
|
|
617
|
+
|
|
618
|
+
setupPayloadSpy(wrapper, FrontEndInterfaces.sliders, action, {
|
|
619
|
+
Version: "0.0.1",
|
|
620
|
+
Value: (scanState.Display as any)[key],
|
|
621
|
+
});
|
|
622
|
+
wrapper.vm.setScanState(JSON.stringify(scanState));
|
|
623
|
+
|
|
624
|
+
await flushPromises();
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
async function testWatcherForSlice(
|
|
628
|
+
wrapper: any,
|
|
629
|
+
key: string,
|
|
630
|
+
action: SlidersActions
|
|
631
|
+
) {
|
|
632
|
+
const scanState = inflateScanState();
|
|
633
|
+
(scanState.Slice as any)[key] = 100;
|
|
634
|
+
|
|
635
|
+
setupPayloadSpy(wrapper, FrontEndInterfaces.sliders, action, {
|
|
636
|
+
Version: "0.0.1",
|
|
637
|
+
Value: (scanState.Slice as any)[key],
|
|
638
|
+
});
|
|
639
|
+
wrapper.vm.setScanState(JSON.stringify(scanState));
|
|
640
|
+
|
|
641
|
+
await flushPromises();
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
async function testWatcherForOrientation(
|
|
645
|
+
wrapper: any,
|
|
646
|
+
key: string,
|
|
647
|
+
action: SlidersActions
|
|
648
|
+
) {
|
|
649
|
+
const scanState = inflateScanState();
|
|
650
|
+
(scanState.Orientations as any)[key].Slice = 100;
|
|
651
|
+
|
|
652
|
+
setupPayloadSpy(wrapper, FrontEndInterfaces.sliders, action, {
|
|
653
|
+
Version: "0.0.1",
|
|
654
|
+
Value: (scanState.Orientations as any)[key].Slice,
|
|
655
|
+
});
|
|
656
|
+
wrapper.vm.setScanState(JSON.stringify(scanState));
|
|
657
|
+
|
|
658
|
+
await flushPromises();
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
async function testWatcherForInteractionSettings(
|
|
662
|
+
wrapper: any,
|
|
663
|
+
key: string,
|
|
664
|
+
action: ScanMovementActions
|
|
665
|
+
) {
|
|
666
|
+
const scanState = inflateScanState();
|
|
667
|
+
(scanState.InteractionSettings as any)[key] = 100;
|
|
668
|
+
|
|
669
|
+
setupPayloadSpy(wrapper, FrontEndInterfaces.scan_movement, action, {
|
|
670
|
+
Version: "0.0.1",
|
|
671
|
+
Value: (scanState.InteractionSettings as any)[key],
|
|
672
|
+
});
|
|
673
|
+
wrapper.vm.setScanState(JSON.stringify(scanState));
|
|
674
|
+
|
|
675
|
+
await flushPromises();
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
function setupPayloadSpy(
|
|
679
|
+
wrapper: any,
|
|
680
|
+
interfaceType: FrontEndInterfaces,
|
|
681
|
+
actionType: string,
|
|
682
|
+
message: any
|
|
683
|
+
) {
|
|
684
|
+
wrapper.vm.sendPayload = (it: FrontEndInterfaces, a: string, m: any) => {
|
|
685
|
+
console.log(it, a, m);
|
|
686
|
+
expect(it).toBe(interfaceType);
|
|
687
|
+
expect(a).toBe(actionType);
|
|
688
|
+
expect(m).toStrictEqual(message);
|
|
689
|
+
};
|
|
690
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { mountVuetify } from "~/helper";
|
|
4
|
+
import ValueSelector from "@/components/selectors/ValueSelector.vue";
|
|
5
|
+
import { flushPromises } from "@vue/test-utils";
|
|
6
|
+
|
|
7
|
+
describe("ValueSelector.vue", () => {
|
|
8
|
+
let wrapper = mountVuetify(ValueSelector, {
|
|
9
|
+
value: 1,
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
wrapper = mountVuetify(ValueSelector, {
|
|
14
|
+
value: [0, 0],
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("should inflate component", () => {
|
|
19
|
+
expect(wrapper).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("should change from props", async () => {
|
|
23
|
+
await wrapper.setProps({
|
|
24
|
+
value: 1,
|
|
25
|
+
});
|
|
26
|
+
await flushPromises();
|
|
27
|
+
expect(wrapper.vm.value).toStrictEqual(1);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("should set text", async () => {
|
|
31
|
+
const slider = wrapper.findAllComponents(".v-text-field");
|
|
32
|
+
|
|
33
|
+
await slider[0].setValue(10);
|
|
34
|
+
});
|
|
35
|
+
});
|