From a101ab4cf5d3bec88dde0255c6a1b9fad8a86383 Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Tue, 15 Sep 2015 13:27:45 -0400 Subject: [PATCH 1/4] [node] throw if a render is already pending, fixes #2247 --- platform/node/src/node_map.cpp | 4 ++++ platform/node/test/js/map.test.js | 8 ++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index 5b2a83916..f1abf4806 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -186,6 +186,10 @@ NAN_METHOD(NodeMap::Render) { return Nan::ThrowTypeError("Style is not loaded"); } + if (nodeMap->callback) { + return Nan::ThrowError("Map is currently rendering an image"); + } + auto options = ParseOptions(info[0]->ToObject()); assert(!nodeMap->callback); diff --git a/platform/node/test/js/map.test.js b/platform/node/test/js/map.test.js index 295fec693..1581d15cb 100644 --- a/platform/node/test/js/map.test.js +++ b/platform/node/test/js/map.test.js @@ -266,18 +266,14 @@ test('Map', function(t) { render(); }); - t.skip('throws if called in parallel', function(t) { - var completed = 0; - var remaining = 10; - var start = +new Date; - + t.test('throws if called in parallel', function(t) { var map = new mbgl.Map(options); map.load(style); t.throws(function() { map.render({}, function() {}); map.render({}, function() {}); - }); + }, /Map is currently rendering an image/); map.release(); t.end(); From 121e95ada4b20525a47a3e8873219d1d19e50cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Wed, 2 Sep 2015 11:50:56 -0700 Subject: [PATCH 2/4] Upgrade Travis to Xcode 7 image Only for iOS. OS X remains on Xcode 6.4. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f3a830849..6d7d31123 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ matrix: osx_image: xcode6.4 env: FLAVOR=osx BUILDTYPE=Debug - os: osx - osx_image: xcode6.4 + osx_image: xcode7 env: FLAVOR=ios BUILDTYPE=Release - os: linux env: FLAVOR=android ANDROID_ABI=arm-v7 BUILDTYPE=Release From 6ec8b2805db9c88b3a37616a2c1ce82951557e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguy=E1=BB=85n?= Date: Thu, 10 Sep 2015 14:44:39 -0700 Subject: [PATCH 3/4] Upgraded to iOS Simulator 9.0, KIF 3.3.0 Upgraded the test project. Rolled back part of 69cf6ed3d273fc10e8cea2caef223f4a281388f0 to work around facebook/xctool#528. --- scripts/ios/test.sh | 9 ++- test/ios/App-Info.plist | 6 +- test/ios/Bundle-Info.plist | 2 +- test/ios/KIF | 2 +- test/ios/ios-tests.xcodeproj/project.pbxproj | 66 +++++++------------ .../xcschemes/Mapbox GL Tests.xcscheme | 2 +- 6 files changed, 35 insertions(+), 52 deletions(-) diff --git a/scripts/ios/test.sh b/scripts/ios/test.sh index 170aa0f64..60ccc76a9 100755 --- a/scripts/ios/test.sh +++ b/scripts/ios/test.sh @@ -4,8 +4,11 @@ set -e set -o pipefail set -u -xctool \ +xcodebuild \ -project ./test/ios/ios-tests.xcodeproj \ -scheme 'Mapbox GL Tests' \ - -sdk iphonesimulator8.4 \ - test + -sdk iphonesimulator \ + -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' \ + -destination 'platform=iOS Simulator,name=iPad 2,OS=latest' \ + test \ + | xcpretty diff --git a/test/ios/App-Info.plist b/test/ios/App-Info.plist index f817ea1d9..ab5ac7ec8 100644 --- a/test/ios/App-Info.plist +++ b/test/ios/App-Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.mapbox.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -28,6 +28,8 @@ pk.eyJ1IjoianVzdGluIiwiYSI6Ik9RX3RRQzAifQ.dmOg_BAp1ywuDZMM7YsXRg MGLMapboxMetricsEnabledSettingShownInApp + NSLocationAlwaysUsageDescription + Strictly for testing purposes, promise! UILaunchStoryboardName LaunchScreen UIRequiredDeviceCapabilities @@ -40,8 +42,6 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - NSLocationAlwaysUsageDescription - Strictly for testing purposes, promise! UISupportedInterfaceOrientations~ipad UIInterfaceOrientationPortrait diff --git a/test/ios/Bundle-Info.plist b/test/ios/Bundle-Info.plist index 4ea0aed89..169b6f710 100644 --- a/test/ios/Bundle-Info.plist +++ b/test/ios/Bundle-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.mapbox.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType diff --git a/test/ios/KIF b/test/ios/KIF index 976aafa2e..21a137bc8 160000 --- a/test/ios/KIF +++ b/test/ios/KIF @@ -1 +1 @@ -Subproject commit 976aafa2e211dd095411bfef09da6c0919d70476 +Subproject commit 21a137bc8068f9fb738f835c6e285d44fe2ce4dd diff --git a/test/ios/ios-tests.xcodeproj/project.pbxproj b/test/ios/ios-tests.xcodeproj/project.pbxproj index 640837243..2807ee01b 100644 --- a/test/ios/ios-tests.xcodeproj/project.pbxproj +++ b/test/ios/ios-tests.xcodeproj/project.pbxproj @@ -41,6 +41,13 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + DA3BDF011BA2326400553BD2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = DDBD013A196DC3AE0033959E /* KIF.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 9CC9673B1AD4B1B600576D13; + remoteInfo = KIFFramework; + }; DDBD0143196DC3AE0033959E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = DDBD013A196DC3AE0033959E /* KIF.xcodeproj */; @@ -48,13 +55,6 @@ remoteGlobalIDString = EABD46AA1857A0C700A5F081; remoteInfo = KIF; }; - DDBD0145196DC3AE0033959E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DDBD013A196DC3AE0033959E /* KIF.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = EB72047C1680DDAD00278DA2; - remoteInfo = "KIF-OCUnit"; - }; DDBD0147196DC3AE0033959E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = DDBD013A196DC3AE0033959E /* KIF.xcodeproj */; @@ -69,13 +69,6 @@ remoteGlobalIDString = EABD46CD1857A0F300A5F081; remoteInfo = "KIF Tests"; }; - DDBD014B196DC3AE0033959E /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = DDBD013A196DC3AE0033959E /* KIF.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = EB60ECEB177F8DB3005A041A; - remoteInfo = "KIF Tests-OCUnit"; - }; DDBD0160196DC3D70033959E /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = DD04331B196DB9BC00E6F39D /* Project object */; @@ -327,10 +320,9 @@ isa = PBXGroup; children = ( DDBD0144196DC3AE0033959E /* libKIF.a */, - DDBD0146196DC3AE0033959E /* libKIF-OCUnit.a */, DDBD0148196DC3AE0033959E /* Test Host.app */, DDBD014A196DC3AE0033959E /* KIF Tests - XCTest.xctest */, - DDBD014C196DC3AE0033959E /* KIF Tests-OCUnit.octest */, + DA3BDF021BA2326400553BD2 /* KIF.framework */, ); name = Products; sourceTree = ""; @@ -396,7 +388,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = MGLT; - LastUpgradeCheck = 0620; + LastUpgradeCheck = 0700; ORGANIZATIONNAME = Mapbox; TargetAttributes = { DDBD0151196DC3D70033959E = { @@ -430,6 +422,13 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + DA3BDF021BA2326400553BD2 /* KIF.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = KIF.framework; + remoteRef = DA3BDF011BA2326400553BD2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; DDBD0144196DC3AE0033959E /* libKIF.a */ = { isa = PBXReferenceProxy; fileType = archive.ar; @@ -437,13 +436,6 @@ remoteRef = DDBD0143196DC3AE0033959E /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - DDBD0146196DC3AE0033959E /* libKIF-OCUnit.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libKIF-OCUnit.a"; - remoteRef = DDBD0145196DC3AE0033959E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; DDBD0148196DC3AE0033959E /* Test Host.app */ = { isa = PBXReferenceProxy; fileType = wrapper.application; @@ -458,13 +450,6 @@ remoteRef = DDBD0149196DC3AE0033959E /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - DDBD014C196DC3AE0033959E /* KIF Tests-OCUnit.octest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "KIF Tests-OCUnit.octest"; - remoteRef = DDBD014B196DC3AE0033959E /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -547,6 +532,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_OPTIMIZATION_LEVEL = 0; @@ -618,6 +604,7 @@ ../../build/ios/pkg/static, ); OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; @@ -641,6 +628,7 @@ ../../build/ios/pkg/static, ); OTHER_LDFLAGS = "-ObjC"; + PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; @@ -651,12 +639,7 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Mapbox GL Tests.app/Mapbox GL Tests"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks", - ); + FRAMEWORK_SEARCH_PATHS = ""; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", @@ -680,6 +663,7 @@ XCTest, "-ObjC", ); + PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = xctest; @@ -690,12 +674,7 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/Mapbox GL Tests.app/Mapbox GL Tests"; - FRAMEWORK_SEARCH_PATHS = ( - "$(SDKROOT)/Developer/Library/Frameworks", - "$(inherited)", - "$(DEVELOPER_FRAMEWORKS_DIR)", - "$(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/Frameworks", - ); + FRAMEWORK_SEARCH_PATHS = ""; GCC_PREPROCESSOR_DEFINITIONS = "KIF_XCTEST=1"; HEADER_SEARCH_PATHS = ( "$(inherited)", @@ -715,6 +694,7 @@ XCTest, "-ObjC", ); + PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TEST_HOST = "$(BUNDLE_LOADER)"; WRAPPER_EXTENSION = xctest; diff --git a/test/ios/ios-tests.xcodeproj/xcshareddata/xcschemes/Mapbox GL Tests.xcscheme b/test/ios/ios-tests.xcodeproj/xcshareddata/xcschemes/Mapbox GL Tests.xcscheme index 2737f5185..c80cdb3d5 100644 --- a/test/ios/ios-tests.xcodeproj/xcshareddata/xcschemes/Mapbox GL Tests.xcscheme +++ b/test/ios/ios-tests.xcodeproj/xcshareddata/xcschemes/Mapbox GL Tests.xcscheme @@ -1,6 +1,6 @@ Date: Fri, 11 Sep 2015 15:42:41 -0700 Subject: [PATCH 4/4] Increased timeout for rotation animation --- test/ios/MapViewTests.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/ios/MapViewTests.m b/test/ios/MapViewTests.m index f4ae501d7..98636d1a9 100644 --- a/test/ios/MapViewTests.m +++ b/test/ios/MapViewTests.m @@ -46,7 +46,7 @@ 270, @"setting direction should take effect"); - [tester waitForTimeInterval:1]; + [tester waitForTimeInterval:2]; XCTAssertEqual(tester.compass.alpha, 1, @@ -89,7 +89,7 @@ [tester.mapView resetNorth]; - [tester waitForTimeInterval:1]; + [tester waitForTimeInterval:2]; XCTAssertEqual(tester.mapView.direction, 0,