+2007-09-07 Oliver Hunt <oliver@apple.com>
+
+ Reviewed by Sam.
+
+ Re-adding a few mac specific directories that accidentally got clobbered
+ during my recent layout test rearranging
+
+ * platform/mac/editing/input: Added.
+ * platform/mac/editing/input/hangul-enter-confirms-and-sends-keypress-expected.txt: Added.
+ * platform/mac/editing/input/hangul-enter-confirms-and-sends-keypress.html: Added.
+ * platform/mac/editing/input/hangul.js: Added.
+ * platform/mac/editing/input/kotoeri-enter-to-confirm-and-newline-expected.txt: Added.
+ * platform/mac/editing/input/kotoeri-enter-to-confirm-and-newline.html: Added.
+ * platform/mac/editing/input/kotoeri.js: Added.
+ * platform/mac/editing/input/logger.js: Added.
+ * platform/mac/fast/AppleScript: Added.
+ * platform/mac/fast/AppleScript/001-expected.txt: Added.
+ * platform/mac/fast/AppleScript/001.html: Added.
+ * platform/mac/fast/AppleScript/array-expected.txt: Added.
+ * platform/mac/fast/AppleScript/array.html: Added.
+ * platform/mac/fast/AppleScript/date-expected.txt: Added.
+ * platform/mac/fast/AppleScript/date.html: Added.
+ * platform/mac/fast/objc: Added.
+ * platform/mac/fast/objc/longlongTest-expected.txt: Added.
+ * platform/mac/fast/objc/longlongTest.html: Added.
+
2007-09-07 Justin Garcia <justin.garcia@apple.com>
Disabling the layout tests checked in with r25421 while I investigate
--- /dev/null
+This tests that the hangul IM behaviour in which enter both confirms a composition but still sends a keypress for the <enter>.
+To test manually, switch to the 2-Set Korean IM and type at least two characters and press <enter>, if the behaviour is correct a single keypress event should be fired as the last event.
+
+Received valid keydown event
+Received valid keydown event
+Received valid keydown event
+Received valid keypress event
--- /dev/null
+<div>
+ This tests that the hangul IM behaviour in which enter both confirms a composition but still sends a keypress for the <enter>.<br />
+ To test manually, switch to the 2-Set Korean IM and type at least two characters and press <enter>, if the behaviour is correct a single keypress event should be fired as the last event.
+</div>
+<input id="targetInput" onkeydown="keyDown()" onkeypress="keyPress()"></input>
+<ul id="console"></console>
+
+<script src="logger.js"></script>
+<script src="hangul.js"></script>
+<script>
+ var shouldBeCompositionEvent = false;
+ function keyDown() {
+ if (!window.layoutTestController) {
+ log("keydown : keyCode == " + event.keyCode);
+ return;
+ }
+ if (shouldBeCompositionEvent && event.keyCode != 229)
+ log("FAILURE: received keyCode " + event.keyCode + " in a keydown when VK_PROCESSKEY is expected");
+ else if (!shouldBeCompositionEvent && event.keyCode == 229)
+ log("FAILURE: received a keyDown with VK_PROCESSKEY as the keyCode, when an actual key code was expected.");
+ else
+ log("Received valid keydown event");
+ }
+
+ function keyPress() {
+ if (!window.layoutTestController) {
+ log("keypress : keyCode == " + event.keyCode);
+ return;
+ }
+ if (shouldBeCompositionEvent)
+ log("FAILURE: received keypress event during composition");
+ else
+ log("Received valid keypress event");
+ }
+
+
+ var targetInput = document.getElementById('targetInput');
+ targetInput.focus();
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ textInputController.setInputMethodHandler(hangul);
+ shouldBeCompositionEvent = true;
+ eventSender.keyDown('t');
+ eventSender.keyDown('o');
+ shouldBeCompositionEvent = false;
+ eventSender.keyDown('\n');
+ }
+</script>
--- /dev/null
+/*
+ * Pseudo hangul-IM, only one character is marked at a time,
+ * enter confirms the composition, but is passed on to the app to handle as a keypress
+ */
+var hangulState = { "compositionString": null };
+function hangul(event){
+ if (event.characters[0] == '\n') {
+ if (hangulState.compositionString != null)
+ textInputController.insertText(hangulState.compositionString);
+ hangulState.compositionString = null;
+ textInputController.doCommand("insertNewline:");
+ return true;
+ }
+
+ if (hangulState.compositionString != null)
+ textInputController.insertText(hangulState.compositionString);
+
+ hangulState.compositionString = event.characters;
+ var markedText = textInputController.makeAttributedString(hangulState.compositionString);
+ markedText.addAttribute("NSUnderline", 1);
+ textInputController.setMarkedText(markedText, markedText.length, 0);
+ return true;
+}
--- /dev/null
+This tests a subset of pseudo-kotoeri behaviour:
+All keydown events never result in keypress during composition
+During composition all keydown events should have keyCode 229, this is necessary to match the behaviour of windows browsers, including WebKit/Win
+To test this manually switch to the Kotoeri/Hiragana input method, and type 'toukyou'<enter><enter>.
+You should see only a single keypress event, as the very last reported event.
+
+Received valid keydown event
+Received valid keydown event
+Received valid keydown event
+Received valid keydown event
+Received valid keydown event
+Received valid keydown event
+Received valid keydown event
+Received valid keydown event
+Received valid keydown event
+Received valid keypress event
+PASSED: Successfully typed 'toukyou'
--- /dev/null
+<div>
+ This tests a subset of pseudo-kotoeri behaviour:
+ <ul>
+ <li>All keydown events never result in keypress during composition</li>
+ <li>During composition all keydown events should have keyCode 229, this is necessary to match the behaviour of windows browsers, including WebKit/Win</li>
+ </ul>
+ To test this manually switch to the Kotoeri/Hiragana input method, and type 'toukyou'<enter><enter>.<br />
+ You should see only a single keypress event, as the very last reported event.
+</div>
+<input id="targetInput" onkeydown="keyDown()" onkeypress="keyPress()">
+<ul id="console"></console>
+
+<script src="logger.js"></script>
+<script src="kotoeri.js"></script>
+<script>
+ var shouldBeCompositionEvent = false;
+ function keyDown() {
+ if (!window.layoutTestController) {
+ log("keydown : keyCode == " + event.keyCode);
+ return;
+ }
+ if (shouldBeCompositionEvent && event.keyCode != 229)
+ log("FAILURE: received keyCode " + event.keyCode + " in a keydown when VK_PROCESSKEY is expected");
+ else if (!shouldBeCompositionEvent && event.keyCode == 229)
+ log("FAILURE: received a keyDown with VK_PROCESSKEY as the keyCode, when an actual key code was expected.");
+ else
+ log("Received valid keydown event");
+ }
+
+ function keyPress() {
+ if (!window.layoutTestController) {
+ log("keypress : keyCode == " + event.keyCode);
+ return;
+ }
+ if (shouldBeCompositionEvent)
+ log("FAILURE: received keypress event during composition");
+ else
+ log("Received valid keypress event");
+ }
+
+ var targetInput = document.getElementById('targetInput');
+ targetInput.focus();
+ if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ textInputController.setInputMethodHandler(kotoeri);
+ shouldBeCompositionEvent = true;
+ eventSender.keyDown('t');
+ eventSender.keyDown('o');
+ eventSender.keyDown('u');
+ eventSender.keyDown('k');
+ eventSender.keyDown('y');
+ eventSender.keyDown('o');
+ eventSender.keyDown('u');
+ eventSender.keyDown('\n');
+ shouldBeCompositionEvent = false;
+ eventSender.keyDown('\n');
+ if (targetInput.value != "toukyou")
+ log("FAILED: Input field should countain the text 'toukyou'");
+ else
+ log("PASSED: Successfully typed 'toukyou'");
+ }
+</script>
--- /dev/null
+var kotoeriState = { "compositionString": null };
+function kotoeri(event){
+ if (event.characters[0] == '\n') {
+ if (kotoeriState.compositionString == null) {
+ textInputController.doCommand("insertNewline:");
+ return true;
+ }
+ textInputController.insertText(kotoeriState.compositionString);
+ kotoeriState.compositionString = null;
+ return true;
+ }
+
+ if (kotoeriState.compositionString == null)
+ kotoeriState.compositionString = "";
+ kotoeriState.compositionString += event.characters;
+ var markedText = textInputController.makeAttributedString(kotoeriState.compositionString);
+ markedText.addAttribute("NSUnderline", 2);
+ textInputController.setMarkedText(markedText, markedText.length, 0);
+ return true;
+}
--- /dev/null
+function log(msg) {
+ var console = document.getElementById("console");
+ var li = document.createElement("li");
+ li.appendChild(document.createTextNode(msg));
+ console.appendChild(li);
+}
--- /dev/null
+CONSOLE MESSAGE: line 1: TypeError: Value undefined (result of expression document.lalala) is not object.
+An automated test for basic AppleScript "do JavaScript" support.
+4 ('long')
+4 ('long')
+0.6666666666666666 ('doub')
+0.6666666666666666 ('doub')
+INF ('doub')
+-INF ('doub')
+false ('bool')
+false ('bool')
+"a string" ('utxt')
+"a string" ('utxt')
+"An automated test for basic AppleScript "do JavaScript" support." ('utxt')
+"An automated test for basic AppleScript "do JavaScript" support." ('utxt')
+"[object HTMLDocument]" ('utxt')
+"do JavaScript - converting to AppleScript types" ('utxt')
+'msng' ('type')
+(null)
+"[object Object]" ('utxt')
--- /dev/null
+<html>
+<head>
+<title>do JavaScript - converting to AppleScript types</title>
+</head>
+<body>
+An automated test for basic AppleScript "do JavaScript" support.
+<script type="text/javascript">
+
+ var console_messages = document.createElement("ol");
+
+ function log(message)
+ {
+ var item = document.createElement("li");
+ item.appendChild(document.createTextNode(message));
+ console_messages.appendChild(item);
+ }
+ if (window.layoutTestController) {
+
+ try {
+
+ layoutTestController.dumpAsText();
+ document.execCommand("SelectAll");
+
+ log(appleScriptController.doJavaScript("2*2;"));
+ log(appleScriptController.doJavaScript("new Number(2*2);"));
+ log(appleScriptController.doJavaScript("2/3;"));
+ log(appleScriptController.doJavaScript("new Number(2/3);"));
+ log(appleScriptController.doJavaScript("2/0;"));
+ log(appleScriptController.doJavaScript("new Number(-2/0);"));
+ log(appleScriptController.doJavaScript("1!=1"));
+ log(appleScriptController.doJavaScript("new Boolean"));
+ log(appleScriptController.doJavaScript("'a string'"));
+ log(appleScriptController.doJavaScript("new String('a string')"));
+ log(appleScriptController.doJavaScript("window.getSelection()"));
+ log(appleScriptController.doJavaScript("window.getSelection() + \"\""));
+ log(appleScriptController.doJavaScript("document"));
+ log(appleScriptController.doJavaScript("document.title"));
+ log(appleScriptController.doJavaScript("document.lalala"));
+ log(appleScriptController.doJavaScript("document.lalala()")); // ideally, should pass the error to AppleScript
+ log(appleScriptController.doJavaScript("function Polygon() {this.edges = 8;} new Polygon;"));
+
+ } catch (ex) {
+ log("Exception: " + ex.description);
+ }
+
+ var console = document.createElement("p");
+ console.appendChild(console_messages);
+ document.body.appendChild(console);
+
+ } else {
+ document.write("(cannot run interactively)");
+ }
+</script>
+</body>
+</html>
--- /dev/null
+(1, 2, "three") ('list')
+('msng', 'msng', 2) ('list')
+(0, "0,") ('list')
--- /dev/null
+<html>
+<head>
+<title>do JavaScript - converting JavaScript arrays to AppleScript</title>
+</head>
+<body>
+<script type="text/javascript">
+
+ var console_messages = document.createElement("ol");
+
+ function log(message)
+ {
+ var item = document.createElement("li");
+ item.appendChild(document.createTextNode(message));
+ console_messages.appendChild(item);
+ }
+ if (window.layoutTestController) {
+
+ try {
+
+ layoutTestController.dumpAsText();
+
+ log(appleScriptController.doJavaScript("new Array(1, 2, 'three');"));
+ log(appleScriptController.doJavaScript("arr = new Array; arr['a'] = 'a'; arr[2] = 2; arr;"));
+ log(appleScriptController.doJavaScript("arr = new Array; arr[0] = 0; arr[1] = arr; arr;"));
+
+// This takes ~10 seconds on my G4/1.25
+// log(appleScriptController.doJavaScript("arr = new Array; arr[1] = 1; arr[10001] = 10001; arr;"));
+
+ } catch (ex) {
+ log("Exception: " + ex.description);
+ }
+
+ var console = document.createElement("p");
+ console.appendChild(console_messages);
+ document.body.appendChild(console);
+
+ } else {
+ document.write("(cannot run interactively)");
+ }
+</script>
+</body>
+</html>
--- /dev/null
+00000000C00D6BE5 ('ldt ')
+000000007C4E8F00 ('ldt ')
+000000007C25DAB0 ('ldt ')
+00000001383EC400 ('ldt ')
+0000000056871300 ('ldt ')
+0000000000000000 ('ldt ')
+FFFFFFFF3C637000 ('ldt ')
+"Invalid Date" ('utxt')
--- /dev/null
+<html>
+<head>
+<title>do JavaScript - converting to AppleScript date type</title>
+</head>
+<body>
+<script type="text/javascript">
+
+ var console_messages = document.createElement("ol");
+
+ function log(message)
+ {
+ var item = document.createElement("li");
+ item.appendChild(document.createTextNode(message));
+ console_messages.appendChild(item);
+ }
+ if (window.layoutTestController) {
+
+ try {
+
+ layoutTestController.dumpAsText();
+
+ // 0xc00d6be5 == Mon Feb 06 2006 21:11:01
+ log(appleScriptController.doJavaScript("new Date(2006,1,6,21,11,1)"));
+
+ // 0x7c4e8f00 == Sun Feb 01 1970 00:00:00
+ log(appleScriptController.doJavaScript("new Date(1970,1,1)"));
+
+ // 0x7c25dab0 == Thu Jan 01 1970 03:00:00
+ log(appleScriptController.doJavaScript("new Date(1970,0,1,3)"));
+
+ // 0x1383ec400 == Wed Jan 01 2070 00:00:00
+ log(appleScriptController.doJavaScript("new Date(2070,0,1)"));
+
+ // 0x56871300 == Sun Jan 01 1950 00:00:00
+ log(appleScriptController.doJavaScript("new Date(1950,0,1)"));
+
+ // 0x00000000 == Fri Jan 01 1904 00:00:00
+ log(appleScriptController.doJavaScript("new Date(1904,0,1)"));
+
+ // 0xffffffff3c637000 == Wed Jan 01 1800 00:00:00
+ log(appleScriptController.doJavaScript("new Date(1800,0,1)"));
+
+ // invalid date
+ log(appleScriptController.doJavaScript("new Date(1e40)"));
+
+ } catch (ex) {
+ log("Exception: " + ex.description);
+ }
+
+ var console = document.createElement("p");
+ console.appendChild(console_messages);
+ document.body.appendChild(console);
+
+ } else {
+ document.write("(cannot run interactively)");
+ }
+</script>
+</body>
+</html>
--- /dev/null
+PASS Test LongLong: result is 0 as expected!
+PASS Test LongLong: result is 1 as expected!
+PASS Test LongLong: result is -1 as expected!
+PASS Test LongLong: result is -9223372036854776000 as expected!
+PASS Test LongLong: result is -9223372036854776000 as expected!
+PASS Test UnsignedLongLong: result is 0 as expected!
+PASS Test UnsignedLongLong: result is 1 as expected!
+PASS Test UnsignedLongLong: result is 18446744073709552000 as expected!
+PASS Test UnsignedLongLong: result is 9223372036854776000 as expected!
+PASS Test UnsignedLongLong: result is 9223372036854776000 as expected!
+
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <script type="text/javascript" charset="utf-8">
+ function log(msg)
+ {
+ document.getElementById('console').innerHTML += msg + "\n"
+ }
+
+ function testLongLong(num, expected)
+ {
+ var result = layoutTestController.objCLongLongRoundTrip(num);
+ if (result == expected)
+ log("PASS Test LongLong: result is " + result + " as expected!");
+ else
+ log("FAIL Test LongLong: result is " + result + ", should be " + expected);
+ }
+
+ function testUnsignedLongLong(num, expected)
+ {
+ var result = layoutTestController.objCUnsignedLongLongRoundTrip(num);
+ if (result == expected)
+ log("PASS Test UnsignedLongLong: result is " + result + " as expected!");
+ else
+ log("FAIL Test UnsignedLongLong: result is " + result + ", should be " + expected);
+ }
+
+ function test()
+ {
+ if (!window.layoutTestController) {
+ log("This test can only be run under DumpRenderTree.");
+ return;
+ }
+
+ layoutTestController.dumpAsText();
+
+ testLongLong(0, 0);
+ testLongLong(1, 1);
+ testLongLong(-1, -1);
+ testLongLong(9223372036854776001, -9223372036854776000);
+ testLongLong(-9223372036854776001, -9223372036854776000);
+
+ testUnsignedLongLong(0, 0);
+ testUnsignedLongLong(1, 1);
+ testUnsignedLongLong(-1, 18446744073709552000);
+ testUnsignedLongLong(9223372036854776001, 9223372036854776000);
+ testUnsignedLongLong(-9223372036854776001, 9223372036854776000);
+
+ }
+ </script>
+ </head>
+ <body onload="test();">
+ <pre id="console"></pre>
+ </body>
+</html>