@@ -113,25 +113,26 @@ - (void)testDictionaryFromPosition {
113113 XCTAssertEqualObjects (dictionary[@" tilt" ], @75.0 );
114114}
115115
116- - (void )testDictionaryFromPoint {
116+ - (void )testPigeonPointForGCPoint {
117117 CGPoint point = CGPointMake (10 , 20 );
118- NSDictionary *dictionary = [FLTGoogleMapJSONConversions dictionaryFromPoint: point];
119- const CGFloat accuracy = 0.0001 ;
120- XCTAssertEqualWithAccuracy ([dictionary[@" x" ] floatValue ], point.x , accuracy);
121- XCTAssertEqualWithAccuracy ([dictionary[@" y" ] floatValue ], point.y , accuracy);
118+ FGMPlatformPoint *pigeonPoint = FGMGetPigeonPointForCGPoint (point);
119+ XCTAssertEqualWithAccuracy (pigeonPoint.x , point.x , DBL_EPSILON);
120+ XCTAssertEqualWithAccuracy (pigeonPoint.y , point.y , DBL_EPSILON);
122121}
123122
124- - (void )testDictionaryFromCoordinateBounds {
125- XCTAssertNil ([FLTGoogleMapJSONConversions dictionaryFromCoordinateBounds: nil ]);
126-
123+ - (void )testPigeonLatLngBoundsForCoordinateBounds {
127124 GMSCoordinateBounds *bounds =
128125 [[GMSCoordinateBounds alloc ] initWithCoordinate: CLLocationCoordinate2DMake (10 , 20 )
129126 coordinate: CLLocationCoordinate2DMake (30 , 40 )];
130- NSDictionary *dictionary = [FLTGoogleMapJSONConversions dictionaryFromCoordinateBounds: bounds];
131- NSArray *southwest = @[ @10 , @20 ];
132- NSArray *northeast = @[ @30 , @40 ];
133- XCTAssertEqualObjects (dictionary[@" southwest" ], southwest);
134- XCTAssertEqualObjects (dictionary[@" northeast" ], northeast);
127+ FGMPlatformLatLngBounds *pigeonBounds = FGMGetPigeonLatLngBoundsForCoordinateBounds (bounds);
128+ XCTAssertEqualWithAccuracy (pigeonBounds.southwest .latitude , bounds.southWest .latitude ,
129+ DBL_EPSILON);
130+ XCTAssertEqualWithAccuracy (pigeonBounds.southwest .longitude , bounds.southWest .longitude ,
131+ DBL_EPSILON);
132+ XCTAssertEqualWithAccuracy (pigeonBounds.northeast .latitude , bounds.northEast .latitude ,
133+ DBL_EPSILON);
134+ XCTAssertEqualWithAccuracy (pigeonBounds.northeast .longitude , bounds.northEast .longitude ,
135+ DBL_EPSILON);
135136}
136137
137138- (void )testCameraPostionFromDictionary {
@@ -151,19 +152,13 @@ - (void)testCameraPostionFromDictionary {
151152 XCTAssertEqualWithAccuracy (cameraPosition.viewingAngle , 5 , accuracy);
152153}
153154
154- - (void )testPointFromDictionary {
155- XCTAssertNil ([FLTGoogleMapJSONConversions cameraPostionFromDictionary: nil ]) ;
155+ - (void )testCGPointForPigeonPoint {
156+ FGMPlatformPoint *pigeonPoint = [FGMPlatformPoint makeWithX: 1.0 y: 2.0 ] ;
156157
157- NSDictionary *dictionary = @{
158- @" x" : @1 ,
159- @" y" : @2 ,
160- };
158+ CGPoint point = FGMGetCGPointForPigeonPoint (pigeonPoint);
161159
162- CGPoint point = [FLTGoogleMapJSONConversions pointFromDictionary: dictionary];
163-
164- const CGFloat accuracy = 0.001 ;
165- XCTAssertEqualWithAccuracy (point.x , 1 , accuracy);
166- XCTAssertEqualWithAccuracy (point.y , 2 , accuracy);
160+ XCTAssertEqualWithAccuracy (pigeonPoint.x , point.x , DBL_EPSILON);
161+ XCTAssertEqualWithAccuracy (pigeonPoint.y , point.y , DBL_EPSILON);
167162}
168163
169164- (void )testCoordinateBoundsFromLatLongs {
@@ -188,18 +183,18 @@ - (void)testMapViewTypeFromTypeValue {
188183 XCTAssertEqual (kGMSTypeNone , [FLTGoogleMapJSONConversions mapViewTypeFromTypeValue: @5 ]);
189184}
190185
191- - (void )testCameraUpdateFromChannelValueNewCameraPosition {
186+ - (void )testCameraUpdateFromArrayNewCameraPosition {
192187 NSArray *channelValue = @[
193188 @" newCameraPosition" , @{@" target" : @[ @1 , @2 ], @" zoom" : @3 , @" bearing" : @4 , @" tilt" : @5 }
194189 ];
195190 id classMockCameraUpdate = OCMClassMock ([GMSCameraUpdate class ]);
196- [FLTGoogleMapJSONConversions cameraUpdateFromChannelValue : channelValue];
191+ [FLTGoogleMapJSONConversions cameraUpdateFromArray : channelValue];
197192 [[classMockCameraUpdate expect ]
198193 setCamera: [FLTGoogleMapJSONConversions cameraPostionFromDictionary: channelValue[1 ]]];
199194 [classMockCameraUpdate stopMocking ];
200195}
201196
202- // TODO(cyanglaz): Fix the test for CameraUpdateFromChannelValue with the "NewLatlng" key.
197+ // TODO(cyanglaz): Fix the test for cameraUpdateFromArray with the "NewLatlng" key.
203198// 2 approaches have been tried and neither worked for the tests.
204199//
205200// 1. Use OCMock to vefiry that [GMSCameraUpdate setTarget:] is triggered with the correct value.
@@ -213,10 +208,10 @@ - (void)testCameraUpdateFromChannelValueNewCameraPosition {
213208// verified.
214209//
215210// The code in below test uses the 2nd approach.
216- - (void )skip_testCameraUpdateFromChannelValueNewLatLong {
211+ - (void )skip_testCameraUpdateFromArrayNewLatLong {
217212 NSArray *channelValue = @[ @" newLatLng" , @[ @1 , @2 ] ];
218213
219- GMSCameraUpdate *update = [FLTGoogleMapJSONConversions cameraUpdateFromChannelValue : channelValue];
214+ GMSCameraUpdate *update = [FLTGoogleMapJSONConversions cameraUpdateFromArray : channelValue];
220215
221216 GMSMapViewOptions *options = [[GMSMapViewOptions alloc ] init ];
222217 options.frame = CGRectZero;
@@ -230,81 +225,81 @@ - (void)skip_testCameraUpdateFromChannelValueNewLatLong {
230225 accuracy); // mapView.camera.target.longitude is still 6.
231226}
232227
233- - (void )testCameraUpdateFromChannelValueNewLatLngBounds {
228+ - (void )testCameraUpdateFromArrayNewLatLngBounds {
234229 NSArray <NSNumber *> *latlong1 = @[ @1 , @2 ];
235230 NSArray <NSNumber *> *latlong2 = @[ @(3 ), @(4 ) ];
236231 GMSCoordinateBounds *bounds =
237232 [FLTGoogleMapJSONConversions coordinateBoundsFromLatLongs: @[ latlong1, latlong2 ]];
238233
239234 NSArray *channelValue = @[ @" newLatLngBounds" , @[ latlong1, latlong2 ], @20 ];
240235 id classMockCameraUpdate = OCMClassMock ([GMSCameraUpdate class ]);
241- [FLTGoogleMapJSONConversions cameraUpdateFromChannelValue : channelValue];
236+ [FLTGoogleMapJSONConversions cameraUpdateFromArray : channelValue];
242237
243238 [[classMockCameraUpdate expect ] fitBounds: bounds withPadding: 20 ];
244239 [classMockCameraUpdate stopMocking ];
245240}
246241
247- - (void )testCameraUpdateFromChannelValueNewLatLngZoom {
242+ - (void )testCameraUpdateFromArrayNewLatLngZoom {
248243 NSArray *channelValue = @[ @" newLatLngZoom" , @[ @1 , @2 ], @3 ];
249244
250245 id classMockCameraUpdate = OCMClassMock ([GMSCameraUpdate class ]);
251- [FLTGoogleMapJSONConversions cameraUpdateFromChannelValue : channelValue];
246+ [FLTGoogleMapJSONConversions cameraUpdateFromArray : channelValue];
252247
253248 [[classMockCameraUpdate expect ] setTarget: CLLocationCoordinate2DMake (1 , 2 ) zoom: 3 ];
254249 [classMockCameraUpdate stopMocking ];
255250}
256251
257- - (void )testCameraUpdateFromChannelValueScrollBy {
252+ - (void )testCameraUpdateFromArrayScrollBy {
258253 NSArray *channelValue = @[ @" scrollBy" , @1 , @2 ];
259254
260255 id classMockCameraUpdate = OCMClassMock ([GMSCameraUpdate class ]);
261- [FLTGoogleMapJSONConversions cameraUpdateFromChannelValue : channelValue];
256+ [FLTGoogleMapJSONConversions cameraUpdateFromArray : channelValue];
262257
263258 [[classMockCameraUpdate expect ] scrollByX: 1 Y: 2 ];
264259 [classMockCameraUpdate stopMocking ];
265260}
266261
267- - (void )testCameraUpdateFromChannelValueZoomBy {
262+ - (void )testCameraUpdateFromArrayZoomBy {
268263 NSArray *channelValueNoPoint = @[ @" zoomBy" , @1 ];
269264
270265 id classMockCameraUpdate = OCMClassMock ([GMSCameraUpdate class ]);
271- [FLTGoogleMapJSONConversions cameraUpdateFromChannelValue : channelValueNoPoint];
266+ [FLTGoogleMapJSONConversions cameraUpdateFromArray : channelValueNoPoint];
272267
273268 [[classMockCameraUpdate expect ] zoomBy: 1 ];
274269
275270 NSArray *channelValueWithPoint = @[ @" zoomBy" , @1 , @[ @2 , @3 ] ];
276271
277- [FLTGoogleMapJSONConversions cameraUpdateFromChannelValue : channelValueWithPoint];
272+ [FLTGoogleMapJSONConversions cameraUpdateFromArray : channelValueWithPoint];
278273
279274 [[classMockCameraUpdate expect ] zoomBy: 1 atPoint: CGPointMake (2 , 3 )];
280275 [classMockCameraUpdate stopMocking ];
281276}
282277
283- - (void )testCameraUpdateFromChannelValueZoomIn {
278+ - (void )testCameraUpdateFromArrayZoomIn {
284279 NSArray *channelValueNoPoint = @[ @" zoomIn" ];
285280
286281 id classMockCameraUpdate = OCMClassMock ([GMSCameraUpdate class ]);
287- [FLTGoogleMapJSONConversions cameraUpdateFromChannelValue : channelValueNoPoint];
282+ [FLTGoogleMapJSONConversions cameraUpdateFromArray : channelValueNoPoint];
288283
289284 [[classMockCameraUpdate expect ] zoomIn ];
290285 [classMockCameraUpdate stopMocking ];
291286}
292287
293- - (void )testCameraUpdateFromChannelValueZoomOut {
288+ - (void )testCameraUpdateFromArrayZoomOut {
294289 NSArray *channelValueNoPoint = @[ @" zoomOut" ];
295290
296291 id classMockCameraUpdate = OCMClassMock ([GMSCameraUpdate class ]);
297- [FLTGoogleMapJSONConversions cameraUpdateFromChannelValue : channelValueNoPoint];
292+ [FLTGoogleMapJSONConversions cameraUpdateFromArray : channelValueNoPoint];
298293
299294 [[classMockCameraUpdate expect ] zoomOut ];
300295 [classMockCameraUpdate stopMocking ];
301296}
302297
303- - (void )testCameraUpdateFromChannelValueZoomTo {
298+ - (void )testCameraUpdateFromArrayZoomTo {
304299 NSArray *channelValueNoPoint = @[ @" zoomTo" , @1 ];
305300
306301 id classMockCameraUpdate = OCMClassMock ([GMSCameraUpdate class ]);
307- [FLTGoogleMapJSONConversions cameraUpdateFromChannelValue : channelValueNoPoint];
302+ [FLTGoogleMapJSONConversions cameraUpdateFromArray : channelValueNoPoint];
308303
309304 [[classMockCameraUpdate expect ] zoomTo: 1 ];
310305 [classMockCameraUpdate stopMocking ];
0 commit comments