scandit-datacapture-frameworks-core 8.4.0 → 8.5.0-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/__mocks__/Defaults.ts +61 -61
- package/__mocks__/ScanditDataCaptureCore.ts +7 -5
- package/dist/dts/LicenseInfo.d.ts +2 -2
- package/dist/dts/camera/Camera.d.ts +7 -7
- package/dist/dts/camera/CameraSettings.d.ts +5 -5
- package/dist/dts/camera/FocusGesture.d.ts +2 -2
- package/dist/dts/camera/FocusGestureListener.d.ts +2 -2
- package/dist/dts/camera/PinchToZoom.d.ts +4 -4
- package/dist/dts/camera/PrivateFocusGestureDeserializer.d.ts +1 -1
- package/dist/dts/camera/PrivateZoomGestureDeserializer.d.ts +1 -1
- package/dist/dts/camera/SwipeToZoom.d.ts +4 -4
- package/dist/dts/camera/TapToFocus.d.ts +5 -5
- package/dist/dts/camera/TorchSwitchControl.d.ts +2 -2
- package/dist/dts/camera/ZoomGesture.d.ts +1 -1
- package/dist/dts/camera/ZoomGestureListener.d.ts +1 -1
- package/dist/dts/camera/ZoomSwitchControl.d.ts +3 -3
- package/dist/dts/camera/controller/CameraController.d.ts +4 -4
- package/dist/dts/camera/index.d.ts +24 -24
- package/dist/dts/camerahelpers/CameraOwnershipHelper.d.ts +3 -3
- package/dist/dts/camerahelpers/CameraOwnershipManager.d.ts +2 -2
- package/dist/dts/camerahelpers/index.d.ts +8 -8
- package/dist/dts/common/Brush.d.ts +2 -2
- package/dist/dts/common/MarginsWithUnit.d.ts +2 -2
- package/dist/dts/common/NumberWithUnit.d.ts +2 -2
- package/dist/dts/common/Observable.d.ts +1 -1
- package/dist/dts/common/Payload.d.ts +3 -3
- package/dist/dts/common/Point.d.ts +1 -1
- package/dist/dts/common/PointWithUnit.d.ts +2 -2
- package/dist/dts/common/Quadrilateral.d.ts +2 -2
- package/dist/dts/common/Rect.d.ts +3 -3
- package/dist/dts/common/RectWithUnit.d.ts +3 -3
- package/dist/dts/common/ScanIntention.d.ts +3 -0
- package/dist/dts/common/ScanditIcon.d.ts +4 -4
- package/dist/dts/common/ScanditIconBuilder.d.ts +4 -4
- package/dist/dts/common/ScanditIconType.d.ts +5 -1
- package/dist/dts/common/SelectionMode.d.ts +5 -0
- package/dist/dts/common/Size.d.ts +1 -1
- package/dist/dts/common/SizeWithAspect.d.ts +2 -2
- package/dist/dts/common/SizeWithUnit.d.ts +2 -2
- package/dist/dts/common/SizeWithUnitAndAspect.d.ts +5 -5
- package/dist/dts/common/index.d.ts +57 -55
- package/dist/dts/context/DataCaptureComponent.d.ts +1 -1
- package/dist/dts/context/DataCaptureContextListener.d.ts +2 -2
- package/dist/dts/context/DataCaptureContextSettings.d.ts +3 -3
- package/dist/dts/context/DataCaptureMode.d.ts +2 -2
- package/dist/dts/context/index.d.ts +12 -12
- package/dist/dts/controllers/index.d.ts +1 -1
- package/dist/dts/defaults/CoreDefaults.d.ts +12 -3
- package/dist/dts/defaults/index.d.ts +3 -3
- package/dist/dts/defaults/loadCoreDefaults.d.ts +1 -1
- package/dist/dts/feedback/Sound.d.ts +1 -1
- package/dist/dts/feedback/Vibration.d.ts +3 -2
- package/dist/dts/feedback/VibrationType.d.ts +1 -0
- package/dist/dts/feedback/index.d.ts +7 -7
- package/dist/dts/frame/FrameData.d.ts +1 -1
- package/dist/dts/frame/FrameDataSettingsBuilder.d.ts +1 -1
- package/dist/dts/frame/FrameSource.d.ts +4 -4
- package/dist/dts/frame/FrameSourceListener.d.ts +2 -2
- package/dist/dts/frame/ImageFrameSource.d.ts +8 -7
- package/dist/dts/frame/MacroModeListener.d.ts +1 -1
- package/dist/dts/frame/TorchListener.d.ts +1 -1
- package/dist/dts/frame/index.d.ts +13 -13
- package/dist/dts/helpers/index.d.ts +1 -1
- package/dist/dts/locationselection/RadiusLocationSelection.d.ts +3 -3
- package/dist/dts/locationselection/RectangularLocationSelection.d.ts +3 -3
- package/dist/dts/locationselection/index.d.ts +6 -6
- package/dist/dts/proxies/NativeProxy.d.ts +2 -2
- package/dist/dts/proxies/index.d.ts +5 -5
- package/dist/dts/proxy-types.d.ts +1 -1
- package/dist/dts/serializable/DefaultSerializable.d.ts +1 -1
- package/dist/dts/serializable/index.d.ts +7 -7
- package/dist/dts/view/Control.d.ts +2 -2
- package/dist/dts/view/ControlImage.d.ts +1 -1
- package/dist/dts/view/DataCaptureOverlay.d.ts +2 -2
- package/dist/dts/view/DataCaptureViewController.d.ts +7 -7
- package/dist/dts/view/DataCaptureViewListener.d.ts +2 -2
- package/dist/dts/view/index.d.ts +7 -7
- package/dist/dts/viewfinder/AimerViewfinder.d.ts +3 -3
- package/dist/dts/viewfinder/LaserlineViewfinder.d.ts +3 -3
- package/dist/dts/viewfinder/RectangularViewfinderAnimation.d.ts +1 -1
- package/dist/dts/viewfinder/index.d.ts +9 -9
- package/dist/index.js +1696 -1651
- package/dist/index.js.map +1 -1
- package/jest.config.js +5 -15
- package/package.json +1 -1
- package/test/Camera.test.ts +18 -8
- package/test/CameraSettings.test.ts +340 -341
- package/test/ProxyRegistration.test.ts +6 -7
- package/test/ZoomSwitchControl.test.ts +100 -100
- package/test/generated/CoreProxyAdapter.test.ts +4 -7
|
@@ -12,10 +12,10 @@ describe('ProxyRegistration', () => {
|
|
|
12
12
|
callFn: jest.fn(),
|
|
13
13
|
registerEvent: jest.fn(),
|
|
14
14
|
unregisterEvent: jest.fn(),
|
|
15
|
-
eventHook: jest.fn()
|
|
15
|
+
eventHook: jest.fn(),
|
|
16
16
|
};
|
|
17
17
|
const mockProvider: NativeCallerProvider = {
|
|
18
|
-
getNativeCaller: jest.fn(() => mockCaller)
|
|
18
|
+
getNativeCaller: jest.fn(() => mockCaller),
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const proxyTypes = ['ProxyA', 'ProxyB', 'ProxyC'];
|
|
@@ -31,10 +31,10 @@ describe('ProxyRegistration', () => {
|
|
|
31
31
|
callFn: jest.fn(),
|
|
32
32
|
registerEvent: jest.fn(),
|
|
33
33
|
unregisterEvent: jest.fn(),
|
|
34
|
-
eventHook: jest.fn()
|
|
34
|
+
eventHook: jest.fn(),
|
|
35
35
|
};
|
|
36
36
|
const mockProvider: NativeCallerProvider = {
|
|
37
|
-
getNativeCaller: jest.fn(() => mockCaller)
|
|
37
|
+
getNativeCaller: jest.fn(() => mockCaller),
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const proxyTypes = ['ProxyA', 'ProxyB'];
|
|
@@ -55,10 +55,10 @@ describe('ProxyRegistration', () => {
|
|
|
55
55
|
callFn: jest.fn(),
|
|
56
56
|
registerEvent: jest.fn(),
|
|
57
57
|
unregisterEvent: jest.fn(),
|
|
58
|
-
eventHook: jest.fn()
|
|
58
|
+
eventHook: jest.fn(),
|
|
59
59
|
};
|
|
60
60
|
const mockProvider: NativeCallerProvider = {
|
|
61
|
-
getNativeCaller: jest.fn(() => mockCaller)
|
|
61
|
+
getNativeCaller: jest.fn(() => mockCaller),
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
registerProxies(['ProxyA'], mockProvider);
|
|
@@ -72,4 +72,3 @@ describe('ProxyRegistration', () => {
|
|
|
72
72
|
expect(mockProvider.getNativeCaller).toHaveBeenCalledTimes(2);
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
|
-
|
|
@@ -3,128 +3,128 @@ import { ZoomSwitchControl, ZoomSwitchOrientation } from '../src';
|
|
|
3
3
|
import { loadMockDefaults } from '../__mocks__/Defaults';
|
|
4
4
|
|
|
5
5
|
beforeEach(() => {
|
|
6
|
-
|
|
6
|
+
loadMockDefaults();
|
|
7
7
|
});
|
|
8
8
|
|
|
9
9
|
describe('ZoomSwitchControl', () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('initializes with null legacy accessibility properties', () => {
|
|
23
|
-
const control = new ZoomSwitchControl();
|
|
24
|
-
|
|
25
|
-
expect(control.contentDescriptionWhenZoomedOut).toBeNull();
|
|
26
|
-
expect(control.contentDescriptionWhenZoomedIn).toBeNull();
|
|
27
|
-
expect(control.accessibilityLabelWhenZoomedOut).toBeNull();
|
|
28
|
-
expect(control.accessibilityLabelWhenZoomedIn).toBeNull();
|
|
29
|
-
expect(control.accessibilityHintWhenZoomedOut).toBeNull();
|
|
30
|
-
expect(control.accessibilityHintWhenZoomedIn).toBeNull();
|
|
31
|
-
});
|
|
10
|
+
describe('default constructor', () => {
|
|
11
|
+
it('initializes with default v2 properties', () => {
|
|
12
|
+
const control = new ZoomSwitchControl();
|
|
13
|
+
|
|
14
|
+
expect(control.orientation).toBe(ZoomSwitchOrientation.Horizontal);
|
|
15
|
+
expect(control.isAlwaysExpanded).toBe(false);
|
|
16
|
+
expect(control.isExpanded).toBe(false);
|
|
17
|
+
expect(control.accessibilityLabel).toBe('Zoom <level>');
|
|
18
|
+
expect(control.accessibilityHint).toBe('Adjusts the camera zoom level');
|
|
19
|
+
expect(control.selectedZoomLevel).toBe(1);
|
|
32
20
|
});
|
|
33
21
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('allows setting accessibilityLabel', () => {
|
|
54
|
-
const control = new ZoomSwitchControl();
|
|
55
|
-
control.accessibilityLabel = 'Camera zoom';
|
|
56
|
-
expect(control.accessibilityLabel).toBe('Camera zoom');
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('allows setting accessibilityHint', () => {
|
|
60
|
-
const control = new ZoomSwitchControl();
|
|
61
|
-
control.accessibilityHint = 'Double tap to zoom';
|
|
62
|
-
expect(control.accessibilityHint).toBe('Double tap to zoom');
|
|
63
|
-
});
|
|
22
|
+
it('initializes with null legacy accessibility properties', () => {
|
|
23
|
+
const control = new ZoomSwitchControl();
|
|
24
|
+
|
|
25
|
+
expect(control.contentDescriptionWhenZoomedOut).toBeNull();
|
|
26
|
+
expect(control.contentDescriptionWhenZoomedIn).toBeNull();
|
|
27
|
+
expect(control.accessibilityLabelWhenZoomedOut).toBeNull();
|
|
28
|
+
expect(control.accessibilityLabelWhenZoomedIn).toBeNull();
|
|
29
|
+
expect(control.accessibilityHintWhenZoomedOut).toBeNull();
|
|
30
|
+
expect(control.accessibilityHintWhenZoomedIn).toBeNull();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
describe('v2 property setters', () => {
|
|
35
|
+
it('allows setting orientation to Vertical', () => {
|
|
36
|
+
const control = new ZoomSwitchControl();
|
|
37
|
+
control.orientation = ZoomSwitchOrientation.Vertical;
|
|
38
|
+
expect(control.orientation).toBe(ZoomSwitchOrientation.Vertical);
|
|
64
39
|
});
|
|
65
40
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
});
|
|
41
|
+
it('allows setting isAlwaysExpanded', () => {
|
|
42
|
+
const control = new ZoomSwitchControl();
|
|
43
|
+
control.isAlwaysExpanded = true;
|
|
44
|
+
expect(control.isAlwaysExpanded).toBe(true);
|
|
71
45
|
});
|
|
72
46
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
47
|
+
it('allows setting isExpanded', () => {
|
|
48
|
+
const control = new ZoomSwitchControl();
|
|
49
|
+
control.isExpanded = true;
|
|
50
|
+
expect(control.isExpanded).toBe(true);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('allows setting accessibilityLabel', () => {
|
|
54
|
+
const control = new ZoomSwitchControl();
|
|
55
|
+
control.accessibilityLabel = 'Camera zoom';
|
|
56
|
+
expect(control.accessibilityLabel).toBe('Camera zoom');
|
|
57
|
+
});
|
|
81
58
|
|
|
82
|
-
|
|
59
|
+
it('allows setting accessibilityHint', () => {
|
|
60
|
+
const control = new ZoomSwitchControl();
|
|
61
|
+
control.accessibilityHint = 'Double tap to zoom';
|
|
62
|
+
expect(control.accessibilityHint).toBe('Double tap to zoom');
|
|
63
|
+
});
|
|
64
|
+
});
|
|
83
65
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
66
|
+
describe('selectedZoomLevel', () => {
|
|
67
|
+
it('is read-only (no public setter)', () => {
|
|
68
|
+
const control = new ZoomSwitchControl();
|
|
69
|
+
expect(control.selectedZoomLevel).toBe(1);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
describe('JSON serialization', () => {
|
|
74
|
+
it('serializes v2 properties with correct JSON keys', () => {
|
|
75
|
+
const control = new ZoomSwitchControl();
|
|
76
|
+
control.orientation = ZoomSwitchOrientation.Vertical;
|
|
77
|
+
control.isAlwaysExpanded = true;
|
|
78
|
+
control.isExpanded = true;
|
|
79
|
+
control.accessibilityLabel = 'Camera zoom';
|
|
80
|
+
control.accessibilityHint = 'Double tap';
|
|
81
|
+
|
|
82
|
+
const json = JSON.parse(JSON.stringify(control));
|
|
83
|
+
|
|
84
|
+
expect(json.type).toBe('zoom');
|
|
85
|
+
expect(json.orientation).toBe('vertical');
|
|
86
|
+
expect(json.isAlwaysExpanded).toBe(true);
|
|
87
|
+
expect(json.isExpanded).toBe(true);
|
|
88
|
+
expect(json.accessibilityLabel).toBe('Camera zoom');
|
|
89
|
+
expect(json.accessibilityHint).toBe('Double tap');
|
|
90
|
+
});
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
it('does not serialize selectedZoomLevel', () => {
|
|
93
|
+
const control = new ZoomSwitchControl();
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
const json = JSON.parse(JSON.stringify(control));
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
97
|
+
expect(json.selectedZoomLevel).toBeUndefined();
|
|
98
|
+
expect(json._selectedZoomLevel).toBeUndefined();
|
|
99
|
+
});
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
it('serializes default values correctly', () => {
|
|
102
|
+
const control = new ZoomSwitchControl();
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
const json = JSON.parse(JSON.stringify(control));
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
106
|
+
expect(json.orientation).toBe('horizontal');
|
|
107
|
+
expect(json.isAlwaysExpanded).toBe(false);
|
|
108
|
+
expect(json.isExpanded).toBe(false);
|
|
109
|
+
expect(json.accessibilityLabel).toBe('Zoom <level>');
|
|
110
|
+
expect(json.accessibilityHint).toBe('Adjusts the camera zoom level');
|
|
111
|
+
});
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
it('still serializes legacy icon properties', () => {
|
|
114
|
+
const control = new ZoomSwitchControl();
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
const json = JSON.parse(JSON.stringify(control));
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
});
|
|
118
|
+
expect(json.icon).toBeDefined();
|
|
119
|
+
expect(json.icon.zoomedOut).toBeDefined();
|
|
120
|
+
expect(json.icon.zoomedIn).toBeDefined();
|
|
122
121
|
});
|
|
122
|
+
});
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
describe('ZoomSwitchOrientation', () => {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
126
|
+
it('has correct string values for JSON serialization', () => {
|
|
127
|
+
expect(ZoomSwitchOrientation.Horizontal).toBe('horizontal');
|
|
128
|
+
expect(ZoomSwitchOrientation.Vertical).toBe('vertical');
|
|
129
|
+
});
|
|
130
130
|
});
|
|
@@ -311,18 +311,16 @@ describe('CameraProxyAdapter', () => {
|
|
|
311
311
|
const error = new Error('Native error');
|
|
312
312
|
mockProxy.$executeCore.mockRejectedValue(error);
|
|
313
313
|
|
|
314
|
-
await expect(
|
|
315
|
-
|
|
316
|
-
)
|
|
314
|
+
await expect(adapter.getCameraState({ cameraPosition: '{"position":"worldFacing"}' })).rejects.toThrow(
|
|
315
|
+
'Native error'
|
|
316
|
+
);
|
|
317
317
|
});
|
|
318
318
|
|
|
319
319
|
it('should handle JSON parse errors in getCameraState', async () => {
|
|
320
320
|
const mockResult: NativeCallResult = { data: 'invalid json{' };
|
|
321
321
|
mockProxy.$executeCore.mockResolvedValue(mockResult);
|
|
322
322
|
|
|
323
|
-
await expect(
|
|
324
|
-
adapter.getCameraState({ cameraPosition: '{"position":"worldFacing"}' })
|
|
325
|
-
).rejects.toThrow();
|
|
323
|
+
await expect(adapter.getCameraState({ cameraPosition: '{"position":"worldFacing"}' })).rejects.toThrow();
|
|
326
324
|
});
|
|
327
325
|
});
|
|
328
326
|
|
|
@@ -404,4 +402,3 @@ describe('CameraProxyAdapter', () => {
|
|
|
404
402
|
});
|
|
405
403
|
});
|
|
406
404
|
});
|
|
407
|
-
|