diff options
author | Julian Rex <julian.rex@mapbox.com> | 2019-10-04 11:15:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-04 11:15:20 -0400 |
commit | cab756374f4eb42ab632c6db6d049a90884700ad (patch) | |
tree | ff525a2cf8252a8936802c2a6162f1906978106a /platform/ios/test/MGLMapViewScaleBarTests.m | |
parent | bef635765a1bbec14d7732856c38c037ea8add6a (diff) | |
download | qtlocation-mapboxgl-cab756374f4eb42ab632c6db6d049a90884700ad.tar.gz |
[ios] Fix layout of Scale bar components (#15703)
* [ios] Add failing tests for scale bar updates.
* [ios] Remove borderLayer
* [ios] Ensure bar sections have non-fractional width
* [ios] Add RTL override
* [ios] Update constraints/layout
* [ios] Invalidate scalebars size, after the parent's layout has happened (to ensure the view dimensions are correct when re-laying out the scale bar.
* [ios] Refactor layout
* [ios] Update changelog / remove commented code.
* [ios] Remove whitespace
* [ios] Stop integration tests asserting (when scale bar is hidden). Also reduces the # of calculations (since updateConstraints and layoutSubviews can be called outside of our control).
* [ios] Moves declaration of properties for testing.
* [ios] Removes redundant property attribute
* [ios] Updated change log
Diffstat (limited to 'platform/ios/test/MGLMapViewScaleBarTests.m')
-rw-r--r-- | platform/ios/test/MGLMapViewScaleBarTests.m | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/platform/ios/test/MGLMapViewScaleBarTests.m b/platform/ios/test/MGLMapViewScaleBarTests.m index 29acc75d7f..b4f81ef62b 100644 --- a/platform/ios/test/MGLMapViewScaleBarTests.m +++ b/platform/ios/test/MGLMapViewScaleBarTests.m @@ -36,11 +36,14 @@ XCTAssertFalse(scaleBar.hidden); // Scale bar should not be visible at default zoom (~z0), but it should be ready. - XCTAssertFalse(CGSizeEqualToSize(scaleBar.intrinsicContentSize, CGSizeZero)); + // Size is not a measure of readiness here though. + XCTAssertTrue(CGSizeEqualToSize(scaleBar.intrinsicContentSize, CGSizeZero)); XCTAssertEqual(scaleBar.alpha, 0); self.mapView.zoomLevel = 15; + [self.mapView layoutIfNeeded]; XCTAssertGreaterThan(scaleBar.alpha, 0); + XCTAssertFalse(CGSizeEqualToSize(scaleBar.intrinsicContentSize, CGSizeZero)); } - (void)testDirectlySettingScaleBarViewHiddenProperty { @@ -54,10 +57,14 @@ // ... but triggering any camera event will update it. self.mapView.zoomLevel = 1; - XCTAssertFalse(CGSizeEqualToSize(scaleBar.intrinsicContentSize, CGSizeZero)); + [self.mapView layoutIfNeeded]; + + XCTAssertTrue(CGSizeEqualToSize(scaleBar.intrinsicContentSize, CGSizeZero)); XCTAssertEqual(scaleBar.alpha, 0); self.mapView.zoomLevel = 15; + [self.mapView layoutIfNeeded]; + XCTAssertGreaterThan(scaleBar.alpha, 0); -} -@end + XCTAssertFalse(CGSizeEqualToSize(scaleBar.intrinsicContentSize, CGSizeZero)); +}@end |