summaryrefslogtreecommitdiff
path: root/test/ios/LocationMocker/CSSwizzler.h
diff options
context:
space:
mode:
authorJason Wray <jason@kulturny.com>2015-05-22 19:15:46 -0700
committerJason Wray <jason@kulturny.com>2015-06-15 16:42:32 -0700
commite75e538ddbb1dad0baad02576df86f6b8eb1510f (patch)
treeef01171ee54cd5df3139b97d9fce2d4953e7f283 /test/ios/LocationMocker/CSSwizzler.h
parent69cf6ed3d273fc10e8cea2caef223f4a281388f0 (diff)
downloadqtlocation-mapboxgl-e75e538ddbb1dad0baad02576df86f6b8eb1510f.tar.gz
Add location tests for iOS
- Adds testDelegatesStartStopLocatingUser: Tests mapViewWillStartLocatingUser and mapViewDidStopLocatingUser delegate methods - Adds testUserTrackingModeFollow - Adds testUserTrackingModeFollowWithHeading (disabled because of library bug) Fakes user location via swizzled CLLocationManager and hard-coded mock coordinates and heading.
Diffstat (limited to 'test/ios/LocationMocker/CSSwizzler.h')
-rw-r--r--test/ios/LocationMocker/CSSwizzler.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ios/LocationMocker/CSSwizzler.h b/test/ios/LocationMocker/CSSwizzler.h
new file mode 100644
index 0000000000..d0a2cc205c
--- /dev/null
+++ b/test/ios/LocationMocker/CSSwizzler.h
@@ -0,0 +1,22 @@
+//
+// Based on gist by Eric Allam
+// https://gist.github.com/ericallam/5689235
+//
+
+#import <Foundation/Foundation.h>
+
+@interface CSSwizzler : NSObject
+
++ (void)swizzleClass:(id)cls
+ replaceClassMethod:(SEL)origMethodSelector
+ withMethod:(SEL)replacementMethodSelector;
+
++ (void)swizzleClass:(id)cls
+ replaceMethod:(SEL)origMethodSelector
+ withMethod:(SEL)replacementMethodSelector;
+
++ (void)swizzleClassOfInstance:(id)inst
+ replaceMethod:(SEL)origMethodSelector
+ withMethod:(SEL)replacementMethodSelector;
+
+@end