Bug 728103 part.2 Fix new test failures r=smaug

This commit is contained in:
Masayuki Nakano 2012-03-16 15:29:15 +09:00
parent b35c0b024f
commit 12da403f4d
5 changed files with 26 additions and 19 deletions

View File

@ -34,7 +34,7 @@ function clicked(event) {
function test() {
var accessKeyDetails = (navigator.platform.indexOf("Mac") >= 0) ?
{ ctrlKey : true } :
{ altKey : true, ctrlKey : true } :
{ altKey : true, shiftKey: true };
synthesizeKey("k", accessKeyDetails);
}

View File

@ -537,8 +537,13 @@ function startTest()
gLastFocusMethod = (key == "D" || key == "G") ? fm.FLAG_BYMOVEFOCUS : fm.FLAG_BYKEY;
// on Windows and Linux, the shift key must be pressed for content area access keys
if (navigator.platform.indexOf("Mac") == -1)
accessKeyDetails.shiftKey = (getById(keys[k]).ownerDocument.defaultView == gChildWindow);
// and on Mac, the alt key must be pressed for content area access keys
var isContent = (getById(keys[k]).ownerDocument.defaultView == gChildWindow);
if (navigator.platform.indexOf("Mac") == -1) {
accessKeyDetails.shiftKey = isContent;
} else {
accessKeyDetails.altKey = isContent;
}
expectFocusShift(function () synthesizeKey(key, accessKeyDetails),
null, getById(keys[k]), true, "accesskey " + key);

View File

@ -58,7 +58,8 @@ function runTests()
$("scale").focus();
var accessKeyDetails = (navigator.platform.indexOf("Mac") >= 0) ?
{ ctrlKey : true } : { altKey : true, shiftKey: true };
{ altKey: true, ctrlKey : true } :
{ altKey : true, shiftKey: true };
gExpectedBlur = document.getAnonymousNodes($("scale"))[0];
gExpectedFocus = $("menulist").inputField;

View File

@ -41,7 +41,8 @@ function test_radio()
window.blur();
var accessKeyDetails = (navigator.platform.indexOf("Mac") >= 0) ?
{ ctrlKey : true } : { altKey : true, shiftKey: true };
{ altKey : true, ctrlKey : true } :
{ altKey : true, shiftKey: true };
synthesizeKey("t", accessKeyDetails);
var radiogroup = $("radiogroup-initwithselected");

View File

@ -491,44 +491,44 @@ function runAccessKeyTests()
testKey({layout:"US", keyCode:0, chars:"a", unmodifiedChars:"a"},
"a", false);
testKey({layout:"US", keyCode:0, ctrl:1, chars:"\u0001", unmodifiedChars:"a"},
"a", true);
"a", false);
testKey({layout:"US", keyCode:0, ctrl:1, chars:"\u0001", unmodifiedChars:"a"},
"A", true);
"A", false);
// Shift-ctrl does not activate accesskeys
testKey({layout:"US", keyCode:0, ctrl:1, shift:1, chars:"\u0001", unmodifiedChars:"A"},
"a", false);
testKey({layout:"US", keyCode:0, ctrl:1, shift:1, chars:"\u0001", unmodifiedChars:"A"},
"A", false);
// Alt-ctrl does not activate accesskeys
// Alt-ctrl activate accesskeys
testKey({layout:"US", keyCode:0, ctrl:1, alt:1, chars:"\u0001", unmodifiedChars:"a"},
"a", false);
"a", true);
testKey({layout:"US", keyCode:0, ctrl:1, alt:1, chars:"\u0001", unmodifiedChars:"a"},
"A", false);
"A", true);
// Greek layout can activate a Latin accesskey
testKey({layout:"Greek", keyCode:0, ctrl:1, chars:"\u0001", unmodifiedChars:"\u03b1"},
testKey({layout:"Greek", keyCode:0, ctrl:1, alt:1, chars:"\u0001", unmodifiedChars:"\u03b1"},
"a", true);
testKey({layout:"Greek", keyCode:0, ctrl:1, chars:"\u0001", unmodifiedChars:"\u03b1"},
testKey({layout:"Greek", keyCode:0, ctrl:1, alt:1, chars:"\u0001", unmodifiedChars:"\u03b1"},
"A", true);
// ... and a Greek accesskey!
testKey({layout:"Greek", keyCode:0, ctrl:1, chars:"\u0001", unmodifiedChars:"\u03b1"},
testKey({layout:"Greek", keyCode:0, ctrl:1, alt:1, chars:"\u0001", unmodifiedChars:"\u03b1"},
"\u03b1", true);
testKey({layout:"Greek", keyCode:0, ctrl:1, chars:"\u0001", unmodifiedChars:"\u03b1"},
testKey({layout:"Greek", keyCode:0, ctrl:1, alt:1, chars:"\u0001", unmodifiedChars:"\u03b1"},
"\u0391", true);
// bug 359638
testKey({layout:"US", keyCode:47, ctrl:1, chars:".", unmodifiedChars:"."},
testKey({layout:"US", keyCode:47, ctrl:1, alt:1, chars:".", unmodifiedChars:"."},
".", true);
// German (KCHR/KeyTranslate case)
testKey({layout:"German", keyCode:0, ctrl:1, chars:"a", unmodifiedChars:"a"},
testKey({layout:"German", keyCode:0, ctrl:1, alt:1, chars:"a", unmodifiedChars:"a"},
"a", true);
testKey({layout:"German", keyCode:0, ctrl:1, chars:"a", unmodifiedChars:"a"},
testKey({layout:"German", keyCode:0, ctrl:1, alt:1, chars:"a", unmodifiedChars:"a"},
"A", true);
testKey({layout:"German", keyCode:33, ctrl:1, chars:"\u00fc", unmodifiedChars:"\u00fc"},
testKey({layout:"German", keyCode:33, ctrl:1, alt:1, chars:"\u00fc", unmodifiedChars:"\u00fc"},
"\u00fc", true);
testKey({layout:"German", keyCode:33, ctrl:1, chars:"\u00fc", unmodifiedChars:"\u00fc"},
testKey({layout:"German", keyCode:33, ctrl:1, alt:1, chars:"\u00fc", unmodifiedChars:"\u00fc"},
"\u00dc", true);
}
else if (IS_WIN) {