Skip to content

Commit eeecbd4

Browse files
[google_maps_flutter] Add support for version 8 of the iOS SDK (flutter#5528)
- Increases the max allowed SDK version to 8.x - Adds a new iOS 14 example app, per [the documented test structure/plan](https://github.com/flutter/packages/blob/main/packages/google_maps_flutter/google_maps_flutter_ios/example/README.md) - Moves recently added XCUITests to the iOS 11 example app, where they should have been (per doc linked above). I missed this when reviewing the addition, and noticed that it was incorrectly in the iOS 13 example while duplicating the iOS 13 example for the iOS 14 version. Fixes flutter#138972
1 parent 293b071 commit eeecbd4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1676
-213
lines changed

packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
## NEXT
1+
## 2.3.3
22

3+
* Adds support for version 8 of the Google Maps SDK in apps targeting iOS 14+.
34
* Updates minimum supported SDK version to Flutter 3.10/Dart 3.0.
45

56
## 2.3.2

packages/google_maps_flutter/google_maps_flutter_ios/example/ios11/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
97C146E61CF9000F007C117D /* Project object */ = {
283283
isa = PBXProject;
284284
attributes = {
285-
LastUpgradeCheck = 1300;
285+
LastUpgradeCheck = 1430;
286286
ORGANIZATIONNAME = "The Flutter Authors";
287287
TargetAttributes = {
288288
97C146ED1CF9000F007C117D = {

packages/google_maps_flutter/google_maps_flutter_ios/example/ios11/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1300"
3+
LastUpgradeVersion = "1430"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

packages/google_maps_flutter/google_maps_flutter_ios/example/ios11/ios/RunnerUITests/GoogleMapsUITests.m

Lines changed: 78 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
@import XCTest;
77
@import os.log;
88

9+
static const NSTimeInterval kWaitTime = 60;
10+
911
@interface GoogleMapsUITests : XCTestCase
1012
@property(nonatomic, strong) XCUIApplication *app;
1113
@end
@@ -25,7 +27,7 @@ - (void)setUp {
2527
XCUIElement *locationPermission =
2628
interruptingElement.buttons[@"Allow While Using App"];
2729
if (![locationPermission
28-
waitForExistenceWithTimeout:30.0]) {
30+
waitForExistenceWithTimeout:kWaitTime]) {
2931
XCTFail(@"Failed due to not able to find "
3032
@"locationPermission button");
3133
}
@@ -34,7 +36,7 @@ - (void)setUp {
3436
} else {
3537
XCUIElement *allow =
3638
interruptingElement.buttons[@"Allow"];
37-
if (![allow waitForExistenceWithTimeout:30.0]) {
39+
if (![allow waitForExistenceWithTimeout:kWaitTime]) {
3840
XCTFail(@"Failed due to not able to find Allow button");
3941
}
4042
[allow tap];
@@ -46,14 +48,14 @@ - (void)setUp {
4648
- (void)testUserInterface {
4749
XCUIApplication *app = self.app;
4850
XCUIElement *userInteface = app.staticTexts[@"User interface"];
49-
if (![userInteface waitForExistenceWithTimeout:30.0]) {
51+
if (![userInteface waitForExistenceWithTimeout:kWaitTime]) {
5052
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
5153
XCTFail(@"Failed due to not able to find User interface");
5254
}
5355
[userInteface tap];
5456

5557
XCUIElement *platformView = app.otherElements[@"platform_view[0]"];
56-
if (![platformView waitForExistenceWithTimeout:30.0]) {
58+
if (![platformView waitForExistenceWithTimeout:kWaitTime]) {
5759
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
5860
XCTFail(@"Failed due to not able to find platform view");
5961
}
@@ -66,7 +68,7 @@ - (void)testUserInterface {
6668
XCUICoordinate *coordinate = [app coordinateWithNormalizedOffset:CGVectorMake(0, 0)];
6769
[coordinate tap];
6870
XCUIElement *compass = app.buttons[@"disable compass"];
69-
if (![compass waitForExistenceWithTimeout:30.0]) {
71+
if (![compass waitForExistenceWithTimeout:kWaitTime]) {
7072
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
7173
XCTFail(@"Failed due to not able to find disable compass button");
7274
}
@@ -77,20 +79,20 @@ - (void)testUserInterface {
7779
- (void)testMapCoordinatesPage {
7880
XCUIApplication *app = self.app;
7981
XCUIElement *mapCoordinates = app.staticTexts[@"Map coordinates"];
80-
if (![mapCoordinates waitForExistenceWithTimeout:30.0]) {
82+
if (![mapCoordinates waitForExistenceWithTimeout:kWaitTime]) {
8183
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
8284
XCTFail(@"Failed due to not able to find 'Map coordinates''");
8385
}
8486
[mapCoordinates tap];
8587

8688
XCUIElement *platformView = app.otherElements[@"platform_view[0]"];
87-
if (![platformView waitForExistenceWithTimeout:30.0]) {
89+
if (![platformView waitForExistenceWithTimeout:kWaitTime]) {
8890
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
8991
XCTFail(@"Failed due to not able to find platform view");
9092
}
9193

9294
XCUIElement *titleBar = app.otherElements[@"Map coordinates"];
93-
if (![titleBar waitForExistenceWithTimeout:30.0]) {
95+
if (![titleBar waitForExistenceWithTimeout:kWaitTime]) {
9496
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
9597
XCTFail(@"Failed due to not able to find title bar");
9698
}
@@ -99,7 +101,7 @@ - (void)testMapCoordinatesPage {
99101
[NSPredicate predicateWithFormat:@"label BEGINSWITH 'VisibleRegion'"];
100102
XCUIElement *visibleRegionText =
101103
[app.staticTexts elementMatchingPredicate:visibleRegionPredicate];
102-
if (![visibleRegionText waitForExistenceWithTimeout:30.0]) {
104+
if (![visibleRegionText waitForExistenceWithTimeout:kWaitTime]) {
103105
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
104106
XCTFail(@"Failed due to not able to find Visible Region label'");
105107
}
@@ -168,30 +170,30 @@ - (void)validateVisibleRegion:(NSString *)label
168170
- (void)testMapClickPage {
169171
XCUIApplication *app = self.app;
170172
XCUIElement *mapClick = app.staticTexts[@"Map click"];
171-
if (![mapClick waitForExistenceWithTimeout:30.0]) {
173+
if (![mapClick waitForExistenceWithTimeout:kWaitTime]) {
172174
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
173175
XCTFail(@"Failed due to not able to find 'Map click''");
174176
}
175177
[mapClick tap];
176178

177179
XCUIElement *platformView = app.otherElements[@"platform_view[0]"];
178-
if (![platformView waitForExistenceWithTimeout:30.0]) {
180+
if (![platformView waitForExistenceWithTimeout:kWaitTime]) {
179181
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
180182
XCTFail(@"Failed due to not able to find platform view");
181183
}
182184

183185
[platformView tap];
184186

185187
XCUIElement *tapped = app.staticTexts[@"Tapped"];
186-
if (![tapped waitForExistenceWithTimeout:30.0]) {
188+
if (![tapped waitForExistenceWithTimeout:kWaitTime]) {
187189
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
188190
XCTFail(@"Failed due to not able to find 'tapped''");
189191
}
190192

191193
[platformView pressForDuration:5.0];
192194

193195
XCUIElement *longPressed = app.staticTexts[@"Long pressed"];
194-
if (![longPressed waitForExistenceWithTimeout:30.0]) {
196+
if (![longPressed waitForExistenceWithTimeout:kWaitTime]) {
195197
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
196198
XCTFail(@"Failed due to not able to find 'longPressed''");
197199
}
@@ -209,4 +211,67 @@ - (void)forceTap:(XCUIElement *)button {
209211
[coordinate tap];
210212
}
211213

214+
- (void)testMarkerDraggingCallbacks {
215+
XCUIApplication *application = [[XCUIApplication alloc] init];
216+
[application launch];
217+
XCUIElement *placeMarkerButton = application.staticTexts[@"Place marker"];
218+
if (![placeMarkerButton waitForExistenceWithTimeout:kWaitTime]) {
219+
NSLog(@"application.debugDescription: %@", application.debugDescription);
220+
XCTFail(@"Failed to find the Place marker button.");
221+
}
222+
[placeMarkerButton tap];
223+
224+
XCUIElement *Add = application.buttons[@"Add"];
225+
if (![Add waitForExistenceWithTimeout:kWaitTime]) {
226+
NSLog(@"application.debugDescription: %@", application.debugDescription);
227+
XCTFail(@"Failed to find the Add button.");
228+
}
229+
[Add tap];
230+
231+
XCUIElement *marker = application.buttons[@"marker_id_1"];
232+
if (![marker waitForExistenceWithTimeout:kWaitTime]) {
233+
NSLog(@"application.debugDescription: %@", application.debugDescription);
234+
XCTFail(@"Failed to find the marker.");
235+
}
236+
[marker tap];
237+
238+
XCUIElement *toggleDraggable = application.buttons[@"toggle draggable"];
239+
if (![toggleDraggable waitForExistenceWithTimeout:kWaitTime]) {
240+
NSLog(@"application.debugDescription: %@", application.debugDescription);
241+
XCTFail(@"Failed to find the toggle draggable.");
242+
}
243+
[toggleDraggable tap];
244+
245+
// Drag marker to center
246+
[marker pressForDuration:5 thenDragToElement:application];
247+
248+
NSPredicate *predicateDragStart =
249+
[NSPredicate predicateWithFormat:@"label CONTAINS[c] %@", @"_onMarkerDragStart"];
250+
NSPredicate *predicateDrag =
251+
[NSPredicate predicateWithFormat:@"label CONTAINS[c] %@", @"_onMarkerDrag called"];
252+
NSPredicate *predicateDragEnd =
253+
[NSPredicate predicateWithFormat:@"label CONTAINS[c] %@", @"_onMarkerDragEnd"];
254+
255+
XCUIElement *dragStart = [application.staticTexts matchingPredicate:predicateDragStart].element;
256+
if (![dragStart waitForExistenceWithTimeout:kWaitTime]) {
257+
NSLog(@"application.debugDescription: %@", application.debugDescription);
258+
XCTFail(@"Failed to find the _onMarkerDragStart.");
259+
}
260+
XCTAssertTrue(dragStart.exists);
261+
262+
XCUIElement *drag = [application.staticTexts matchingPredicate:predicateDrag].element;
263+
if (![drag waitForExistenceWithTimeout:kWaitTime]) {
264+
NSLog(@"application.debugDescription: %@", application.debugDescription);
265+
XCTFail(@"Failed to find the _onMarkerDrag.");
266+
}
267+
XCTAssertTrue(drag.exists);
268+
269+
XCUIElement *dragEnd = [application.staticTexts matchingPredicate:predicateDragEnd].element;
270+
if (![dragEnd waitForExistenceWithTimeout:kWaitTime]) {
271+
NSLog(@"application.debugDescription: %@", application.debugDescription);
272+
XCTFail(@"Failed to find the _onMarkerDragEnd.");
273+
}
274+
XCTAssertTrue(dragEnd.exists);
275+
}
276+
212277
@end

0 commit comments

Comments
 (0)