diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-08-31 16:45:21 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-08-31 16:45:21 -0700 |
commit | abc1c84fb817a8e31dd1226a633dc895fdae602e (patch) | |
tree | 0eef59c9f60a19b722b413f9deef20982cb77b45 /test | |
parent | 119a9fbf776fc488b19668f54cc68998ebdfb12a (diff) | |
parent | 831df11ec47cb44f6664490a361ff42ef288ce9b (diff) | |
download | qtlocation-mapboxgl-abc1c84fb817a8e31dd1226a633dc895fdae602e.tar.gz |
Merge branch 'master' into node
Diffstat (limited to 'test')
-rw-r--r-- | test/ios/MapViewTests.m | 4 | ||||
-rw-r--r-- | test/ios/MetricsTests.m | 10 | ||||
-rw-r--r-- | test/ios/ios-tests.xcodeproj/xcshareddata/xcschemes/Mapbox GL Tests.xcscheme | 14 | ||||
-rw-r--r-- | test/miscellaneous/transform.cpp | 32 | ||||
m--------- | test/suite | 0 |
5 files changed, 49 insertions, 11 deletions
diff --git a/test/ios/MapViewTests.m b/test/ios/MapViewTests.m index fadbbae601..f4ae501d7e 100644 --- a/test/ios/MapViewTests.m +++ b/test/ios/MapViewTests.m @@ -544,7 +544,7 @@ - (void)testUserTrackingModeFollow { tester.mapView.userTrackingMode = MGLUserTrackingModeFollow; - [tester waitForTimeInterval:1]; + [tester acknowledgeSystemAlert]; XCTAssertEqual(tester.mapView.userLocationVisible, YES, @@ -570,7 +570,7 @@ - (void)testUserTrackingModeFollowWithHeading { tester.mapView.userTrackingMode = MGLUserTrackingModeFollowWithHeading; - [tester waitForTimeInterval:1]; + [tester acknowledgeSystemAlert]; XCTAssertEqual(tester.mapView.userLocationVisible, YES, diff --git a/test/ios/MetricsTests.m b/test/ios/MetricsTests.m index cd02c2d52b..d3b99dc63b 100644 --- a/test/ios/MetricsTests.m +++ b/test/ios/MetricsTests.m @@ -119,7 +119,7 @@ const NSTimeInterval MGLFlushInterval = 60; [[MGLMapboxEvents sharedManager] flush]; - [self waitForExpectationsWithTimeout:1.0 handler:nil]; + [self waitForExpectationsWithTimeout:2.0 handler:nil]; XCTAssertNil([[MGLMapboxEvents sharedManager] timer]); } @@ -143,7 +143,7 @@ const NSTimeInterval MGLFlushInterval = 60; id eventsMock = [OCMockObject partialMockForObject:[MGLMapboxEvents sharedManager]]; [[[eventsMock expect] andForwardToRealObject] startTimer]; [self pushFakeEvent]; - [eventsMock verifyWithDelay:0.5]; + [eventsMock verifyWithDelay:2.0]; XCTAssertEqual([[[MGLMapboxEvents sharedManager] eventQueue] count], 1); XCTAssertNotNil([[MGLMapboxEvents sharedManager] timer]); @@ -164,7 +164,7 @@ const NSTimeInterval MGLFlushInterval = 60; [[MGLMapboxEvents sharedManager] flush]; - [self waitForExpectationsWithTimeout:1.0 handler:nil]; + [self waitForExpectationsWithTimeout:2.0 handler:nil]; [self pushFakeEvent]; id eventsMock = [OCMockObject partialMockForObject:[MGLMapboxEvents sharedManager]]; @@ -178,7 +178,7 @@ const NSTimeInterval MGLFlushInterval = 60; id eventsMock = [OCMockObject partialMockForObject:[MGLMapboxEvents sharedManager]]; [[eventsMock expect] postEvents:events]; [[MGLMapboxEvents sharedManager] flush]; - [eventsMock verifyWithDelay:1.0]; + [eventsMock verifyWithDelay:2.0]; XCTAssertTrue([[[MGLMapboxEvents sharedManager] eventQueue] count] == 0); } @@ -209,7 +209,7 @@ const NSTimeInterval MGLFlushInterval = 60; [self pushFakeEvent]; [MGLMapboxEvents flush]; - [self waitForExpectationsWithTimeout:1.0 handler:nil]; + [self waitForExpectationsWithTimeout:2.0 handler:nil]; } - (void)testPushEventAddsToEventQueue { 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 f7173ee644..2737f5185f 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 @@ -37,10 +37,10 @@ </BuildActionEntries> </BuildAction> <TestAction + buildConfiguration = "Release" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES" - buildConfiguration = "Release"> + shouldUseLaunchSchemeArgsEnv = "YES"> <Testables> <TestableReference skipped = "NO"> @@ -59,6 +59,9 @@ Identifier = "MapViewTests/testUserTrackingModeFollowWithHeading"> </Test> <Test + Identifier = "MetricsTests"> + </Test> + <Test Identifier = "MetricsTests/testFlushPostsEvents"> </Test> <Test @@ -79,15 +82,18 @@ ReferencedContainer = "container:ios-tests.xcodeproj"> </BuildableReference> </MacroExpansion> + <AdditionalOptions> + </AdditionalOptions> </TestAction> <LaunchAction + buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" launchStyle = "0" useCustomWorkingDirectory = "NO" - buildConfiguration = "Debug" ignoresPersistentStateOnLaunch = "NO" debugDocumentVersioning = "YES" + debugServiceExtension = "internal" allowLocationSimulation = "YES"> <BuildableProductRunnable runnableDebuggingMode = "0"> @@ -103,10 +109,10 @@ </AdditionalOptions> </LaunchAction> <ProfileAction + buildConfiguration = "Release" shouldUseLaunchSchemeArgsEnv = "YES" savedToolIdentifier = "" useCustomWorkingDirectory = "NO" - buildConfiguration = "Release" debugDocumentVersioning = "YES"> <BuildableProductRunnable runnableDebuggingMode = "0"> diff --git a/test/miscellaneous/transform.cpp b/test/miscellaneous/transform.cpp index 5d00bfd20b..426e9e534d 100644 --- a/test/miscellaneous/transform.cpp +++ b/test/miscellaneous/transform.cpp @@ -105,3 +105,35 @@ TEST(Transform, InvalidBearing) { ASSERT_DOUBLE_EQ(2, transform.getScale()); ASSERT_DOUBLE_EQ(2, transform.getAngle()); } + +TEST(Transform, PerspectiveProjection) { + MockView view; + Transform transform(view); + + transform.resize({{ 1000, 1000 }}); + transform.setScale(1024); + transform.setPitch(0.9); + transform.setLatLng(LatLng(38, -77)); + + // expected values are from mapbox-gl-js + + LatLng loc = transform.getState().pointToLatLng({ 500, 500 }); + ASSERT_NEAR(-77, loc.longitude, 0.0001); + ASSERT_NEAR(38, loc.latitude, 0.0001); + + loc = transform.getState().pointToLatLng({ 0, 1000 }); + ASSERT_NEAR(-77.59198961199148, loc.longitude, 0.0002); + ASSERT_NEAR(38.74661326302018, loc.latitude, 0.0001); + + loc = transform.getState().pointToLatLng({ 1000, 0 }); + ASSERT_NEAR(-76.75823239205641, loc.longitude, 0.0001); + ASSERT_NEAR(37.692872969426375, loc.latitude, 0.0001); + + vec2<double> point = transform.getState().latLngToPoint({38.74661326302018, -77.59198961199148}); + ASSERT_NEAR(point.x, 0, 0.01); + ASSERT_NEAR(point.y, 1000, 0.01); + + point = transform.getState().latLngToPoint({37.692872969426375, -76.75823239205641}); + ASSERT_NEAR(point.x, 1000, 0.02); + ASSERT_NEAR(point.y, 0, 0.02); +} diff --git a/test/suite b/test/suite -Subproject b6828212d3fe5a06e1e91df1dc9a212cb565609 +Subproject 083dbe5f3da13d006f3d2eb6669780b1d003a7e |