Skip to content

Commit

Permalink
[google_map_flutter_ios] fix didBeginDraggingMarker typo (#5085)
Browse files Browse the repository at this point in the history
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/flutter#135778
  • Loading branch information
Chris Yang committed Oct 10, 2023
1 parent 9804d95 commit 158ec1f
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.3.2

* Fixes an issue where the onDragEnd callback for marker is not called.

## 2.3.1

* Adds pub topics to package metadata.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
4510D964F3B1259FEDD3ABA6 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7755F8F4BABC3D6A0BD4048B /* libPods-Runner.a */; };
68C9D7F72AD0A84100DF9D79 /* RunnerUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 68C9D7F62AD0A84100DF9D79 /* RunnerUITests.m */; };
68E4726A2836FF0C00BDDDAC /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 68E472692836FF0C00BDDDAC /* MapKit.framework */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
Expand All @@ -22,6 +23,13 @@
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
68C9D7FA2AD0A84100DF9D79 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
proxyType = 1;
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
remoteInfo = Runner;
};
F7151F15265D7ED70028CB91 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
Expand All @@ -48,6 +56,8 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
68C9D7F42AD0A84100DF9D79 /* RunnerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
68C9D7F62AD0A84100DF9D79 /* RunnerUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RunnerUITests.m; sourceTree = "<group>"; };
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; };
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>"; };
7755F8F4BABC3D6A0BD4048B /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -74,6 +84,13 @@
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
68C9D7F12AD0A84100DF9D79 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -104,6 +121,14 @@
name = Frameworks;
sourceTree = "<group>";
};
68C9D7F52AD0A84100DF9D79 /* RunnerUITests */ = {
isa = PBXGroup;
children = (
68C9D7F62AD0A84100DF9D79 /* RunnerUITests.m */,
);
path = RunnerUITests;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
Expand All @@ -121,6 +146,7 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
F7151F11265D7ED70028CB91 /* RunnerTests */,
68C9D7F52AD0A84100DF9D79 /* RunnerUITests */,
97C146EF1CF9000F007C117D /* Products */,
A189CFE5474BF8A07908B2E0 /* Pods */,
1E7CF0857EFC88FC263CF3B2 /* Frameworks */,
Expand All @@ -132,6 +158,7 @@
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
F7151F10265D7ED70028CB91 /* RunnerTests.xctest */,
68C9D7F42AD0A84100DF9D79 /* RunnerUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -185,6 +212,24 @@
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
68C9D7F32AD0A84100DF9D79 /* RunnerUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 68C9D7FE2AD0A84100DF9D79 /* Build configuration list for PBXNativeTarget "RunnerUITests" */;
buildPhases = (
68C9D7F02AD0A84100DF9D79 /* Sources */,
68C9D7F12AD0A84100DF9D79 /* Frameworks */,
68C9D7F22AD0A84100DF9D79 /* Resources */,
);
buildRules = (
);
dependencies = (
68C9D7FB2AD0A84100DF9D79 /* PBXTargetDependency */,
);
name = RunnerUITests;
productName = RunnerUITests;
productReference = 68C9D7F42AD0A84100DF9D79 /* RunnerUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
Expand Down Expand Up @@ -232,9 +277,13 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "The Flutter Authors";
TargetAttributes = {
68C9D7F32AD0A84100DF9D79 = {
CreatedOnToolsVersion = 15.0;
TestTargetID = 97C146ED1CF9000F007C117D;
};
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
};
Expand All @@ -260,11 +309,19 @@
targets = (
97C146ED1CF9000F007C117D /* Runner */,
F7151F0F265D7ED70028CB91 /* RunnerTests */,
68C9D7F32AD0A84100DF9D79 /* RunnerUITests */,
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
68C9D7F22AD0A84100DF9D79 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -379,6 +436,14 @@
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
68C9D7F02AD0A84100DF9D79 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
68C9D7F72AD0A84100DF9D79 /* RunnerUITests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -401,6 +466,11 @@
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
68C9D7FB2AD0A84100DF9D79 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 97C146ED1CF9000F007C117D /* Runner */;
targetProxy = 68C9D7FA2AD0A84100DF9D79 /* PBXContainerItemProxy */;
};
F7151F16265D7ED70028CB91 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 97C146ED1CF9000F007C117D /* Runner */;
Expand Down Expand Up @@ -428,6 +498,44 @@
/* End PBXVariantGroup section */

/* Begin XCBuildConfiguration section */
68C9D7FC2AD0A84100DF9D79 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GENERATE_INFOPLIST_FILE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.RunnerUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Runner;
};
name = Debug;
};
68C9D7FD2AD0A84100DF9D79 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GENERATE_INFOPLIST_FILE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.RunnerUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Runner;
};
name = Release;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
Expand Down Expand Up @@ -541,6 +649,8 @@
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -566,6 +676,8 @@
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = "";
ENABLE_BITCODE = NO;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
FRAMEWORK_SEARCH_PATHS = (
Expand All @@ -591,6 +703,7 @@
baseConfigurationReference = E52C6A6210A56F027C582EF9 /* Pods-RunnerTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
INFOPLIST_FILE = RunnerTests/Info.plist;
Expand All @@ -599,7 +712,6 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
Expand All @@ -611,6 +723,7 @@
baseConfigurationReference = 733AFAB37683A9DA7512F09C /* Pods-RunnerTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "i386 arm64";
INFOPLIST_FILE = RunnerTests/Info.plist;
Expand All @@ -619,7 +732,6 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = dev.flutter.plugins.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/Runner";
Expand All @@ -629,6 +741,15 @@
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
68C9D7FE2AD0A84100DF9D79 /* Build configuration list for PBXNativeTarget "RunnerUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
68C9D7FC2AD0A84100DF9D79 /* Debug */,
68C9D7FD2AD0A84100DF9D79 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
Expand All @@ -24,6 +26,8 @@
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs your location to test the location feature of the Google Maps plugin.</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
Expand All @@ -45,9 +49,5 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// 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 <XCTest/XCTest.h>

static const NSTimeInterval kWaitTime = 60;

@interface RunnerUITests : XCTestCase

@end

@implementation RunnerUITests

- (void)testMarkerDraggingCallbacks {
XCUIApplication *application = [[XCUIApplication alloc] init];
[application launch];
XCUIElement *placeMarkerButton = application.staticTexts[@"Place marker"];
if (![placeMarkerButton waitForExistenceWithTimeout:kWaitTime]) {
NSLog(@"application.debugDescription: %@", application.debugDescription);
XCTFail(@"Failed to find the Place marker button.");
}
[placeMarkerButton tap];

XCUIElement *Add = application.buttons[@"Add"];
if (![Add waitForExistenceWithTimeout:kWaitTime]) {
NSLog(@"application.debugDescription: %@", application.debugDescription);
XCTFail(@"Failed to find the Add button.");
}
[Add tap];

XCUIElement *marker = application.buttons[@"marker_id_1"];
if (![marker waitForExistenceWithTimeout:kWaitTime]) {
NSLog(@"application.debugDescription: %@", application.debugDescription);
XCTFail(@"Failed to find the marker.");
}
[marker tap];

XCUIElement *toggleDraggable = application.buttons[@"toggle draggable"];
if (![toggleDraggable waitForExistenceWithTimeout:kWaitTime]) {
NSLog(@"application.debugDescription: %@", application.debugDescription);
XCTFail(@"Failed to find the toggle draggable.");
}
[toggleDraggable tap];

// Drag marker to center
[marker pressForDuration:5 thenDragToElement:application];

NSPredicate *predicateDragStart =
[NSPredicate predicateWithFormat:@"label CONTAINS[c] %@", @"_onMarkerDragStart"];
NSPredicate *predicateDrag =
[NSPredicate predicateWithFormat:@"label CONTAINS[c] %@", @"_onMarkerDrag called"];
NSPredicate *predicateDragEnd =
[NSPredicate predicateWithFormat:@"label CONTAINS[c] %@", @"_onMarkerDragEnd"];

XCUIElement *dragStart = [application.staticTexts matchingPredicate:predicateDragStart].element;
if (![dragStart waitForExistenceWithTimeout:kWaitTime]) {
NSLog(@"application.debugDescription: %@", application.debugDescription);
XCTFail(@"Failed to find the _onMarkerDragStart.");
}
XCTAssertTrue(dragStart.exists);

XCUIElement *drag = [application.staticTexts matchingPredicate:predicateDrag].element;
if (![drag waitForExistenceWithTimeout:kWaitTime]) {
NSLog(@"application.debugDescription: %@", application.debugDescription);
XCTFail(@"Failed to find the _onMarkerDrag.");
}
XCTAssertTrue(drag.exists);

XCUIElement *dragEnd = [application.staticTexts matchingPredicate:predicateDragEnd].element;
if (![dragEnd waitForExistenceWithTimeout:kWaitTime]) {
NSLog(@"application.debugDescription: %@", application.debugDescription);
XCTFail(@"Failed to find the _onMarkerDragEnd.");
}
XCTAssertTrue(dragEnd.exists);
}

@end
Loading

0 comments on commit 158ec1f

Please sign in to comment.