diff options
author | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2019-10-04 17:13:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-04 17:13:00 -0700 |
commit | 5c565a5e51be8379ddc2ffb5c859d8cfebe2fcd5 (patch) | |
tree | dcd0ca7902546247d53b9fee402673b16d2a8fd9 /platform/ios/test/MGLMockGestureRecognizers.m | |
parent | 33a70100b839793311ecc73c873c063c7cf65e31 (diff) | |
download | qtlocation-mapboxgl-5c565a5e51be8379ddc2ffb5c859d8cfebe2fcd5.tar.gz |
[ios] Fixes an issue that caused the ornaments ignore contentInset property. (#15584)
* [ios] Add mapView content inset tests.
* [ios] Fix an issue that caused the ornaments ignore the contentInsets.
Fixed an issue that caused ornaments ignore the contentInset. Added a new property automaticallyAdjustContentInset that has the same purpose as UIViewController. automaticallyAdjustsScrollViewInsets. This was changed due to the latter being deprecated.
* [ios] Fix automaticallyAdjustsScrollViewInsets legacy behavior.
The property automaticallyAdjustsScrollViewInsets overrode automaticallyAdjustsScrollViewInsets which caused a breaking change. This is fixed to consider the legacy property when calculating the content insets and added tests for both cases.
* [ios] Fix the contentInset value after adding padding to the camera.
Fixed an issue that caused a discrepancy between the contentInset in MGLMapView and the padding in the transformation state.
When padding is passed through methods such as setCamera it’s persisted. This fix resets the contentInsets.
* [ios] Fix pinch test.
* [ios] Update automaticallyAdjustsScrollViewInsets name and documentation.
* [ios] Update changelog.
Diffstat (limited to 'platform/ios/test/MGLMockGestureRecognizers.m')
-rw-r--r-- | platform/ios/test/MGLMockGestureRecognizers.m | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/platform/ios/test/MGLMockGestureRecognizers.m b/platform/ios/test/MGLMockGestureRecognizers.m index 89df6750a9..c818805174 100644 --- a/platform/ios/test/MGLMockGestureRecognizers.m +++ b/platform/ios/test/MGLMockGestureRecognizers.m @@ -1,11 +1,55 @@ #import "MGLMockGestureRecognizers.h" +#import "objc/runtime.h" @implementation UIPinchGestureRecognizerMock @synthesize velocity; +@synthesize state; - (CGPoint)locationInView:(nullable UIView *)view { return self.locationInViewOverride; } @end @implementation UIRotationGestureRecognizerMock - (CGPoint)locationInView:(nullable UIView*)view { return view.center; } +@synthesize state; +@end + +@implementation UITapGestureRecognizerMock + ++ (void)load { + method_exchangeImplementations(class_getInstanceMethod(self, @selector(state)), + class_getInstanceMethod(self, @selector(mockState))); +} + +- (UIGestureRecognizerState)mockState { + return UIGestureRecognizerStateRecognized; +} + +- (UIView *)view { + return self.mockTappedView; +} + +- (CGPoint)locationInView:(UIView *)view { + return self.mockTappedPoint; +} + +@end + +@implementation UILongPressGestureRecognizerMock +@synthesize state; + +- (CGPoint)locationInView:(UIView *)view { + return self.mockTappedPoint; +} +@end + +@implementation UIPanGestureRecognizerMock +@synthesize state; +@synthesize numberOfTouches; + +- (CGPoint)locationOfTouch:(NSUInteger)touchIndex inView:(UIView *)view { + if (touchIndex) { + return self.secondFingerPoint; + } + return self.firstFingerPoint; +} @end |