From becea93fa9f661df36a0419df287b73337ca51cc Mon Sep 17 00:00:00 2001 From: sgschantz Date: Tue, 17 Sep 2024 15:36:41 +0700 Subject: [PATCH 1/2] change(mac): remove verbose logging option also remove related debug mode code, debug logging is controlled solely by universal logging settings Fixes: #11525 --- mac/Keyman4Mac/Keyman4Mac/AppDelegate.m | 4 +- .../Base.lproj/preferences.xib | 29 +------- .../KMConfigurationWindowController.m | 11 --- .../Keyman4MacIM/KMInputMethodAppDelegate.h | 2 - .../Keyman4MacIM/KMInputMethodAppDelegate.m | 30 +------- .../Keyman4MacIM/KMInputMethodEventHandler.m | 15 ++-- .../Keyman4MacIM/KMSettingsRepository.h | 3 +- .../Keyman4MacIM/KMSettingsRepository.m | 16 ++--- .../KeymanTests/TestAppDelegate.h | 1 - .../KeymanTests/TestAppDelegate.m | 6 +- .../KeymanEngine4Mac/CoreWrapper/CoreHelper.h | 3 - .../KeymanEngine4Mac/CoreWrapper/CoreHelper.m | 3 +- .../KeymanEngine4Mac/KME/KMEngine.h | 4 +- .../KeymanEngine4Mac/KME/KMEngine.m | 71 +------------------ .../CoreTestStaticHelperMethods.m | 2 +- .../KeymanEngine4MacTests/KMEngineTests.m | 52 +++++++------- 16 files changed, 55 insertions(+), 197 deletions(-) diff --git a/mac/Keyman4Mac/Keyman4Mac/AppDelegate.m b/mac/Keyman4Mac/Keyman4Mac/AppDelegate.m index 44f7cfda587..3ffb9129cf4 100644 --- a/mac/Keyman4Mac/Keyman4Mac/AppDelegate.m +++ b/mac/Keyman4Mac/Keyman4Mac/AppDelegate.m @@ -9,8 +9,6 @@ #import "AppDelegate.h" #import -static BOOL debugMode = YES; - BOOL isKeyMapEnabled; const unsigned short keyMapSize = 0x80; @@ -116,7 +114,7 @@ CGEventRef eventTapFunction(CGEventTapProxy proxy, CGEventType type, CGEventRef NSLog(@"AppDelegate eventTapFunction key down event: %@", event); // Key down event NSEvent *mEvent = [NSEvent eventWithCGEvent:event]; - KMEngine *kme = [[KMEngine alloc] initWithKMX:kmx context:contextBuffer verboseLogging:debugMode]; + KMEngine *kme = [[KMEngine alloc] initWithKMX:kmx context:contextBuffer]; CoreKeyOutput *coreKeyOutput = [kme processEvent:mEvent]; if (coreKeyOutput) { if (coreKeyOutput.hasTextToInsert) { diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMConfiguration/Base.lproj/preferences.xib b/mac/Keyman4MacIM/Keyman4MacIM/KMConfiguration/Base.lproj/preferences.xib index d5afcd00d5e..e6cc0173aac 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMConfiguration/Base.lproj/preferences.xib +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMConfiguration/Base.lproj/preferences.xib @@ -2,8 +2,8 @@ - - + + @@ -13,8 +13,6 @@ - - @@ -209,29 +207,6 @@ - - - - diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMConfiguration/KMConfigurationWindowController.m b/mac/Keyman4MacIM/Keyman4MacIM/KMConfiguration/KMConfigurationWindowController.m index f3a0c3501e5..202be65ef5e 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMConfiguration/KMConfigurationWindowController.m +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMConfiguration/KMConfigurationWindowController.m @@ -14,8 +14,6 @@ @interface KMConfigurationWindowController () @property (nonatomic, weak) IBOutlet NSTableView *tableView; @property (nonatomic, weak) IBOutlet WebView *webView; -@property (nonatomic, weak) IBOutlet NSButton *useVerboseLoggingCheckBox; -@property (nonatomic, weak) IBOutlet NSTextField *verboseLoggingInfo; @property (nonatomic, weak) IBOutlet NSButton *supportBack; @property (nonatomic, weak) IBOutlet NSButton *supportForward; @property (nonatomic, weak) IBOutlet NSButton *supportHome; @@ -68,8 +66,6 @@ - (void)windowDidLoad { NSURL *homeUrl = [[NSBundle mainBundle] URLForResource:@"index" withExtension:@"html" subdirectory:@"Help"]; [self.webView.mainFrame loadRequest:[NSURLRequest requestWithURL:homeUrl]]; - - [self.useVerboseLoggingCheckBox setState:(self.AppDelegate.useVerboseLogging ? NSOnState : NSOffState)]; } - (void)webView:(WebView *)sender decidePolicyForNewWindowAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request newFrameName:(NSString *)frameName decisionListener:(id)listener { @@ -437,13 +433,6 @@ - (IBAction)downloadAction:(id)sender { [self.AppDelegate.downloadKBWindow.window makeKeyAndOrderFront:nil]; } -- (IBAction)useVerboseLoggingCheckBoxAction:(id)sender { - NSButton *checkBox = (NSButton *)sender; - BOOL verboseLoggingOn = checkBox.state == NSOnState; - [self.AppDelegate setUseVerboseLogging:verboseLoggingOn]; - [self.verboseLoggingInfo setHidden:!verboseLoggingOn]; -} - - (void)handleRequestToInstallPackage:(KMPackage *) package { os_log_debug([KMLogs dataLog], "handleRequestToInstallPackage"); NSString *keyboardInfoString = NSLocalizedString(@"info-install-keyboard-filename", nil); diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.h b/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.h index 7f6b2f3655b..667e630f3cd 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.h +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.h @@ -89,9 +89,7 @@ static const int KEYMAN_FIRST_KEYBOARD_MENUITEM_INDEX = 0; @property (nonatomic, strong) NSString *downloadFilename; @property (nonatomic, strong) NSMutableData *receivedData; @property (nonatomic, assign) NSUInteger expectedBytes; -@property (nonatomic, assign) BOOL useVerboseLogging; @property (nonatomic, assign) BOOL useNullChar; -@property (nonatomic, assign) BOOL debugMode; - (NSMenu *)menu; - (void)saveActiveKeyboards; diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m b/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m index 7392c3dc2ff..199721f8be3 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m @@ -64,16 +64,7 @@ @implementation KMInputMethodAppDelegate - (id)init { self = [super init]; - if (self) { -#ifdef DEBUG - // If debugging, we'll turn it on by default, regardless of setting. If developer - // really wants it off, they can either change this line of code temporarily or - // go to the config screen and turn it off explicitly. - _debugMode = YES; -#else - _debugMode = self.useVerboseLogging; -#endif - + if (self) { // first notify user and request access to Accessibility/PostEvent permissions // pass block as completion handler to complete init with initCompletion [PrivacyConsent.shared requestPrivacyAccess:^void (void){ @@ -384,7 +375,7 @@ - (NSMenu *)menu { - (KMEngine *)kme { if (_kme == nil) { - _kme = [[KMEngine alloc] initWithKMX:nil context:self.contextBuffer verboseLogging:self.debugMode]; + _kme = [[KMEngine alloc] initWithKMX:nil context:self.contextBuffer]; } return _kme; @@ -441,19 +432,6 @@ - (NSString *)oskWindowTitle { return [NSString stringWithFormat:@"%@ - Keyman", _keyboardName]; } -- (void)setUseVerboseLogging:(BOOL)useVerboseLogging { - os_log_debug([KMLogs configLog], "Turning verbose logging %{public}@", useVerboseLogging ? @"on." : @"off."); - _debugMode = useVerboseLogging; - if (_kme != nil) - [_kme setUseVerboseLogging:useVerboseLogging]; - - [[KMSettingsRepository shared] writeUseVerboseLogging:useVerboseLogging]; -} - -- (BOOL)useVerboseLogging { - return [[KMSettingsRepository shared] readUseVerboseLogging]; -} - #pragma mark - Keyman Data /** @@ -769,9 +747,7 @@ - (void)addDynamicKeyboardMenuItems { NSString *keyboardMenuName = @""; int menuItemIndex = KEYMAN_FIRST_KEYBOARD_MENUITEM_INDEX; - if (self.debugMode) { - os_log_info([KMLogs configLog], "*** populateKeyboardMenuItems, number of active keyboards=%lu", self.activeKeyboards.count); - } + os_log_debug([KMLogs configLog], "*** populateKeyboardMenuItems, number of active keyboards=%lu", self.activeKeyboards.count); // loop through the active keyboards list and add them to the menu for (NSString *path in self.activeKeyboards) { diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodEventHandler.m b/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodEventHandler.m index d102e69ca37..c5b6f172b60 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodEventHandler.m +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodEventHandler.m @@ -45,11 +45,14 @@ - (instancetype)initWithClient:(NSString *)clientAppId client:(id) sender { _lowLevelBackspaceCount = 0; _queuedText = nil; - // In Xcode, if Keyman is the active IM and is in "debugMode" and "English plus Spanish" is - // the current keyboard and you type "Sentry force now", it will force a simulated crash to + BOOL forceSentryCrash = [KMSettingsRepository.shared readForceSentryError]; + + // In Xcode, if Keyman is the active IM and the settings include the + // forceSentryCrash flag and "English plus Spanish" is the current keyboard + // and you type "Sentry force now", it will force a simulated crash to // test reporting to sentry.keyman.com - if ([self.appDelegate debugMode] && [clientAppId isEqual: @"com.apple.dt.Xcode"]) { - os_log_debug([KMLogs testLog], "Sentry - Preparing to detect Easter egg."); + if (forceSentryCrash && [clientAppId isEqual: @"com.apple.dt.Xcode"]) { + os_log_debug([KMLogs testLog], "initWithClient, preparing to force Sentry crash."); _easterEggForSentry = [[NSMutableString alloc] init]; } else @@ -66,9 +69,7 @@ - (void)deactivate { if (_generatedBackspaceCount > 0 || (_queuedText != nil && _queuedText.length > 0) || _keyCodeOfOriginalEvent != 0 || _sourceFromOriginalEvent != nil) { - if ([self.appDelegate debugMode]) { - os_log_error([KMLogs lifecycleLog], "ERROR: new app activated before previous app finished processing pending events! _generatedBackspaceCount: %lu, _queuedText: '%{public}@' _keyCodeOfOriginalEvent: %hu", _generatedBackspaceCount, _queuedText == nil ? @"(NIL)" : (NSString*)[self queuedText], _keyCodeOfOriginalEvent); - } + os_log_error([KMLogs lifecycleLog], "ERROR: new app activated before previous app finished processing pending events! _generatedBackspaceCount: %lu, _queuedText: '%{public}@' _keyCodeOfOriginalEvent: %hu", _generatedBackspaceCount, _queuedText == nil ? @"(NIL)" : (NSString*)[self queuedText], _keyCodeOfOriginalEvent); _keyCodeOfOriginalEvent = 0; _generatedBackspaceCount = 0; _queuedText = nil; diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.h b/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.h index 7fdf3de0346..846b9e11c67 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.h +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.h @@ -26,8 +26,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)writeOptionForSelectedKeyboard:(NSString *)key withValue:(NSString*)value; - (BOOL)readShowOskOnActivate; - (void)writeShowOskOnActivate:(BOOL)show; -- (BOOL)readUseVerboseLogging; -- (void)writeUseVerboseLogging:(BOOL)verboseLogging; +- (BOOL)readForceSentryError; @end NS_ASSUME_NONNULL_END diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.m b/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.m index db59929eaec..120c26e2c41 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.m +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.m @@ -15,7 +15,7 @@ NSString *const kSelectedKeyboardKey = @"KMSelectedKeyboardKey"; NSString *const kPersistedOptionsKey = @"KMPersistedOptionsKey"; NSString *const kShowOskOnActivate = @"KMShowOskOnActivate"; -NSString *const kUseVerboseLogging = @"KMUseVerboseLogging"; +NSString *const kForceSentryError = @"KMForceSentryError"; /** * The following constant "KMSavedStoresKey" is left here for documentation @@ -30,6 +30,11 @@ * but the related UI has been removed according to issue #12342 */ NSString *const kAlwaysShowOSKKey = @"KMAlwaysShowOSKKey"; +/** + * The following constant "KMUseVerboseLogging" is left here for documentation + * but it is obsolete and removed issue #11525 + */ +NSString *const kUseVerboseLogging = @"KMUseVerboseLogging"; NSString *const kObsoletePathComponent = @"/Documents/Keyman-Keyboards"; NSString *const kNewPathComponent = @"/Library/Application Support/keyman.inputmethod.Keyman/"; @@ -321,14 +326,9 @@ - (void)writeShowOskOnActivate:(BOOL)show { [userData setBool:show forKey:kShowOskOnActivate]; } -- (BOOL)readUseVerboseLogging { - NSUserDefaults *userData = [NSUserDefaults standardUserDefaults]; - return [userData boolForKey:kUseVerboseLogging]; -} - -- (void)writeUseVerboseLogging:(BOOL)verboseLogging { +- (BOOL)readForceSentryError { NSUserDefaults *userData = [NSUserDefaults standardUserDefaults]; - [userData setBool:verboseLogging forKey:kUseVerboseLogging]; + return [userData boolForKey:kForceSentryError]; } @end diff --git a/mac/Keyman4MacIM/KeymanTests/TestAppDelegate.h b/mac/Keyman4MacIM/KeymanTests/TestAppDelegate.h index fafd6f19057..8cb043d4105 100644 --- a/mac/Keyman4MacIM/KeymanTests/TestAppDelegate.h +++ b/mac/Keyman4MacIM/KeymanTests/TestAppDelegate.h @@ -22,7 +22,6 @@ typedef void(^PostEventCallback)(CGEventRef eventToPost); @property (nonatomic, assign) CFMachPortRef lowLevelEventTap; // Always nil for tests @property (nonatomic, assign) BOOL contextChangingEventDetected; @property (nonatomic, assign) BOOL useNullChar; -@property (nonatomic, assign) BOOL debugMode; @property (nonatomic, assign) CGKeyCode virtualKeyPosted; // Helper method diff --git a/mac/Keyman4MacIM/KeymanTests/TestAppDelegate.m b/mac/Keyman4MacIM/KeymanTests/TestAppDelegate.m index 4b247056af2..b2d1f859a2f 100644 --- a/mac/Keyman4MacIM/KeymanTests/TestAppDelegate.m +++ b/mac/Keyman4MacIM/KeymanTests/TestAppDelegate.m @@ -16,7 +16,7 @@ @implementation TestAppDelegate - (KMEngine *)kme { if (_kme == nil) { - _kme = [[KMEngine alloc] initWithKMX:nil context:self.contextBuffer verboseLogging:self.debugMode]; + _kme = [[KMEngine alloc] initWithKMX:nil context:self.contextBuffer]; } return _kme; @@ -42,10 +42,6 @@ - (void)setContextBuffer:(NSMutableString *)contextBuffer { [self.kme setCoreContextIfNeeded:self.contextBuffer]; } -- (BOOL)debugMode { - return YES; -} - -(NSEvent *)keyStrokeEventForCharacter:(NSString *)character keyCode:(unsigned short) keyCode { return [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSZeroPoint modifierFlags:0 timestamp:NSTimeIntervalSince1970 windowNumber:0 context:nil characters:character charactersIgnoringModifiers:character isARepeat:NO keyCode:keyCode]; } diff --git a/mac/KeymanEngine4Mac/KeymanEngine4Mac/CoreWrapper/CoreHelper.h b/mac/KeymanEngine4Mac/KeymanEngine4Mac/CoreWrapper/CoreHelper.h index 0345ea6f31e..ba3e5031f3d 100644 --- a/mac/KeymanEngine4Mac/KeymanEngine4Mac/CoreWrapper/CoreHelper.h +++ b/mac/KeymanEngine4Mac/KeymanEngine4Mac/CoreWrapper/CoreHelper.h @@ -16,13 +16,10 @@ extern UInt32 VirtualKeyMap[0x80]; @interface CoreHelper : NSObject -@property (assign, nonatomic) BOOL debugMode; - -(unichar const *) createUnicharStringFromNSString:(NSString *)string; -(NSString *) createNSStringFromUnicharString:(unichar const *)string; -(unsigned long long) unicharStringLength:(unichar const *)string; --(instancetype)initWithDebugMode:(BOOL)debugMode; -(unsigned short) macVirtualKeyToWindowsVirtualKey:(unsigned short) keyCode; -(UTF32Char)macToKeymanModifier:(NSEventModifierFlags)modifiers; -(NSString*)utf32ValueToString:(UTF32Char)scalarValue; diff --git a/mac/KeymanEngine4Mac/KeymanEngine4Mac/CoreWrapper/CoreHelper.m b/mac/KeymanEngine4Mac/KeymanEngine4Mac/CoreWrapper/CoreHelper.m index 46ddbdeeb14..c7858e7b0d9 100644 --- a/mac/KeymanEngine4Mac/KeymanEngine4Mac/CoreWrapper/CoreHelper.m +++ b/mac/KeymanEngine4Mac/KeymanEngine4Mac/CoreWrapper/CoreHelper.m @@ -69,10 +69,9 @@ -(unsigned long) scalarValueStringLength:(UTF32Char const *)string { return length; } --(instancetype)initWithDebugMode:(BOOL)debugMode { +-(instancetype)init { self = [super init]; if (self) { - _debugMode = debugMode; [self initVirtualKeyMapping]; } return self; diff --git a/mac/KeymanEngine4Mac/KeymanEngine4Mac/KME/KMEngine.h b/mac/KeymanEngine4Mac/KeymanEngine4Mac/KME/KMEngine.h index c79b02ba32b..523415fd26a 100644 --- a/mac/KeymanEngine4Mac/KeymanEngine4Mac/KME/KMEngine.h +++ b/mac/KeymanEngine4Mac/KeymanEngine4Mac/KME/KMEngine.h @@ -18,16 +18,14 @@ @interface KMEngine : NSObject @property (weak, nonatomic) KMXFile *kmx; -@property (assign, nonatomic) BOOL debugMode; -- (id)initWithKMX:(KMXFile *)kmx context:(NSString *)ctxBuf verboseLogging:(BOOL)enableDebugLogging; +- (id)initWithKMX:(KMXFile *)kmx context:(NSString *)ctxBuf; - (NSString *)getCoreContextDebug; - (void)clearCoreContext; - (void)setCoreContextIfNeeded:(NSString *)context; - (void)setCoreOptions:(NSString *)key withValue:(NSString *)value; - (CoreKeyOutput *)processEvent:(NSEvent *)event; -- (void)setUseVerboseLogging:(BOOL)useVerboseLogging; @end diff --git a/mac/KeymanEngine4Mac/KeymanEngine4Mac/KME/KMEngine.m b/mac/KeymanEngine4Mac/KeymanEngine4Mac/KME/KMEngine.m index dd2b3247ede..4578472b6c5 100644 --- a/mac/KeymanEngine4Mac/KeymanEngine4Mac/KME/KMEngine.m +++ b/mac/KeymanEngine4Mac/KeymanEngine4Mac/KME/KMEngine.m @@ -25,16 +25,11 @@ @interface KMEngine () @implementation KMEngine -NSMutableString* _easterEggForSentry = nil; -const NSString* kEasterEggText = @"Sentrycrash#KME"; -const NSString* kEasterEggKmxName = @"EnglishSpanish.kmx"; - -- (id)initWithKMX:(KMXFile *)kmx context:(NSString *)contextString verboseLogging:(BOOL)enableDebugLogging { +- (id)initWithKMX:(KMXFile *)kmx context:(NSString *)contextString { self = [super init]; if (self) { - self.debugMode = enableDebugLogging; _kmx = kmx; - _coreHelper = [[CoreHelper alloc] initWithDebugMode:enableDebugLogging]; + _coreHelper = [[CoreHelper alloc] init]; if (kmx) { [self loadCoreWrapperFromKmxFile:self.kmx.filePath]; @@ -63,31 +58,6 @@ -(void)setKmx:(KMXFile*) kmxFile { } } -- (void)setUseVerboseLogging:(BOOL)useVerboseLogging { - self.debugMode = useVerboseLogging; - - if (self.coreHelper) { - self.coreHelper.debugMode = useVerboseLogging; - } - - if (useVerboseLogging) { - os_log_debug([KMELogs testLog], "KMEngine - Turning verbose logging on"); - // In Keyman Engine if "debugMode" is turned on (explicitly) with "English plus Spanish" as the current keyboard and you type "Sentrycrash#KME", - // it will force a simulated crash to test reporting to sentry.keyman.com. - NSString * kmxName = [[_kmx filePath] lastPathComponent]; - os_log_debug([KMELogs testLog], "Sentry - KME: _kmx name = %{public}@", kmxName); - if ([kEasterEggKmxName isEqualToString:kmxName]) { - os_log_debug([KMELogs testLog], "Sentry - KME: Preparing to detect Easter egg."); - _easterEggForSentry = [[NSMutableString alloc] init]; - } - else - _easterEggForSentry = nil; - } - else { - os_log_debug([KMELogs testLog], "KMEngine - Turning verbose logging off"); - } -} - - (NSString *)getCoreContextDebug { return self.coreWrapper.contextDebug; } @@ -115,43 +85,6 @@ - (CoreKeyOutput *)processEvent:(NSEvent *)event { return [self.coreWrapper processEvent:event]; } -- (void) processPossibleEasterEggCharacterFrom:(NSString *)characters { - NSUInteger len = [_easterEggForSentry length]; - os_log_debug([KMELogs keyLog], "Sentry - KME: Processing character(s): %{public}@", characters); - if ([characters length] == 1 && [characters characterAtIndex:0] == [kEasterEggText characterAtIndex:len]) { - NSString *characterToAdd = [kEasterEggText substringWithRange:NSMakeRange(len, 1)]; - os_log_debug([KMELogs keyLog], "Sentry - KME: Adding character to Easter Egg code string: %{public}@", characterToAdd); - [_easterEggForSentry appendString:characterToAdd]; - if ([kEasterEggText isEqualToString:_easterEggForSentry]) { - os_log_debug([KMELogs keyLog], "Sentry - KME: Forcing crash now!"); - // Both of the following approaches do throw an exception that causes control to exit this method, - // but at least in my debug builds locally, neither one seems to get picked up by Sentry in a - // way that results in a new report on sentry.keyman.com - -#ifndef USE_ALERT_SHOW_HELP_TO_FORCE_EASTER_EGG_CRASH_FROM_ENGINE - //#1 - @throw ([NSException exceptionWithName:@"SentryForce" reason:@"Easter egg hit" userInfo:nil]); - - //#2 - // NSDecimalNumber *i = [NSDecimalNumber decimalNumberWithDecimal:[@(1) decimalValue]]; - // NSDecimalNumber *o = [NSDecimalNumber decimalNumberWithDecimal:[@(0) decimalValue]]; - // // Divide by 0 to throw an exception - // NSDecimalNumber *x = [i decimalNumberByDividingBy:o]; - -#else - //#3 The following DOES work, but it's really lame because the crash actually gets forced in the IM - // via this bogus call to a protocol method implemented in the IM's App Delegate just for the - // purpose of enabling the engine to force a crash. - [(NSObject *)[NSApp delegate] alertShowHelp:[NSAlert alertWithMessageText:@"Forcing an error" defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat:@"Forcing an Easter egg error from KME!"]]; -#endif - } - } - else if (len > 0) { - os_log_debug([KMELogs keyLog], "Sentry - KME: Clearing Easter Egg code string."); - [_easterEggForSentry setString:@""]; - } -} - - (NSString *)getCharsFromKeyCode:(UInt16)keyCode { TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardLayoutInputSource(); CFDataRef uchr = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData); diff --git a/mac/KeymanEngine4Mac/KeymanEngine4MacTests/CoreTestStaticHelperMethods.m b/mac/KeymanEngine4Mac/KeymanEngine4MacTests/CoreTestStaticHelperMethods.m index 0f0aaf8a830..9954f4e01da 100644 --- a/mac/KeymanEngine4Mac/KeymanEngine4MacTests/CoreTestStaticHelperMethods.m +++ b/mac/KeymanEngine4Mac/KeymanEngine4MacTests/CoreTestStaticHelperMethods.m @@ -16,7 +16,7 @@ @implementation CoreTestStaticHelperMethods + (CoreHelper *)helper { static CoreHelper *coreHelper = nil; if (coreHelper == nil) { - coreHelper = [[CoreHelper alloc] initWithDebugMode:YES]; + coreHelper = [[CoreHelper alloc] init]; } return coreHelper; } diff --git a/mac/KeymanEngine4Mac/KeymanEngine4MacTests/KMEngineTests.m b/mac/KeymanEngine4Mac/KeymanEngine4MacTests/KMEngineTests.m index 290f30f302b..2ebe487f8cb 100644 --- a/mac/KeymanEngine4Mac/KeymanEngine4MacTests/KMEngineTests.m +++ b/mac/KeymanEngine4Mac/KeymanEngine4MacTests/KMEngineTests.m @@ -32,7 +32,7 @@ - (void)tearDown { } - (void)testinitWithKMX_NilKmx_ProcessEventReturnsNil { - KMEngine *engine = [[KMEngine alloc] initWithKMX:nil context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:nil context:@""]; NSEvent *event = [[NSEvent alloc] init]; CoreKeyOutput *output = [engine processEvent:event]; XCTAssert(output == nil, @"Expected processEvent to return nil for nil kmx"); @@ -40,7 +40,7 @@ - (void)testinitWithKMX_NilKmx_ProcessEventReturnsNil { - (void)testinitWithKMX_ValidKmxEmptyContext_InitializedWithEmptyContext { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileTestMacEngine]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; XCTAssert(engine != nil, @"Expected non-nil engine"); // Note: relying on km_core_state_context_debug output format is just barely // acceptable for a unit test @@ -49,7 +49,7 @@ - (void)testinitWithKMX_ValidKmxEmptyContext_InitializedWithEmptyContext { - (void)testinitWithKMX_ValidKmxNonEmptyContext_InitializedWithContext { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileTestMacEngine]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"abc" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"abc"]; XCTAssert(engine != nil, @"Expected non-nil engine"); // Note: relying on km_core_state_context_debug output format is just barely // acceptable for a unit test @@ -58,7 +58,7 @@ - (void)testinitWithKMX_ValidKmxNonEmptyContext_InitializedWithContext { - (void)testsetCoreContextIfNeeded_NonEmptyContext_InitialContextUpdated { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileTestMacEngine]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"a" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"a"]; [engine setCoreContextIfNeeded:@"xyz"]; // Note: relying on km_core_state_context_debug output format is just barely // acceptable for a unit test @@ -69,7 +69,7 @@ - (void)testsetCoreContextIfNeeded_NonEmptyContext_InitialContextUpdated { /* - (void)testsetCoreContextIfNeeded_EmptyContext_InitialContextUpdated { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileTestMacEngine]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; [engine setCoreContextIfNeeded:@"xyz"]; // Note: relying on km_core_state_context_debug output format is just barely // acceptable for a unit test @@ -79,7 +79,7 @@ - (void)testsetCoreContextIfNeeded_EmptyContext_InitialContextUpdated { - (void)testprocessEvent_eventForCommandKey_ReturnsNilOutput { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileTestMacEngine]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:NSEventModifierFlagCommand timestamp:0 windowNumber:0 context:nil characters:@"a" charactersIgnoringModifiers:@"a" isARepeat:NO keyCode:kVK_ANSI_A]; CoreKeyOutput *output = [engine processEvent:event]; XCTAssert(output == nil, @"expected nil output from core"); @@ -87,7 +87,7 @@ - (void)testprocessEvent_eventForCommandKey_ReturnsNilOutput { - (void)testprocessEvent_eventWithoutKeycode_ReturnsNilOutput { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileTestMacEngine]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; NSEvent *event = [NSEvent mouseEventWithType:NSEventTypeMouseMoved location:NSMakePoint(29, 21) modifierFlags:NSEventModifierFlagShift timestamp:0 windowNumber:0 context:nil eventNumber:23 clickCount:0 pressure:0]; CoreKeyOutput *output = [engine processEvent:event]; XCTAssert(output == nil, @"nil CoreKeyOutput"); @@ -96,7 +96,7 @@ - (void)testprocessEvent_eventWithoutKeycode_ReturnsNilOutput { // TODO: shouldn't this return emitKeystroke = YES? - (void)testprocessEvent_eventForUnmappedKey_ReturnsNoActions { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileTestMacEngine]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:@"z" charactersIgnoringModifiers:@"z" isARepeat:NO keyCode:kVK_ANSI_Z]; CoreKeyOutput *output = [engine processEvent:event]; XCTAssert(output == nil, @"Expected nil array of actions"); @@ -104,7 +104,7 @@ - (void)testprocessEvent_eventForUnmappedKey_ReturnsNoActions { - (void)testprocessEvent_eventForLowercaseA_ReturnsCharacterActionWithExpectedCharacterBasedOnKmx { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileTestMacEngine]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:@"a" charactersIgnoringModifiers:@"a" isARepeat:NO keyCode:kVK_ANSI_A]; CoreKeyOutput *output = [engine processEvent:event]; os_log_debug([KMELogs testLog], "output = %{public}@", output); @@ -116,7 +116,7 @@ - (void)testprocessEvent_eventForLowercaseA_ReturnsCharacterActionWithExpectedCh /* -(void)testprocessEvent_eventForCtrlShiftNumeralWithCipherMusicKmx_ReturnsQstrActionForCorrectUnicodeSurrogatePair { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForCipherMusicTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile contextBuffer:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile contextBuffer:@""]; for (int i = 1; i <= 6; i++) { unsigned short ansiCode = kVK_ANSI_1 + i - 1; @@ -152,7 +152,7 @@ -(void)testprocessEvent_eventForCtrlShiftNumeralWithCipherMusicKmx_ReturnsQstrAc - (void)testprocessEvent_eventsForOpenCurlyBraceWithCipherMusicKmx_ReturnsCharacterForStartSlide { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForCipherMusicTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; UTF32Char expectedUtf32Char = 0x1D177; NSString * expectedStartSlideSurrogatePair = [[NSString alloc] initWithBytes:&expectedUtf32Char length:4 encoding:NSUTF32LittleEndianStringEncoding]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:NSEventModifierFlagShift timestamp:0 windowNumber:0 context:nil characters:@"{" charactersIgnoringModifiers:@"[" isARepeat:NO keyCode:kVK_ANSI_LeftBracket]; @@ -165,7 +165,7 @@ - (void)testprocessEvent_eventsForOpenCurlyBraceWithCipherMusicKmx_ReturnsCharac // TODO: fails with core, investigate - (void)testprocessEvent_eventForUnshiftedNumeralWithCipherMusicKmx_ReturnsCharacterActionToInsertNumeral { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForCipherMusicTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile contextBuffer:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile contextBuffer:@""]; for (int i = 1; i <= 9; i++) { unsigned short ansiCode = kVK_ANSI_1 + i - 1; @@ -185,7 +185,7 @@ - (void)testprocessEvent_eventForUnshiftedNumeralWithCipherMusicKmx_ReturnsChara // TODO: fails with core, returns CharacterAction - (void)testprocessEvent_eventForShiftNumeralsWithoutRulesInCipherMusicKmx_ReturnsNoAction { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForCipherMusicTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; for (int i = 0; i <= 9; i++) { if (i == 6) @@ -228,7 +228,7 @@ - (void)testprocessEvent_eventForShiftNumeralsWithoutRulesInCipherMusicKmx_Retur // TODO: fails with core, returns CharacterAction - (void)testprocessEvent_eventForPeriodWithCipherMusicKmx_ReturnsNoAction { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForCipherMusicTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:@"." charactersIgnoringModifiers:@"." isARepeat:NO keyCode:kVK_ANSI_Period]; CoreKeyOutput *output = [engine processEvent:event]; XCTAssert(!output.hasTextToInsert, @"expected no text to insert"); @@ -236,7 +236,7 @@ - (void)testprocessEvent_eventForPeriodWithCipherMusicKmx_ReturnsNoAction { - (void)testprocessEvent_eventForCtrl8WithCipherMusicKmx_ReturnsEmit { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForCipherMusicTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:NSEventModifierFlagControl timestamp:0 windowNumber:0 context:nil characters:@"8" charactersIgnoringModifiers:@"8" isARepeat:NO keyCode:kVK_ANSI_8]; CoreKeyOutput *output = [engine processEvent:event]; XCTAssert(output.emitKeystroke, @"emitKeystroke == YES"); @@ -279,7 +279,7 @@ - (void)testprocessEvent_eventForAWithModifiers_ReturnsCharacterActionWithExpect [KMEngineTests fillInNamesAndModifiersForAllChiralCombinations]; KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileTestMacEngine]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; for (i = 0; i < nCombinations; i++) { [engine clearCoreContext]; @@ -346,7 +346,7 @@ - (void)testprocessEvent_eventForSWithModifiers_ReturnsCharacterActionWithExpect [KMEngineTests fillInNamesAndModifiersForAllChiralCombinations]; KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileTestMacEngine]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; for (i = 0; i < nCombinations; i++) { [engine clearCoreContext]; @@ -419,7 +419,7 @@ - (void)testprocessEvent_eventForSWithModifiers_ReturnsCharacterActionWithExpect - (NSString *)checkPlatform_getOutputForKeystroke: (NSString*) character modifierFlags: (NSEventModifierFlags) flag keyCode:(unsigned short)code { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForPlatformTest]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; NSString *lcChar = [character lowercaseString]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:flag timestamp:0 windowNumber:0 context:nil characters:character charactersIgnoringModifiers:lcChar isARepeat:NO keyCode:code]; CoreKeyOutput *output = [engine processEvent:event]; @@ -516,7 +516,7 @@ - (void)testContextMatch_InvertedPlatformLogic_NotTouch { - (void)testEngine_ipaKeyboardAction_DoesNotCrash_Issue1892 { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForIndexOffsetTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"z" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"z"]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:@"a" charactersIgnoringModifiers:@"a" isARepeat:NO keyCode:kVK_ANSI_A]; CoreKeyOutput *output = [engine processEvent:event]; XCTAssert(output.hasCodePointsToDelete, @"output hasCodePointsToDelete == YES"); @@ -525,7 +525,7 @@ - (void)testEngine_ipaKeyboardAction_DoesNotCrash_Issue1892 { - (void)testCoreProcessEvent_eventForFWithElNuerKmx_ReturnsCorrectCharacter { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForElNuerTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:@"f" charactersIgnoringModifiers:@"f" isARepeat:NO keyCode:kVK_ANSI_F]; CoreKeyOutput *output = [engine processEvent:event]; XCTAssert([output.textToInsert isEqualToString:@"ɣ"], @"Expected output to be 'ɣ'."); @@ -535,7 +535,7 @@ - (void)testCoreProcessEvent_eventForFWithElNuerKmx_ReturnsCorrectCharacter { - (void)testArmenianMnemonic_triggerPersistOptions_ReturnsOptions { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForArmenianMnemonicTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"√" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"√"]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:@"w" charactersIgnoringModifiers:@"w" isARepeat:NO keyCode:kVK_ANSI_W]; CoreKeyOutput *output = [engine processEvent:event]; NSString *key = @"option_ligature_ew"; @@ -546,7 +546,7 @@ - (void)testArmenianMnemonic_triggerPersistOptions_ReturnsOptions { - (void)testCoreProcessEvent_backspaceElNuerEmptyContext_PassesThrough { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForElNuerTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@""]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:@"\b" charactersIgnoringModifiers:@"\b" isARepeat:NO keyCode:kVK_Delete]; CoreKeyOutput *output = [engine processEvent:event]; os_log_debug([KMELogs testLog], "output = %{public}@", output); @@ -557,7 +557,7 @@ - (void)testCoreProcessEvent_backspaceElNuerEmptyContext_PassesThrough { - (void)testCoreProcessEvent_backspaceElNuerWithContext_EmptiesContextReturnsDelete { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForElNuerTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"ɣ" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"ɣ"]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:@"\b" charactersIgnoringModifiers:@"\b" isARepeat:NO keyCode:kVK_Delete]; CoreKeyOutput *output = [engine processEvent:event]; os_log_debug([KMELogs testLog], "output = %{public}@", output); @@ -571,7 +571,7 @@ - (void)testCoreProcessEvent_backspaceElNuerWithContext_EmptiesContextReturnsDel - (void)testCoreProcessEvent_eventReturnWithElNuerKmx_EmitWithContextEmpty { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForElNuerTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"ɣ" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"ɣ"]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:@"\n" charactersIgnoringModifiers:@"\n" isARepeat:NO keyCode:kVK_Return]; CoreKeyOutput *output = [engine processEvent:event]; XCTAssert(output.emitKeystroke, @"Expected emitKeystroke==YES"); @@ -583,7 +583,7 @@ - (void)testCoreProcessEvent_eventReturnWithElNuerKmx_EmitWithContextEmpty { - (void)testCoreProcessEvent_eventTabWithElNuerKmx_EmitWithContextEmpty { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForElNuerTests]; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"ɣ" verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:@"ɣ"]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:@"\t" charactersIgnoringModifiers:@"\t" isARepeat:NO keyCode:kVK_Tab]; CoreKeyOutput *output = [engine processEvent:event]; XCTAssert(output.emitKeystroke, @"Expected emitKeystroke==YES"); @@ -596,7 +596,7 @@ - (void)testCoreProcessEvent_eventTabWithElNuerKmx_EmitWithContextEmpty { - (void)testCoreProcessEvent_eventSingleQuoteWithElNuerKmx_ReturnsDiacritic { KMXFile *kmxFile = [KeymanEngineTestsStaticHelperMethods getKmxFileForElNuerTests]; NSString *context = @"ɛ"; - KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:context verboseLogging:YES]; + KMEngine *engine = [[KMEngine alloc] initWithKMX:kmxFile context:context]; NSEvent *event = [NSEvent keyEventWithType:NSEventTypeKeyDown location:NSMakePoint(0, 0) modifierFlags:0 timestamp:0 windowNumber:0 context:nil characters:@"'" charactersIgnoringModifiers:@"'" isARepeat:NO keyCode:kVK_ANSI_Quote]; CoreKeyOutput *output = [engine processEvent:event]; XCTAssert(output.hasTextToInsert, @"returns text to insert"); From 7f7bbd4f7463a21b37705988ea848c1a522fb219 Mon Sep 17 00:00:00 2001 From: sgschantz Date: Thu, 19 Sep 2024 08:49:21 +0700 Subject: [PATCH 2/2] change(mac): fix sample app build error --- mac/Keyman4Mac/Keyman4Mac/AppDelegate.m | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/mac/Keyman4Mac/Keyman4Mac/AppDelegate.m b/mac/Keyman4Mac/Keyman4Mac/AppDelegate.m index 3ffb9129cf4..f6bf6c81fed 100644 --- a/mac/Keyman4Mac/Keyman4Mac/AppDelegate.m +++ b/mac/Keyman4Mac/Keyman4Mac/AppDelegate.m @@ -45,8 +45,6 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSArray *kvkFiles = [self KVKFiles]; for (NSString *path in kvkFiles){ KVKFile *kvkFile = [[KVKFile alloc] initWithFilePath:path]; - if (debugMode) - NSLog(@"%@", kvkFile); }*/ } @@ -225,18 +223,6 @@ - (void)comboBoxSelectionDidChange:(NSNotification *)notification { NSLog(@"%d: %@", index, kmStore); index++; } - - for (NSObject *gp in kmx.group) { - if (debugMode) { - NSLog(@"Group %@", gp); - //NSLog(@"match = %@", gp.match); - //NSLog(@"nomatch = %@", gp.noMatch); - /* - for (KMCompKey *kmKey in gp.keys) { - NSLog(@"\nKey: %@", kmKey); - }*/ - } - } } } @@ -257,9 +243,6 @@ - (void)setKMXList { if (!infoDict) continue; - //if (debugMode) - // NSLog(@"%@", infoDict); - //NSString *str = [NSString stringWithFormat:@"%@ (%@)", [infoDict objectForKey:kKMKeyboardNameKey], [infoDict objectForKey:kKMKeyboardVersionKey]]; NSString *str = [infoDict objectForKey:kKMKeyboardNameKey]; [kmxDesc addObject:str]; }