LayoutTests:
authorddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 25 Jun 2006 01:53:50 +0000 (01:53 +0000)
committerddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 25 Jun 2006 01:53:50 +0000 (01:53 +0000)
        Reviewed by Darin.  Patch by James G. Speth.

        - Tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=8843
          add a way to build Objective-C test cases in HTML

        * plugins/jsobjc-dom-wrappers-expected.txt: Added.
        * plugins/jsobjc-dom-wrappers.html: Added.
        * plugins/jsobjc-simple-expected.txt: Added.
        * plugins/jsobjc-simple.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15022 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/plugins/jsobjc-dom-wrappers-expected.txt [new file with mode: 0644]
LayoutTests/plugins/jsobjc-dom-wrappers.html [new file with mode: 0644]
LayoutTests/plugins/jsobjc-simple-expected.txt [new file with mode: 0644]
LayoutTests/plugins/jsobjc-simple.html [new file with mode: 0644]

index b9375f7a2443ad91a7236d8437761534b990d1ef..f622d821f18b3a54e46fa01dbe8ee52d076ea6d4 100644 (file)
@@ -1,3 +1,15 @@
+2006-06-24  James G. Speth  <speth@end.com>
+
+        Reviewed by Darin.
+
+        - Tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=8843
+          add a way to build Objective-C test cases in HTML
+
+        * plugins/jsobjc-dom-wrappers-expected.txt: Added.
+        * plugins/jsobjc-dom-wrappers.html: Added.
+        * plugins/jsobjc-simple-expected.txt: Added.
+        * plugins/jsobjc-simple.html: Added.
+
 2006-06-24  Rob Buis  <buis@kde.org>
 
         Reviewed by Darin.
diff --git a/LayoutTests/plugins/jsobjc-dom-wrappers-expected.txt b/LayoutTests/plugins/jsobjc-dom-wrappers-expected.txt
new file mode 100644 (file)
index 0000000..9976cf6
--- /dev/null
@@ -0,0 +1,19 @@
+document.childNodes == DOMNodeList ? -> PASS
+
+document.body.attributes == DOMNamedNodeMap ? -> PASS
+
+document.styleSheets == DOMStyleSheetList ? -> PASS
+
+document.styleSheets[0] == DOMCSSStyleSheet ? -> PASS
+
+document.styleSheets[0].media == DOMMediaList ? -> PASS
+
+document.styleSheets[0].cssRules == DOMCSSRuleList ? -> PASS
+
+document.styleSheets[0].cssRules[0] == DOMCSSStyleRule ? -> PASS
+
+document.styleSheets[0].cssRules[0].style == DOMCSSStyleDeclaration ? -> PASS
+
+document.styleSheets[0].cssRules[0].style.getPropertyCSSValue("font") == DOMCSSValue ? -> PASS
+
+document.styleSheets[0].cssRules[0].style.getPropertyCSSValue("width") == DOMCSSPrimitiveValue ? -> PASS
diff --git a/LayoutTests/plugins/jsobjc-dom-wrappers.html b/LayoutTests/plugins/jsobjc-dom-wrappers.html
new file mode 100644 (file)
index 0000000..f7f3e12
--- /dev/null
@@ -0,0 +1,45 @@
+<html>
+<head><title> wrappers.html </title>
+<style>
+    BODY { font: 11px 'Lucida Grande'; width: 90%; padding: 10px; }
+    .box { border: 1px solid gray; background-color: #EEE; margin: 10px; }
+</style>
+<script>
+function print(message) {
+    var paragraph = document.createElement('p');
+    paragraph.appendChild(document.createTextNode(message));
+    document.getElementById('console').appendChild(paragraph);
+}
+function check(exp, value) {
+    var obj = eval(exp);
+    var name = objc.classNameOfObject_(obj);
+    var result = (name == value) ? 'PASS' : 'FAIL';
+    print('' + exp + ' == ' + value + ' ? -> ' + result);
+}
+function test() {
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+    if (!window.objCPlugin)
+        return print('FAIL - no objCPlugin');
+    objCPlugin.removeBridgeRestrictions_(window);
+    if (!window.objc)
+        return print('FAIL - no window.objc');
+    
+    check('document.childNodes', 'DOMNodeList');
+    check('document.body.attributes', 'DOMNamedNodeMap');
+    check('document.styleSheets', 'DOMStyleSheetList');
+    check('document.styleSheets[0]', 'DOMCSSStyleSheet');
+    check('document.styleSheets[0].media', 'DOMMediaList');
+    check('document.styleSheets[0].cssRules', 'DOMCSSRuleList');
+    check('document.styleSheets[0].cssRules[0]', 'DOMCSSStyleRule');
+    check('document.styleSheets[0].cssRules[0].style', 'DOMCSSStyleDeclaration');
+    check('document.styleSheets[0].cssRules[0].style.getPropertyCSSValue("font")', 'DOMCSSValue');
+    check('document.styleSheets[0].cssRules[0].style.getPropertyCSSValue("width")', 'DOMCSSPrimitiveValue');
+    
+}
+</script>
+</head>
+<body onload="test();">
+<div id='console'/>
+</body>
+</html>
diff --git a/LayoutTests/plugins/jsobjc-simple-expected.txt b/LayoutTests/plugins/jsobjc-simple-expected.txt
new file mode 100644 (file)
index 0000000..43ca140
--- /dev/null
@@ -0,0 +1,7 @@
+got class: NSCell
+
+created object: <NSCell>
+
+set string value: zoe
+
+PASS
diff --git a/LayoutTests/plugins/jsobjc-simple.html b/LayoutTests/plugins/jsobjc-simple.html
new file mode 100644 (file)
index 0000000..087c0fb
--- /dev/null
@@ -0,0 +1,36 @@
+<html>
+<head><title> simple.html </title>
+<script>
+function print(message) {
+    var paragraph = document.createElement('p');
+    paragraph.appendChild(document.createTextNode(message));
+    document.getElementById('console').appendChild(paragraph);
+}
+
+function test() {
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+    if (!window.objCPlugin)
+        return print('FAIL - no objCPlugin');
+    objCPlugin.removeBridgeRestrictions_(window);
+    if (!window.objc)
+        return print('FAIL - no window.objc');
+    
+    // test creating an obj-c object
+    var NSCell = objc('NSCell');
+    print('got class: ' + NSCell);
+    var cell = NSCell.alloc().init();
+    print('created object: <' + cell.className() + '>');
+    cell.setValue_forKey_('zoe', 'stringValue');
+    print('set string value: ' + cell.stringValue());
+    if (cell.stringValue() == 'zoe')
+        print('PASS');
+    else
+        print('FAIL');
+}
+</script>
+</head>
+<body onload="test();">
+<div id='console'/>
+</body>
+</html>