Skip to content

Commit 158ec1f

Browse files
author
Chris Yang
authored
[google_map_flutter_ios] fix didBeginDraggingMarker typo (flutter#5085)
Fix the typo in `didBeginDraggingMarker` The UITest will drag the marker then looking for the text indications that all the dragging callbacks are called, like the screenshot below: <img width="388" alt="Screenshot 2023-10-06 at 3 36 46 PM" src="https://github.com/flutter/packages/assets/3756895/d9e78c99-bb1d-4f47-a0d4-2f699fa9f743"> fixes flutter#135778
1 parent 9804d95 commit 158ec1f

File tree

8 files changed

+235
-13
lines changed

8 files changed

+235
-13
lines changed

packages/google_maps_flutter/google_maps_flutter_ios/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.3.2
2+
3+
* Fixes an issue where the onDragEnd callback for marker is not called.
4+
15
## 2.3.1
26

37
* Adds pub topics to package metadata.

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

Lines changed: 124 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
1111
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
1212
4510D964F3B1259FEDD3ABA6 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7755F8F4BABC3D6A0BD4048B /* libPods-Runner.a */; };
13+
68C9D7F72AD0A84100DF9D79 /* RunnerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 68C9D7F62AD0A84100DF9D79 /* RunnerUITests.m */; };
1314
68E4726A2836FF0C00BDDDAC /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 68E472692836FF0C00BDDDAC /* MapKit.framework */; };
1415
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
1516
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
@@ -22,6 +23,13 @@
2223
/* End PBXBuildFile section */
2324

2425
/* Begin PBXContainerItemProxy section */
26+
68C9D7FA2AD0A84100DF9D79 /* PBXContainerItemProxy */ = {
27+
isa = PBXContainerItemProxy;
28+
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
29+
proxyType = 1;
30+
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
31+
remoteInfo = Runner;
32+
};
2533
F7151F15265D7ED70028CB91 /* PBXContainerItemProxy */ = {
2634
isa = PBXContainerItemProxy;
2735
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
@@ -48,6 +56,8 @@
4856
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
4957
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
5058
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
59+
68C9D7F42AD0A84100DF9D79 /* RunnerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
60+
68C9D7F62AD0A84100DF9D79 /* RunnerUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RunnerUITests.m; sourceTree = "<group>"; };
5161
68E472692836FF0C00BDDDAC /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.0.sdk/System/iOSSupport/System/Library/Frameworks/MapKit.framework; sourceTree = DEVELOPER_DIR; };
5262
733AFAB37683A9DA7512F09C /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
5363
7755F8F4BABC3D6A0BD4048B /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -74,6 +84,13 @@
7484
/* End PBXFileReference section */
7585

7686
/* Begin PBXFrameworksBuildPhase section */
87+
68C9D7F12AD0A84100DF9D79 /* Frameworks */ = {
88+
isa = PBXFrameworksBuildPhase;
89+
buildActionMask = 2147483647;
90+
files = (
91+
);
92+
runOnlyForDeploymentPostprocessing = 0;
93+
};
7794
97C146EB1CF9000F007C117D /* Frameworks */ = {
7895
isa = PBXFrameworksBuildPhase;
7996
buildActionMask = 2147483647;
@@ -104,6 +121,14 @@
104121
name = Frameworks;
105122
sourceTree = "<group>";
106123
};
124+
68C9D7F52AD0A84100DF9D79 /* RunnerUITests */ = {
125+
isa = PBXGroup;
126+
children = (
127+
68C9D7F62AD0A84100DF9D79 /* RunnerUITests.m */,
128+
);
129+
path = RunnerUITests;
130+
sourceTree = "<group>";
131+
};
107132
9740EEB11CF90186004384FC /* Flutter */ = {
108133
isa = PBXGroup;
109134
children = (
@@ -121,6 +146,7 @@
121146
9740EEB11CF90186004384FC /* Flutter */,
122147
97C146F01CF9000F007C117D /* Runner */,
123148
F7151F11265D7ED70028CB91 /* RunnerTests */,
149+
68C9D7F52AD0A84100DF9D79 /* RunnerUITests */,
124150
97C146EF1CF9000F007C117D /* Products */,
125151
A189CFE5474BF8A07908B2E0 /* Pods */,
126152
1E7CF0857EFC88FC263CF3B2 /* Frameworks */,
@@ -132,6 +158,7 @@
132158
children = (
133159
97C146EE1CF9000F007C117D /* Runner.app */,
134160
F7151F10265D7ED70028CB91 /* RunnerTests.xctest */,
161+
68C9D7F42AD0A84100DF9D79 /* RunnerUITests.xctest */,
135162
);
136163
name = Products;
137164
sourceTree = "<group>";
@@ -185,6 +212,24 @@
185212
/* End PBXGroup section */
186213

187214
/* Begin PBXNativeTarget section */
215+
68C9D7F32AD0A84100DF9D79 /* RunnerUITests */ = {
216+
isa = PBXNativeTarget;
217+
buildConfigurationList = 68C9D7FE2AD0A84100DF9D79 /* Build configuration list for PBXNativeTarget "RunnerUITests" */;
218+
buildPhases = (
219+
68C9D7F02AD0A84100DF9D79 /* Sources */,
220+
68C9D7F12AD0A84100DF9D79 /* Frameworks */,
221+
68C9D7F22AD0A84100DF9D79 /* Resources */,
222+
);
223+
buildRules = (
224+
);
225+
dependencies = (
226+
68C9D7FB2AD0A84100DF9D79 /* PBXTargetDependency */,
227+
);
228+
name = RunnerUITests;
229+
productName = RunnerUITests;
230+
productReference = 68C9D7F42AD0A84100DF9D79 /* RunnerUITests.xctest */;
231+
productType = "com.apple.product-type.bundle.ui-testing";
232+
};
188233
97C146ED1CF9000F007C117D /* Runner */ = {
189234
isa = PBXNativeTarget;
190235
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
@@ -232,9 +277,13 @@
232277
97C146E61CF9000F007C117D /* Project object */ = {
233278
isa = PBXProject;
234279
attributes = {
235-
LastUpgradeCheck = 1300;
280+
LastUpgradeCheck = 1430;
236281
ORGANIZATIONNAME = "The Flutter Authors";
237282
TargetAttributes = {
283+
68C9D7F32AD0A84100DF9D79 = {
284+
CreatedOnToolsVersion = 15.0;
285+
TestTargetID = 97C146ED1CF9000F007C117D;
286+
};
238287
97C146ED1CF9000F007C117D = {
239288
CreatedOnToolsVersion = 7.3.1;
240289
};
@@ -260,11 +309,19 @@
260309
targets = (
261310
97C146ED1CF9000F007C117D /* Runner */,
262311
F7151F0F265D7ED70028CB91 /* RunnerTests */,
312+
68C9D7F32AD0A84100DF9D79 /* RunnerUITests */,
263313
);
264314
};
265315
/* End PBXProject section */
266316

267317
/* Begin PBXResourcesBuildPhase section */
318+
68C9D7F22AD0A84100DF9D79 /* Resources */ = {
319+
isa = PBXResourcesBuildPhase;
320+
buildActionMask = 2147483647;
321+
files = (
322+
);
323+
runOnlyForDeploymentPostprocessing = 0;
324+
};
268325
97C146EC1CF9000F007C117D /* Resources */ = {
269326
isa = PBXResourcesBuildPhase;
270327
buildActionMask = 2147483647;
@@ -379,6 +436,14 @@
379436
/* End PBXShellScriptBuildPhase section */
380437

381438
/* Begin PBXSourcesBuildPhase section */
439+
68C9D7F02AD0A84100DF9D79 /* Sources */ = {
440+
isa = PBXSourcesBuildPhase;
441+
buildActionMask = 2147483647;
442+
files = (
443+
68C9D7F72AD0A84100DF9D79 /* RunnerUITests.m in Sources */,
444+
);
445+
runOnlyForDeploymentPostprocessing = 0;
446+
};
382447
97C146EA1CF9000F007C117D /* Sources */ = {
383448
isa = PBXSourcesBuildPhase;
384449
buildActionMask = 2147483647;
@@ -401,6 +466,11 @@
401466
/* End PBXSourcesBuildPhase section */
402467

403468
/* Begin PBXTargetDependency section */
469+
68C9D7FB2AD0A84100DF9D79 /* PBXTargetDependency */ = {
470+
isa = PBXTargetDependency;
471+
target = 97C146ED1CF9000F007C117D /* Runner */;
472+
targetProxy = 68C9D7FA2AD0A84100DF9D79 /* PBXContainerItemProxy */;
473+
};
404474
F7151F16265D7ED70028CB91 /* PBXTargetDependency */ = {
405475
isa = PBXTargetDependency;
406476
target = 97C146ED1CF9000F007C117D /* Runner */;
@@ -428,6 +498,44 @@
428498
/* End PBXVariantGroup section */
429499

430500
/* Begin XCBuildConfiguration section */
501+
68C9D7FC2AD0A84100DF9D79 /* Debug */ = {
502+
isa = XCBuildConfiguration;
503+
buildSettings = {
504+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
505+
CLANG_ENABLE_MODULES = YES;
506+
CODE_SIGN_STYLE = Automatic;
507+
CURRENT_PROJECT_VERSION = 1;
508+
ENABLE_USER_SCRIPT_SANDBOXING = YES;
509+
GENERATE_INFOPLIST_FILE = YES;
510+
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
511+
MARKETING_VERSION = 1.0;
512+
PRODUCT_BUNDLE_IDENTIFIER = com.example.RunnerUITests;
513+
PRODUCT_NAME = "$(TARGET_NAME)";
514+
SWIFT_EMIT_LOC_STRINGS = NO;
515+
TARGETED_DEVICE_FAMILY = "1,2";
516+
TEST_TARGET_NAME = Runner;
517+
};
518+
name = Debug;
519+
};
520+
68C9D7FD2AD0A84100DF9D79 /* Release */ = {
521+
isa = XCBuildConfiguration;
522+
buildSettings = {
523+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
524+
CLANG_ENABLE_MODULES = YES;
525+
CODE_SIGN_STYLE = Automatic;
526+
CURRENT_PROJECT_VERSION = 1;
527+
ENABLE_USER_SCRIPT_SANDBOXING = YES;
528+
GENERATE_INFOPLIST_FILE = YES;
529+
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
530+
MARKETING_VERSION = 1.0;
531+
PRODUCT_BUNDLE_IDENTIFIER = com.example.RunnerUITests;
532+
PRODUCT_NAME = "$(TARGET_NAME)";
533+
SWIFT_EMIT_LOC_STRINGS = NO;
534+
TARGETED_DEVICE_FAMILY = "1,2";
535+
TEST_TARGET_NAME = Runner;
536+
};
537+
name = Release;
538+
};
431539
97C147031CF9000F007C117D /* Debug */ = {
432540
isa = XCBuildConfiguration;
433541
buildSettings = {
@@ -541,6 +649,8 @@
541649
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
542650
buildSettings = {
543651
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
652+
CLANG_ENABLE_MODULES = YES;
653+
DEVELOPMENT_TEAM = "";
544654
ENABLE_BITCODE = NO;
545655
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
546656
FRAMEWORK_SEARCH_PATHS = (
@@ -566,6 +676,8 @@
566676
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
567677
buildSettings = {
568678
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
679+
CLANG_ENABLE_MODULES = YES;
680+
DEVELOPMENT_TEAM = "";
569681
ENABLE_BITCODE = NO;
570682
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
571683
FRAMEWORK_SEARCH_PATHS = (
@@ -591,6 +703,7 @@
591703
baseConfigurationReference = E52C6A6210A56F027C582EF9 /* Pods-RunnerTests.debug.xcconfig */;
592704
buildSettings = {
593705
BUNDLE_LOADER = "$(TEST_HOST)";
706+
CLANG_ENABLE_MODULES = YES;
594707
CODE_SIGN_STYLE = Automatic;
595708
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
596709
INFOPLIST_FILE = RunnerTests/Info.plist;
@@ -599,7 +712,6 @@
599712
"@executable_path/Frameworks",
600713
"@loader_path/Frameworks",
601714
);
602-
MTL_FAST_MATH = YES;
603715
PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests;
604716
PRODUCT_NAME = "$(TARGET_NAME)";
605717
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
@@ -611,6 +723,7 @@
611723
baseConfigurationReference = 733AFAB37683A9DA7512F09C /* Pods-RunnerTests.release.xcconfig */;
612724
buildSettings = {
613725
BUNDLE_LOADER = "$(TEST_HOST)";
726+
CLANG_ENABLE_MODULES = YES;
614727
CODE_SIGN_STYLE = Automatic;
615728
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
616729
INFOPLIST_FILE = RunnerTests/Info.plist;
@@ -619,7 +732,6 @@
619732
"@executable_path/Frameworks",
620733
"@loader_path/Frameworks",
621734
);
622-
MTL_FAST_MATH = YES;
623735
PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests;
624736
PRODUCT_NAME = "$(TARGET_NAME)";
625737
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
@@ -629,6 +741,15 @@
629741
/* End XCBuildConfiguration section */
630742

631743
/* Begin XCConfigurationList section */
744+
68C9D7FE2AD0A84100DF9D79 /* Build configuration list for PBXNativeTarget "RunnerUITests" */ = {
745+
isa = XCConfigurationList;
746+
buildConfigurations = (
747+
68C9D7FC2AD0A84100DF9D79 /* Debug */,
748+
68C9D7FD2AD0A84100DF9D79 /* Release */,
749+
);
750+
defaultConfigurationIsVisible = 0;
751+
defaultConfigurationName = Release;
752+
};
632753
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
633754
isa = XCConfigurationList;
634755
buildConfigurations = (

packages/google_maps_flutter/google_maps_flutter_ios/example/ios13/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/ios13/ios/Runner/Info.plist

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>CADisableMinimumFrameDurationOnPhone</key>
6+
<true/>
57
<key>CFBundleDevelopmentRegion</key>
68
<string>en</string>
79
<key>CFBundleExecutable</key>
@@ -24,6 +26,8 @@
2426
<true/>
2527
<key>NSLocationWhenInUseUsageDescription</key>
2628
<string>This app needs your location to test the location feature of the Google Maps plugin.</string>
29+
<key>UIApplicationSupportsIndirectInputEvents</key>
30+
<true/>
2731
<key>UILaunchStoryboardName</key>
2832
<string>LaunchScreen</string>
2933
<key>UIMainStoryboardFile</key>
@@ -45,9 +49,5 @@
4549
<string>UIInterfaceOrientationLandscapeLeft</string>
4650
<string>UIInterfaceOrientationLandscapeRight</string>
4751
</array>
48-
<key>CADisableMinimumFrameDurationOnPhone</key>
49-
<true/>
50-
<key>UIApplicationSupportsIndirectInputEvents</key>
51-
<true/>
5252
</dict>
5353
</plist>
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#import <XCTest/XCTest.h>
6+
7+
static const NSTimeInterval kWaitTime = 60;
8+
9+
@interface RunnerUITests : XCTestCase
10+
11+
@end
12+
13+
@implementation RunnerUITests
14+
15+
- (void)testMarkerDraggingCallbacks {
16+
XCUIApplication *application = [[XCUIApplication alloc] init];
17+
[application launch];
18+
XCUIElement *placeMarkerButton = application.staticTexts[@"Place marker"];
19+
if (![placeMarkerButton waitForExistenceWithTimeout:kWaitTime]) {
20+
NSLog(@"application.debugDescription: %@", application.debugDescription);
21+
XCTFail(@"Failed to find the Place marker button.");
22+
}
23+
[placeMarkerButton tap];
24+
25+
XCUIElement *Add = application.buttons[@"Add"];
26+
if (![Add waitForExistenceWithTimeout:kWaitTime]) {
27+
NSLog(@"application.debugDescription: %@", application.debugDescription);
28+
XCTFail(@"Failed to find the Add button.");
29+
}
30+
[Add tap];
31+
32+
XCUIElement *marker = application.buttons[@"marker_id_1"];
33+
if (![marker waitForExistenceWithTimeout:kWaitTime]) {
34+
NSLog(@"application.debugDescription: %@", application.debugDescription);
35+
XCTFail(@"Failed to find the marker.");
36+
}
37+
[marker tap];
38+
39+
XCUIElement *toggleDraggable = application.buttons[@"toggle draggable"];
40+
if (![toggleDraggable waitForExistenceWithTimeout:kWaitTime]) {
41+
NSLog(@"application.debugDescription: %@", application.debugDescription);
42+
XCTFail(@"Failed to find the toggle draggable.");
43+
}
44+
[toggleDraggable tap];
45+
46+
// Drag marker to center
47+
[marker pressForDuration:5 thenDragToElement:application];
48+
49+
NSPredicate *predicateDragStart =
50+
[NSPredicate predicateWithFormat:@"label CONTAINS[c] %@", @"_onMarkerDragStart"];
51+
NSPredicate *predicateDrag =
52+
[NSPredicate predicateWithFormat:@"label CONTAINS[c] %@", @"_onMarkerDrag called"];
53+
NSPredicate *predicateDragEnd =
54+
[NSPredicate predicateWithFormat:@"label CONTAINS[c] %@", @"_onMarkerDragEnd"];
55+
56+
XCUIElement *dragStart = [application.staticTexts matchingPredicate:predicateDragStart].element;
57+
if (![dragStart waitForExistenceWithTimeout:kWaitTime]) {
58+
NSLog(@"application.debugDescription: %@", application.debugDescription);
59+
XCTFail(@"Failed to find the _onMarkerDragStart.");
60+
}
61+
XCTAssertTrue(dragStart.exists);
62+
63+
XCUIElement *drag = [application.staticTexts matchingPredicate:predicateDrag].element;
64+
if (![drag waitForExistenceWithTimeout:kWaitTime]) {
65+
NSLog(@"application.debugDescription: %@", application.debugDescription);
66+
XCTFail(@"Failed to find the _onMarkerDrag.");
67+
}
68+
XCTAssertTrue(drag.exists);
69+
70+
XCUIElement *dragEnd = [application.staticTexts matchingPredicate:predicateDragEnd].element;
71+
if (![dragEnd waitForExistenceWithTimeout:kWaitTime]) {
72+
NSLog(@"application.debugDescription: %@", application.debugDescription);
73+
XCTFail(@"Failed to find the _onMarkerDragEnd.");
74+
}
75+
XCTAssertTrue(dragEnd.exists);
76+
}
77+
78+
@end

0 commit comments

Comments
 (0)