Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bart Louwers <bart@emeel.net>
56 lines
1.3 KiB
Objective-C
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
|