From c84e0e40c715c1f926d3cb9bab06dbd62b9ea96c Mon Sep 17 00:00:00 2001 From: "joshmoz%gmail.com" Date: Thu, 8 May 2008 22:41:13 +0000 Subject: [PATCH] add tests, patch by roc, b=432773 r=josh --- widget/src/cocoa/nsChildView.mm | 23 ++++- widget/tests/test_keycodes.xul | 174 ++++++++++++++++++++++++-------- 2 files changed, 154 insertions(+), 43 deletions(-) diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index 56b18d3642c..c60031a2da3 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -375,8 +375,27 @@ nsChildView::nsChildView() : nsBaseWidget() , mInSetFocus(PR_FALSE) { #ifdef PR_LOGGING - if (!sCocoaLog) + if (!sCocoaLog) { sCocoaLog = PR_NewLogModule("nsCocoaWidgets"); + CFIndex idx; + KLGetKeyboardLayoutCount(&idx); + PR_LOG(sCocoaLog, PR_LOG_ALWAYS, ("Keyboard layout configuration:")); + for (CFIndex i = 0; i < idx; ++i) { + KeyboardLayoutRef curKL; + if (KLGetKeyboardLayoutAtIndex(i, &curKL) == noErr) { + CFStringRef name; + if (KLGetKeyboardLayoutProperty(curKL, kKLName, (const void**)&name) == noErr) { + int idn; + KLGetKeyboardLayoutProperty(curKL, kKLIdentifier, (const void**)&idn); + int kind; + KLGetKeyboardLayoutProperty(curKL, kKLKind, (const void**)&kind); + char buf[256]; + CFStringGetCString(name, buf, 256, kCFStringEncodingASCII); + PR_LOG(sCocoaLog, PR_LOG_ALWAYS, (" %d,%s,%d\n", idn, buf, kind)); + } + } + } + } #endif SetBackgroundColor(NS_RGB(255, 255, 255)); @@ -1297,8 +1316,6 @@ nsresult nsChildView::SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout, { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; - NS_ASSERTION(aNativeKeyboardLayout, "Layout cannot be 0"); - PRUint32 modifierFlags = 0; for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(sModifierFlagMap); ++i) { if (aModifierFlags & sModifierFlagMap[i][0]) { diff --git a/widget/tests/test_keycodes.xul b/widget/tests/test_keycodes.xul index 5f4506f4fd5..ab2aa66819b 100644 --- a/widget/tests/test_keycodes.xul +++ b/widget/tests/test_keycodes.xul @@ -13,6 +13,13 @@