mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 460556 tests for bug 460500 r+sr=roc
This commit is contained in:
parent
2a15218653
commit
cbe6ca1ba3
@ -1095,9 +1095,10 @@ class nsIWidget : public nsISupports {
|
|||||||
CTRL_R = 0x0800,
|
CTRL_R = 0x0800,
|
||||||
ALT_L = 0x1000, // includes Option
|
ALT_L = 0x1000, // includes Option
|
||||||
ALT_R = 0x2000,
|
ALT_R = 0x2000,
|
||||||
COMMAND = 0x4000,
|
COMMAND_L = 0x4000,
|
||||||
HELP = 0x8000,
|
COMMAND_R = 0x8000,
|
||||||
FUNCTION = 0x10000,
|
HELP = 0x10000,
|
||||||
|
FUNCTION = 0x100000,
|
||||||
NUMERIC_KEY_PAD = 0x01000000 // when the key is coming from the keypad
|
NUMERIC_KEY_PAD = 0x01000000 // when the key is coming from the keypad
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
@ -1442,9 +1442,13 @@ static KeyboardLayoutOverride gOverrideKeyboardLayout;
|
|||||||
static const PRUint32 sModifierFlagMap[][2] = {
|
static const PRUint32 sModifierFlagMap[][2] = {
|
||||||
{ nsIWidget::CAPS_LOCK, NSAlphaShiftKeyMask },
|
{ nsIWidget::CAPS_LOCK, NSAlphaShiftKeyMask },
|
||||||
{ nsIWidget::SHIFT_L, NSShiftKeyMask },
|
{ nsIWidget::SHIFT_L, NSShiftKeyMask },
|
||||||
|
{ nsIWidget::SHIFT_R, NSShiftKeyMask },
|
||||||
{ nsIWidget::CTRL_L, NSControlKeyMask },
|
{ nsIWidget::CTRL_L, NSControlKeyMask },
|
||||||
|
{ nsIWidget::CTRL_R, NSControlKeyMask },
|
||||||
{ nsIWidget::ALT_L, NSAlternateKeyMask },
|
{ nsIWidget::ALT_L, NSAlternateKeyMask },
|
||||||
{ nsIWidget::COMMAND, NSCommandKeyMask },
|
{ nsIWidget::ALT_R, NSAlternateKeyMask },
|
||||||
|
{ nsIWidget::COMMAND_L, NSCommandKeyMask },
|
||||||
|
{ nsIWidget::COMMAND_R, NSCommandKeyMask },
|
||||||
{ nsIWidget::NUMERIC_KEY_PAD, NSNumericPadKeyMask },
|
{ nsIWidget::NUMERIC_KEY_PAD, NSNumericPadKeyMask },
|
||||||
{ nsIWidget::HELP, NSHelpKeyMask },
|
{ nsIWidget::HELP, NSHelpKeyMask },
|
||||||
{ nsIWidget::FUNCTION, NSFunctionKeyMask }
|
{ nsIWidget::FUNCTION, NSFunctionKeyMask }
|
||||||
@ -1464,7 +1468,19 @@ nsresult nsChildView::SynthesizeNativeKeyEvent(PRInt32 aNativeKeyboardLayout,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
int windowNumber = [[mView window] windowNumber];
|
int windowNumber = [[mView window] windowNumber];
|
||||||
BOOL sendFlagsChangedEvent = aNativeKeyCode == kCapsLockKeyCode;
|
BOOL sendFlagsChangedEvent = NO;
|
||||||
|
switch (aNativeKeyCode) {
|
||||||
|
case kCapsLockKeyCode:
|
||||||
|
case kRCommandKeyCode:
|
||||||
|
case kCommandKeyCode:
|
||||||
|
case kShiftKeyCode:
|
||||||
|
case kOptionkeyCode:
|
||||||
|
case kControlKeyCode:
|
||||||
|
case kRShiftKeyCode:
|
||||||
|
case kROptionKeyCode:
|
||||||
|
case kRControlKeyCode:
|
||||||
|
sendFlagsChangedEvent = YES;
|
||||||
|
}
|
||||||
NSEventType eventType = sendFlagsChangedEvent ? NSFlagsChanged : NSKeyDown;
|
NSEventType eventType = sendFlagsChangedEvent ? NSFlagsChanged : NSKeyDown;
|
||||||
NSEvent* downEvent = [NSEvent keyEventWithType:eventType
|
NSEvent* downEvent = [NSEvent keyEventWithType:eventType
|
||||||
location:NSMakePoint(0,0)
|
location:NSMakePoint(0,0)
|
||||||
|
@ -64,10 +64,11 @@ function synthesizeNativeKey(aLayout, aKeyCode, aModifiers, aSystemChars,
|
|||||||
if (aModifiers.alt) modifiers |= 0x1000;
|
if (aModifiers.alt) modifiers |= 0x1000;
|
||||||
if (aModifiers.altRight) modifiers |= 0x2000;
|
if (aModifiers.altRight) modifiers |= 0x2000;
|
||||||
if (aModifiers.command) modifiers |= 0x4000;
|
if (aModifiers.command) modifiers |= 0x4000;
|
||||||
if (aModifiers.help) modifiers |= 0x8000;
|
if (aModifiers.commandRight) modifiers |= 0x8000;
|
||||||
if (aModifiers.function) modifiers |= 0x10000;
|
if (aModifiers.help) modifiers |= 0x10000;
|
||||||
|
if (aModifiers.function) modifiers |= 0x100000;
|
||||||
if (aModifiers.numericKeyPad) modifiers |= 0x01000000;
|
if (aModifiers.numericKeyPad) modifiers |= 0x01000000;
|
||||||
|
|
||||||
utils.sendNativeKeyEvent(aLayout, aKeyCode, modifiers,
|
utils.sendNativeKeyEvent(aLayout, aKeyCode, modifiers,
|
||||||
aSystemChars, aSystemUnmodifiedChars);
|
aSystemChars, aSystemUnmodifiedChars);
|
||||||
}
|
}
|
||||||
@ -105,15 +106,27 @@ function eventToString(aEvent)
|
|||||||
if (aEvent.shift) {
|
if (aEvent.shift) {
|
||||||
name += " [Shift]";
|
name += " [Shift]";
|
||||||
}
|
}
|
||||||
|
if (aEvent.shiftRight) {
|
||||||
|
name += " [Right Shift]";
|
||||||
|
}
|
||||||
if (aEvent.ctrl) {
|
if (aEvent.ctrl) {
|
||||||
name += " [Ctrl]";
|
name += " [Ctrl]";
|
||||||
}
|
}
|
||||||
|
if (aEvent.ctrlRight) {
|
||||||
|
name += " [Right Ctrl]";
|
||||||
|
}
|
||||||
if (aEvent.alt) {
|
if (aEvent.alt) {
|
||||||
name += " [Alt]";
|
name += " [Alt]";
|
||||||
}
|
}
|
||||||
|
if (aEvent.altRight) {
|
||||||
|
name += " [Right Alt]";
|
||||||
|
}
|
||||||
if (aEvent.command) {
|
if (aEvent.command) {
|
||||||
name += " [Command]";
|
name += " [Command]";
|
||||||
}
|
}
|
||||||
|
if (aEvent.commandRight) {
|
||||||
|
name += " [Right Command]";
|
||||||
|
}
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
@ -244,10 +257,10 @@ function runKeyEventTests()
|
|||||||
|
|
||||||
if (firedEventType != "") {
|
if (firedEventType != "") {
|
||||||
var e = eventList[i];
|
var e = eventList[i];
|
||||||
is(e.ctrlKey, aEvent.ctrl || 0, name + ", Ctrl mismatch");
|
is(e.ctrlKey, aEvent.ctrl || aEvent.ctrlRight || 0, name + ", Ctrl mismatch");
|
||||||
is(e.metaKey, aEvent.command || 0, name + ", Command mismatch");
|
is(e.metaKey, aEvent.command || aEvent.commandRight || 0, name + ", Command mismatch");
|
||||||
is(e.altKey, aEvent.alt || 0, name + ", Alt mismatch");
|
is(e.altKey, aEvent.alt || aEvent.altRight || 0, name + ", Alt mismatch");
|
||||||
is(e.shiftKey, aEvent.shift || 0, name + ", Shift mismatch");
|
is(e.shiftKey, aEvent.shift || aEvent.shiftRight || 0, name + ", Shift mismatch");
|
||||||
|
|
||||||
if (aExpectGeckoChar.length > 0 && e.type == "keypress")
|
if (aExpectGeckoChar.length > 0 && e.type == "keypress")
|
||||||
is(e.charCode, aExpectGeckoChar.charCodeAt(0), name + ", charcode");
|
is(e.charCode, aExpectGeckoChar.charCodeAt(0), name + ", charcode");
|
||||||
@ -349,8 +362,48 @@ function runKeyEventTests()
|
|||||||
// XXX keyup event of Caps Lock key is not fired.
|
// XXX keyup event of Caps Lock key is not fired.
|
||||||
testKey({layout:"US", keyCode:57, capsLock:1, chars:"", unmodifiedChars:""},
|
testKey({layout:"US", keyCode:57, capsLock:1, chars:"", unmodifiedChars:""},
|
||||||
"", SHOULD_DELIVER_KEYDOWN);
|
"", SHOULD_DELIVER_KEYDOWN);
|
||||||
testKey({layout:"US", keyCode:57, chars:"", unmodifiedChars:""},
|
testKey({layout:"US", keyCode:57, capsLock:0, chars:"", unmodifiedChars:""},
|
||||||
"", SHOULD_DELIVER_KEYDOWN);
|
"", SHOULD_DELIVER_KEYDOWN);
|
||||||
|
|
||||||
|
// Shift/RightShift key event
|
||||||
|
testKey({layout:"US", keyCode:56, shift:1, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYDOWN);
|
||||||
|
testKey({layout:"US", keyCode:56, shift:0, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYUP);
|
||||||
|
testKey({layout:"US", keyCode:60, shiftRight:1, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYDOWN);
|
||||||
|
testKey({layout:"US", keyCode:60, shiftRight:0, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYUP);
|
||||||
|
|
||||||
|
// Control/RightControl key event
|
||||||
|
testKey({layout:"US", keyCode:59, ctrl:1, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYDOWN);
|
||||||
|
testKey({layout:"US", keyCode:59, ctrl:0, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYUP);
|
||||||
|
testKey({layout:"US", keyCode:62, ctrlRight:1, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYDOWN);
|
||||||
|
testKey({layout:"US", keyCode:62, ctrlRight:0, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYUP);
|
||||||
|
|
||||||
|
// Option/RightOption key event
|
||||||
|
testKey({layout:"US", keyCode:58, alt:1, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYDOWN);
|
||||||
|
testKey({layout:"US", keyCode:58, alt:0, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYUP);
|
||||||
|
testKey({layout:"US", keyCode:61, altRight:1, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYDOWN);
|
||||||
|
testKey({layout:"US", keyCode:61, altRight:0, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYUP);
|
||||||
|
|
||||||
|
// Command/RightCommand key event
|
||||||
|
testKey({layout:"US", keyCode:55, command:1, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYDOWN);
|
||||||
|
testKey({layout:"US", keyCode:55, command:0, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYUP);
|
||||||
|
testKey({layout:"US", keyCode:54, commandRight:1, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYDOWN);
|
||||||
|
testKey({layout:"US", keyCode:54, commandRight:0, chars:"", unmodifiedChars:""},
|
||||||
|
"", SHOULD_DELIVER_KEYUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (navigator.platform.indexOf("Win") == 0) {
|
if (navigator.platform.indexOf("Win") == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user