~ubuntu-branches/ubuntu/precise/xulrunner-1.9/precise

« back to all changes in this revision

Viewing changes to mozilla/widget/tests/test_keycodes.xul

  • Committer: Bazaar Package Importer
  • Author(s): Alexander Sack
  • Date: 2008-12-16 18:40:18 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20081216184018-j646ukfhzxnjynix
Tags: 1.9.0.5+nobinonly-0ubuntu1
* new security/stability upstream release v1.9.0.5 (FIREFOX_3_0_5_RELEASE)
  - see USN-690-1
* submit patches upstreamed:
  - bzXXX_plugin_for_mimetype_pref.patch => bz449188_att350098_plugin_for_mimetype_pref.patch
  - update debian/patches/series
* adjust XULFastLoad cache in response to interleaving landing of bmo
  #453545 and #462806
  - update debian/patches/bz368428_attachment_308130.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
  <!-- for some reason, if we don't have 'accesskey' here, adding it dynamically later
29
29
       doesn't work! -->
30
30
  <button id="button" accesskey="z">Hello</button>
 
31
  <input type="text" id="textbox" value=""/>
31
32
</p>
32
33
<div id="content" style="display: none">
33
34
  
93
94
    "Swedish":0x41d,
94
95
    "Arabic":0x401,
95
96
    "Hebrew":0x40d,
96
 
    "Japanese":0x411
 
97
    "Japanese":0x411,
 
98
    "Lithuanian":0x10427
97
99
  };
98
100
}
99
101
 
116
118
  return name;  
117
119
}
118
120
 
119
 
function synthesizeKey(aEvent)
 
121
function synthesizeKey(aEvent, aFocusElementId)
120
122
{
121
 
  document.getElementById("button").focus();
 
123
  document.getElementById(aFocusElementId).focus();
122
124
 
123
125
  synthesizeNativeKey(keyboardLayouts[aEvent.layout],
124
126
                      aEvent.keyCode, aEvent, aEvent.chars, aEvent.unmodifiedChars);
141
143
  {
142
144
    pressList = [];
143
145
    
144
 
    synthesizeKey(aEvent);
 
146
    synthesizeKey(aEvent, "button");
145
147
 
146
148
    var name = eventToString(aEvent);
147
149
 
312
314
    activationCount = 0;
313
315
    button.setAttribute("accesskey", aAccessKey);
314
316
 
315
 
    synthesizeKey(aEvent);
 
317
    synthesizeKey(aEvent, "button");
316
318
 
317
319
    var name = eventToString(aEvent);
318
320
 
409
411
    var elem = document.getElementById(aElem);
410
412
    elem.activeCount = 0;
411
413
 
412
 
    synthesizeKey(aEvent);
 
414
    synthesizeKey(aEvent, "button");
413
415
 
414
416
    var name = eventToString(aEvent);
415
417
 
496
498
  }
497
499
}
498
500
 
 
501
function runTextInputTests()
 
502
{
 
503
  var textbox = document.getElementById("textbox");
 
504
 
 
505
  function testKey(aEvent, aExpectText) {
 
506
    textbox.value = "";
 
507
    textbox.focus();
 
508
 
 
509
    synthesizeKey(aEvent, "textbox");
 
510
 
 
511
    var name = eventToString(aEvent);
 
512
 
 
513
    is(textbox.value, aExpectText, name + " does not input correct text.");
 
514
  }
 
515
 
 
516
  if (navigator.platform.indexOf("Win") == 0) {
 
517
    // Basic sanity checks
 
518
    testKey({layout:"US", keyCode:65, chars:"a"},
 
519
            "a");
 
520
    testKey({layout:"US", keyCode:65, shift:1, chars:"A"},
 
521
            "A");
 
522
    // When Ctrl+Alt are pressed, any text should not be inputted.
 
523
    testKey({layout:"US", keyCode:65, ctrl:1, alt:1, chars:""},
 
524
            "");
 
525
 
 
526
    // Lithuanian AltGr should be consumed at 9/0 keys pressed
 
527
    testKey({layout:"Lithuanian", keyCode:56, chars:"\u016B"},
 
528
            "\u016B");
 
529
    testKey({layout:"Lithuanian", keyCode:57, chars:"9"},
 
530
            "9");
 
531
    testKey({layout:"Lithuanian", keyCode:48, chars:"0"},
 
532
            "0");
 
533
    testKey({layout:"Lithuanian", keyCode:56, ctrl:1, alt:1, chars:"8"},
 
534
            "8");
 
535
    testKey({layout:"Lithuanian", keyCode:57, ctrl:1, alt:1, chars:"9"},
 
536
            "9");
 
537
    testKey({layout:"Lithuanian", keyCode:48, ctrl:1, alt:1, chars:"0"},
 
538
            "0");
 
539
  }
 
540
}
 
541
 
499
542
function runTest()
500
543
{
501
544
  runPressTests();
502
545
  runAccessKeyTests();
503
546
  runXULKeyTests();
 
547
  runTextInputTests();
504
548
  SimpleTest.finish();
505
549
}
506
550