blob: f03dca24fe7cab298f2cc63e66d6f38723156ff3 [file] [log] [blame]
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@import google_maps_flutter;
@import google_maps_flutter.Test;
@import XCTest;
#import <OCMock/OCMock.h>
#import "PartiallyMockedMapView.h"
@interface GoogleMapsTests : XCTestCase
@end
@implementation GoogleMapsTests
- (void)testPlugin {
FLTGoogleMapsPlugin *plugin = [[FLTGoogleMapsPlugin alloc] init];
XCTAssertNotNil(plugin);
}
- (void)testFrameObserver {
id registrar = OCMProtocolMock(@protocol(FlutterPluginRegistrar));
CGRect frame = CGRectMake(0, 0, 100, 100);
PartiallyMockedMapView *mapView = [[PartiallyMockedMapView alloc]
initWithFrame:frame
camera:[[GMSCameraPosition alloc] initWithLatitude:0 longitude:0 zoom:0]];
FLTGoogleMapController *controller = [[FLTGoogleMapController alloc] initWithMapView:mapView
viewIdentifier:0
arguments:nil
registrar:registrar];
for (NSInteger i = 0; i < 10; ++i) {
[controller view];
}
XCTAssertEqual(mapView.frameObserverCount, 1);
mapView.frame = frame;
XCTAssertEqual(mapView.frameObserverCount, 0);
}
@end