aboutsummaryrefslogtreecommitdiffstats
path: root/Framework/MASShortcutMonitorTests.m
diff options
context:
space:
mode:
Diffstat (limited to 'Framework/MASShortcutMonitorTests.m')
-rw-r--r--Framework/MASShortcutMonitorTests.m23
1 files changed, 23 insertions, 0 deletions
diff --git a/Framework/MASShortcutMonitorTests.m b/Framework/MASShortcutMonitorTests.m
new file mode 100644
index 0000000..ccdcaef
--- /dev/null
+++ b/Framework/MASShortcutMonitorTests.m
@@ -0,0 +1,23 @@
+#import "MASShortcutMonitor.h"
+
+@interface MASShortcutMonitorTests : XCTestCase
+@end
+
+@implementation MASShortcutMonitorTests
+
+- (void) testMonitorCreation
+{
+ XCTAssertNotNil([MASShortcutMonitor sharedMonitor], @"Create a shared shortcut monitor.");
+}
+
+- (void) testShortcutRegistration
+{
+ MASShortcutMonitor *monitor = [MASShortcutMonitor sharedMonitor];
+ MASShortcut *shortcut = [MASShortcut shortcutWithKeyCode:kVK_ANSI_H modifierFlags:NSCommandKeyMask|NSAlternateKeyMask];
+ XCTAssertTrue([monitor registerShortcut:shortcut withAction:NULL], @"Register a shortcut.");
+ XCTAssertTrue([monitor isShortcutRegistered:shortcut], @"Remember a previously registered shortcut.");
+ [monitor unregisterShortcut:shortcut];
+ XCTAssertFalse([monitor isShortcutRegistered:shortcut], @"Forget shortcut after unregistering.");
+}
+
+@end