@@ -12,7 +12,8 @@ void main() {
12
12
13
13
group ('CameraInitializedEvent tests' , () {
14
14
test ('Constructor should initialize all properties' , () {
15
- final event = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
15
+ final event = CameraInitializedEvent (
16
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
16
17
17
18
expect (event.cameraId, 1 );
18
19
expect (event.previewWidth, 1024 );
@@ -44,7 +45,8 @@ void main() {
44
45
});
45
46
46
47
test ('toJson should return a map with all fields' , () {
47
- final event = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
48
+ final event = CameraInitializedEvent (
49
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
48
50
49
51
final jsonMap = event.toJson ();
50
52
@@ -59,63 +61,81 @@ void main() {
59
61
});
60
62
61
63
test ('equals should return true if objects are the same' , () {
62
- final firstEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
63
- final secondEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
64
+ final firstEvent = CameraInitializedEvent (
65
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
66
+ final secondEvent = CameraInitializedEvent (
67
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
64
68
65
69
expect (firstEvent == secondEvent, true );
66
70
});
67
71
68
72
test ('equals should return false if cameraId is different' , () {
69
- final firstEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
70
- final secondEvent = CameraInitializedEvent (2 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
73
+ final firstEvent = CameraInitializedEvent (
74
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
75
+ final secondEvent = CameraInitializedEvent (
76
+ 2 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
71
77
72
78
expect (firstEvent == secondEvent, false );
73
79
});
74
80
75
81
test ('equals should return false if previewWidth is different' , () {
76
- final firstEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
77
- final secondEvent = CameraInitializedEvent (1 , 2048 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
82
+ final firstEvent = CameraInitializedEvent (
83
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
84
+ final secondEvent = CameraInitializedEvent (
85
+ 1 , 2048 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
78
86
79
87
expect (firstEvent == secondEvent, false );
80
88
});
81
89
82
90
test ('equals should return false if previewHeight is different' , () {
83
- final firstEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
84
- final secondEvent = CameraInitializedEvent (1 , 1024 , 980 , ExposureMode .auto, FocusMode .auto, true , true );
91
+ final firstEvent = CameraInitializedEvent (
92
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
93
+ final secondEvent = CameraInitializedEvent (
94
+ 1 , 1024 , 980 , ExposureMode .auto, FocusMode .auto, true , true );
85
95
86
96
expect (firstEvent == secondEvent, false );
87
97
});
88
98
89
99
test ('equals should return false if exposureMode is different' , () {
90
- final firstEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
91
- final secondEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .locked, FocusMode .auto, true , true );
100
+ final firstEvent = CameraInitializedEvent (
101
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
102
+ final secondEvent = CameraInitializedEvent (
103
+ 1 , 1024 , 640 , ExposureMode .locked, FocusMode .auto, true , true );
92
104
93
105
expect (firstEvent == secondEvent, false );
94
106
});
95
107
96
- test ('equals should return false if exposurePointSupported is different' , () {
97
- final firstEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
98
- final secondEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, false , true );
108
+ test ('equals should return false if exposurePointSupported is different' ,
109
+ () {
110
+ final firstEvent = CameraInitializedEvent (
111
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
112
+ final secondEvent = CameraInitializedEvent (
113
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, false , true );
99
114
100
115
expect (firstEvent == secondEvent, false );
101
116
});
102
117
103
118
test ('equals should return false if focusMode is different' , () {
104
- final firstEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
105
- final secondEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .locked, true , true );
119
+ final firstEvent = CameraInitializedEvent (
120
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
121
+ final secondEvent = CameraInitializedEvent (
122
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .locked, true , true );
106
123
107
124
expect (firstEvent == secondEvent, false );
108
125
});
109
126
110
127
test ('equals should return false if focusPointSupported is different' , () {
111
- final firstEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
112
- final secondEvent = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , false );
128
+ final firstEvent = CameraInitializedEvent (
129
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
130
+ final secondEvent = CameraInitializedEvent (
131
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , false );
113
132
114
133
expect (firstEvent == secondEvent, false );
115
134
});
116
135
117
136
test ('hashCode should match hashCode of all properties' , () {
118
- final event = CameraInitializedEvent (1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
137
+ final event = CameraInitializedEvent (
138
+ 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
119
139
final expectedHashCode = event.cameraId.hashCode ^
120
140
event.previewWidth.hashCode ^
121
141
event.previewHeight.hashCode ^
@@ -190,7 +210,9 @@ void main() {
190
210
191
211
test ('hashCode should match hashCode of all properties' , () {
192
212
final event = CameraResolutionChangedEvent (1 , 1024 , 640 );
193
- final expectedHashCode = event.cameraId.hashCode ^ event.captureWidth.hashCode ^ event.captureHeight.hashCode;
213
+ final expectedHashCode = event.cameraId.hashCode ^
214
+ event.captureWidth.hashCode ^
215
+ event.captureHeight.hashCode;
194
216
195
217
expect (event.hashCode, expectedHashCode);
196
218
});
@@ -251,7 +273,8 @@ void main() {
251
273
});
252
274
253
275
test ('fromJson should initialize all properties' , () {
254
- final event = CameraErrorEvent .fromJson (< String , dynamic > {'cameraId' : 1 , 'description' : 'Error' });
276
+ final event = CameraErrorEvent .fromJson (
277
+ < String , dynamic > {'cameraId' : 1 , 'description' : 'Error' });
255
278
256
279
expect (event.cameraId, 1 );
257
280
expect (event.description, 'Error' );
@@ -290,7 +313,8 @@ void main() {
290
313
291
314
test ('hashCode should match hashCode of all properties' , () {
292
315
final event = CameraErrorEvent (1 , 'Error' );
293
- final expectedHashCode = event.cameraId.hashCode ^ event.description.hashCode;
316
+ final expectedHashCode =
317
+ event.cameraId.hashCode ^ event.description.hashCode;
294
318
295
319
expect (event.hashCode, expectedHashCode);
296
320
});
0 commit comments