Files
MapLibreParticleLab/platform/ios/test/MLNMockGestureRecognizers.m
mwilsnd 20d9e1028c Platform flattening overhaul (#1393)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bart Louwers <bart@emeel.net>
2023-07-26 17:50:34 +02:00

56 lines
1.3 KiB
Objective-C

#import "MLNMockGestureRecognizers.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