@@ -13,7 +13,7 @@ void main() {
13
13
group ('CameraInitializedEvent tests' , () {
14
14
test ('Constructor should initialize all properties' , () {
15
15
final event = CameraInitializedEvent (
16
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
16
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
17
17
18
18
expect (event.cameraId, 1 );
19
19
expect (event.previewWidth, 1024 );
@@ -30,23 +30,23 @@ void main() {
30
30
'previewWidth' : 1024.0 ,
31
31
'previewHeight' : 640.0 ,
32
32
'exposureMode' : 'auto' ,
33
- 'focusMode' : 'auto' ,
34
33
'exposurePointSupported' : true ,
34
+ 'focusMode' : 'auto' ,
35
35
'focusPointSupported' : true
36
36
});
37
37
38
38
expect (event.cameraId, 1 );
39
39
expect (event.previewWidth, 1024 );
40
40
expect (event.previewHeight, 640 );
41
41
expect (event.exposureMode, ExposureMode .auto);
42
- expect (event.focusMode, FocusMode .auto);
43
42
expect (event.exposurePointSupported, true );
43
+ expect (event.focusMode, FocusMode .auto);
44
44
expect (event.focusPointSupported, true );
45
45
});
46
46
47
47
test ('toJson should return a map with all fields' , () {
48
48
final event = CameraInitializedEvent (
49
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
49
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
50
50
51
51
final jsonMap = event.toJson ();
52
52
@@ -55,93 +55,93 @@ void main() {
55
55
expect (jsonMap['previewWidth' ], 1024 );
56
56
expect (jsonMap['previewHeight' ], 640 );
57
57
expect (jsonMap['exposureMode' ], 'auto' );
58
- expect (jsonMap['focusMode' ], 'auto' );
59
58
expect (jsonMap['exposurePointSupported' ], true );
59
+ expect (jsonMap['focusMode' ], 'auto' );
60
60
expect (jsonMap['focusPointSupported' ], true );
61
61
});
62
62
63
63
test ('equals should return true if objects are the same' , () {
64
64
final firstEvent = CameraInitializedEvent (
65
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
65
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
66
66
final secondEvent = CameraInitializedEvent (
67
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
67
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
68
68
69
69
expect (firstEvent == secondEvent, true );
70
70
});
71
71
72
72
test ('equals should return false if cameraId is different' , () {
73
73
final firstEvent = CameraInitializedEvent (
74
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
74
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
75
75
final secondEvent = CameraInitializedEvent (
76
- 2 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
76
+ 2 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
77
77
78
78
expect (firstEvent == secondEvent, false );
79
79
});
80
80
81
81
test ('equals should return false if previewWidth is different' , () {
82
82
final firstEvent = CameraInitializedEvent (
83
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
83
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
84
84
final secondEvent = CameraInitializedEvent (
85
- 1 , 2048 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
85
+ 1 , 2048 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
86
86
87
87
expect (firstEvent == secondEvent, false );
88
88
});
89
89
90
90
test ('equals should return false if previewHeight is different' , () {
91
91
final firstEvent = CameraInitializedEvent (
92
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
92
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
93
93
final secondEvent = CameraInitializedEvent (
94
- 1 , 1024 , 980 , ExposureMode .auto, FocusMode .auto, true , true );
94
+ 1 , 1024 , 980 , ExposureMode .auto, true , FocusMode .auto, true );
95
95
96
96
expect (firstEvent == secondEvent, false );
97
97
});
98
98
99
99
test ('equals should return false if exposureMode is different' , () {
100
100
final firstEvent = CameraInitializedEvent (
101
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
101
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
102
102
final secondEvent = CameraInitializedEvent (
103
- 1 , 1024 , 640 , ExposureMode .locked, FocusMode .auto, true , true );
103
+ 1 , 1024 , 640 , ExposureMode .locked, true , FocusMode .auto, true );
104
104
105
105
expect (firstEvent == secondEvent, false );
106
106
});
107
107
108
108
test ('equals should return false if exposurePointSupported is different' ,
109
109
() {
110
110
final firstEvent = CameraInitializedEvent (
111
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
111
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
112
112
final secondEvent = CameraInitializedEvent (
113
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, false , true );
113
+ 1 , 1024 , 640 , ExposureMode .auto, false , FocusMode .auto, true );
114
114
115
115
expect (firstEvent == secondEvent, false );
116
116
});
117
117
118
118
test ('equals should return false if focusMode is different' , () {
119
119
final firstEvent = CameraInitializedEvent (
120
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
120
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
121
121
final secondEvent = CameraInitializedEvent (
122
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .locked, true , true );
122
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .locked, true );
123
123
124
124
expect (firstEvent == secondEvent, false );
125
125
});
126
126
127
127
test ('equals should return false if focusPointSupported is different' , () {
128
128
final firstEvent = CameraInitializedEvent (
129
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
129
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
130
130
final secondEvent = CameraInitializedEvent (
131
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , false );
131
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, false );
132
132
133
133
expect (firstEvent == secondEvent, false );
134
134
});
135
135
136
136
test ('hashCode should match hashCode of all properties' , () {
137
137
final event = CameraInitializedEvent (
138
- 1 , 1024 , 640 , ExposureMode .auto, FocusMode .auto, true , true );
138
+ 1 , 1024 , 640 , ExposureMode .auto, true , FocusMode .auto, true );
139
139
final expectedHashCode = event.cameraId.hashCode ^
140
140
event.previewWidth.hashCode ^
141
141
event.previewHeight.hashCode ^
142
142
event.exposureMode.hashCode ^
143
- event.focusMode.hashCode ^
144
143
event.exposurePointSupported.hashCode ^
144
+ event.focusMode.hashCode ^
145
145
event.focusPointSupported.hashCode;
146
146
147
147
expect (event.hashCode, expectedHashCode);
0 commit comments