diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 3dc8bfece8..2610de2207 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -372,7 +372,7 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing"; - (void)viewDidLayoutSubviews { [super viewDidLayoutSubviews]; - if (!self.mapView.drapeEngineCreated) + if (!self.mapView.drapeEngineCreated && !MapsAppDelegate.isDrapeDisabled) [self.mapView createDrapeEngine]; } diff --git a/iphone/Maps/Classes/MapsAppDelegate.h b/iphone/Maps/Classes/MapsAppDelegate.h index 3c84be4e8e..14821264cb 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.h +++ b/iphone/Maps/Classes/MapsAppDelegate.h @@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN - (NSUInteger)badgeNumber; ++ (BOOL)isDrapeDisabled; + @end NS_ASSUME_NONNULL_END diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index e3c3b8927f..13272815aa 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -229,6 +229,14 @@ using namespace osm_auth_ios; LOG(LINFO, ("applicationDidBecomeActive - end")); } +// TODO: Drape enabling is skipped during the test run due to the app crashing in teardown. This is a temporary solution. Drape should be properly disabled instead of merely skipping the enabling process. ++ (BOOL)isDrapeDisabled { + NSProcessInfo * processInfo = [NSProcessInfo processInfo]; + NSArray * launchArguments = [processInfo arguments]; + BOOL isTests = [launchArguments containsObject:@"-IsTests"]; + return isTests; +} + - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray> *_Nullable))restorationHandler { diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index bd2df9d70f..2580fca68b 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -464,6 +464,7 @@ ED0B1C312BC2951F00FB8EDD /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = ED0B1C302BC2951F00FB8EDD /* PrivacyInfo.xcprivacy */; }; ED1080A72B791CFE0023F27E /* SocialMediaCollectionViewHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED1080A62B791CFE0023F27E /* SocialMediaCollectionViewHeader.swift */; }; ED1263AB2B6F99F900AD99F3 /* UIView+AddSeparator.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED1263AA2B6F99F900AD99F3 /* UIView+AddSeparator.swift */; }; + ED1ADA332BC6B1B40029209F /* CarPlayServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED1ADA322BC6B1B40029209F /* CarPlayServiceTests.swift */; }; ED3EAC202B03C88100220A4A /* BottomTabBarButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED3EAC1F2B03C88100220A4A /* BottomTabBarButton.swift */; }; ED9966802B94FBC20083CE55 /* ColorPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = ED99667D2B94FBC20083CE55 /* ColorPicker.swift */; }; EDBD68072B625724005DD151 /* LocationServicesDisabledAlert.xib in Resources */ = {isa = PBXBuildFile; fileRef = EDBD68062B625724005DD151 /* LocationServicesDisabledAlert.xib */; }; @@ -642,6 +643,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + ED097E7A2BB80C320006ED01 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */; + proxyType = 1; + remoteGlobalIDString = 6741A93D1BF340DE002C974C; + remoteInfo = OMaps; + }; FA456C4626BDCC8E00B83C20 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = FA456C4026BDCC8E00B83C20 /* shaders.xcodeproj */; @@ -1337,9 +1345,11 @@ CDCA278C2248F34C00167D87 /* MWMRouterResultCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMRouterResultCode.h; sourceTree = ""; }; CDCA278F2248F3B800167D87 /* MWMLocationModeListener.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMLocationModeListener.h; sourceTree = ""; }; CDE0F3AD225B8D45008BA5C3 /* MWMSpeedCameraManagerMode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMSpeedCameraManagerMode.h; sourceTree = ""; }; + ED097E762BB80C320006ED01 /* OMapsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = OMapsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; ED0B1C302BC2951F00FB8EDD /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; ED1080A62B791CFE0023F27E /* SocialMediaCollectionViewHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocialMediaCollectionViewHeader.swift; sourceTree = ""; }; ED1263AA2B6F99F900AD99F3 /* UIView+AddSeparator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+AddSeparator.swift"; sourceTree = ""; }; + ED1ADA322BC6B1B40029209F /* CarPlayServiceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarPlayServiceTests.swift; sourceTree = ""; }; ED3EAC1F2B03C88100220A4A /* BottomTabBarButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottomTabBarButton.swift; sourceTree = ""; }; ED48BBB817C2B1E2003E7E92 /* CircleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CircleView.h; sourceTree = ""; }; ED48BBB917C2B1E2003E7E92 /* CircleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CircleView.m; sourceTree = ""; }; @@ -1713,6 +1723,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + ED097E732BB80C320006ED01 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -1752,6 +1769,7 @@ isa = PBXGroup; children = ( 6741AA5D1BF340DE002C974C /* Organic Maps (Debug).app */, + ED097E762BB80C320006ED01 /* OMapsTests.xctest */, ); name = Products; sourceTree = ""; @@ -1777,6 +1795,7 @@ 19C28FACFE9D520D11CA2CBB /* Products */, 29B97317FDCFA39411CA2CEA /* Resources */, F6E2FBFB1E097B9F0083EBEC /* UI */, + ED1ADA312BC6B19E0029209F /* Tests */, ); indentWidth = 2; name = Maps; @@ -2943,6 +2962,14 @@ path = Location; sourceTree = ""; }; + ED1ADA312BC6B19E0029209F /* Tests */ = { + isa = PBXGroup; + children = ( + ED1ADA322BC6B1B40029209F /* CarPlayServiceTests.swift */, + ); + path = Tests; + sourceTree = ""; + }; ED99667C2B94FBC20083CE55 /* ColorPicker */ = { isa = PBXGroup; children = ( @@ -3674,6 +3701,24 @@ productReference = 6741AA5D1BF340DE002C974C /* Organic Maps (Debug).app */; productType = "com.apple.product-type.application"; }; + ED097E752BB80C320006ED01 /* OMapsTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = ED097E802BB80C330006ED01 /* Build configuration list for PBXNativeTarget "OMapsTests" */; + buildPhases = ( + ED097E722BB80C320006ED01 /* Sources */, + ED097E732BB80C320006ED01 /* Frameworks */, + ED097E742BB80C320006ED01 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ED097E7B2BB80C320006ED01 /* PBXTargetDependency */, + ); + name = OMapsTests; + productName = OMapsTests; + productReference = ED097E762BB80C320006ED01 /* OMapsTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -3759,6 +3804,7 @@ projectRoot = ""; targets = ( 6741A93D1BF340DE002C974C /* OMaps */, + ED097E752BB80C320006ED01 /* OMapsTests */, ); }; /* End PBXProject section */ @@ -3953,6 +3999,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + ED097E742BB80C320006ED01 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -4392,9 +4445,22 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + ED097E722BB80C320006ED01 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ED1ADA332BC6B1B40029209F /* CarPlayServiceTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ + ED097E7B2BB80C320006ED01 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 6741A93D1BF340DE002C974C /* OMaps */; + targetProxy = ED097E7A2BB80C320006ED01 /* PBXContainerItemProxy */; + }; FA456C4D26BDCC9400B83C20 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = shaders_metal; @@ -4596,6 +4662,35 @@ }; name = Release; }; + ED097E7C2BB80C330006ED01 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 347526FA1DC0B00F00918CF5 /* common-debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Manual; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 9Z6432XD7L; + "DEVELOPMENT_TEAM[sdk=macosx*]" = 9Z6432XD7L; + PRODUCT_BUNDLE_IDENTIFIER = app.organicmaps.debug.tests; + PROVISIONING_PROFILE_SPECIFIER = ""; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Organic Maps (Debug).app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Organic Maps (Debug)"; + }; + name = Debug; + }; + ED097E7D2BB80C330006ED01 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 347526FB1DC0B00F00918CF5 /* common-release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Manual; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 9Z6432XD7L; + "DEVELOPMENT_TEAM[sdk=macosx*]" = 9Z6432XD7L; + PRODUCT_BUNDLE_IDENTIFIER = app.organicmaps.release.tests; + PROVISIONING_PROFILE_SPECIFIER = ""; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Organic Maps (Debug).app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Organic Maps (Debug)"; + }; + name = Release; + }; FAAB411B149BA84700C245B1 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = 347526FA1DC0B00F00918CF5 /* common-debug.xcconfig */; @@ -4699,6 +4794,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Debug; }; + ED097E802BB80C330006ED01 /* Build configuration list for PBXNativeTarget "OMapsTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + ED097E7C2BB80C330006ED01 /* Debug */, + ED097E7D2BB80C330006ED01 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; /* End XCConfigurationList section */ }; rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; diff --git a/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/OMaps.xcscheme b/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/OMaps.xcscheme index d4ffa1abfe..d85282309a 100644 --- a/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/OMaps.xcscheme +++ b/iphone/Maps/Maps.xcodeproj/xcshareddata/xcschemes/OMaps.xcscheme @@ -26,8 +26,34 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> + shouldUseLaunchSchemeArgsEnv = "NO"> + + + + + + + + + + + + (value: 25.2, unit: .kilometers)) + XCTAssertEqual(estimates.timeRemaining, 100) + } +} diff --git a/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift b/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift index 27ab17ed29..965ddf3dfb 100644 --- a/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift +++ b/iphone/Maps/UI/CarPlay/CarPlayMapViewController.swift @@ -22,7 +22,7 @@ final class CarPlayMapViewController: MWMViewController { override func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() - if mapView?.drapeEngineCreated == false { + if mapView?.drapeEngineCreated == false && !MapsAppDelegate.isDrapeDisabled() { mapView?.createDrapeEngine() } updateVisibleViewPortState(viewPortState)