Jacek Caban : mshtml: Added function overriding tests.

Alexandre Julliard julliard at winehq.org
Mon Sep 24 16:04:27 CDT 2012


Module: wine
Branch: master
Commit: 4d469b55a5850a9aad05003f6770338754924150
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4d469b55a5850a9aad05003f6770338754924150

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Sep 24 14:10:19 2012 +0200

mshtml: Added function overriding tests.

---

 dlls/mshtml/tests/jstest.html |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/dlls/mshtml/tests/jstest.html b/dlls/mshtml/tests/jstest.html
index d9d6da5..224e19a 100644
--- a/dlls/mshtml/tests/jstest.html
+++ b/dlls/mshtml/tests/jstest.html
@@ -103,15 +103,34 @@ function test_getter_call() {
 
     var e = document.getElementById("divid");
 
-    e.myfunc = function(x) { this.myfinc_called = x; };
+    e.myfunc = function(x) { this.myfunc_called = x; };
     e.myfunc("test");
-    ok(e.myfinc_called === "test", "e.myfinc_called = " + e.myfinc_called);
+    ok(e.myfunc_called === "test", "e.myfunc_called = " + e.myfunc_called);
 
     e.onmousedown = function(x) { this.onmousedown_called = x; };
     e.onmousedown("test");
     ok(e.onmousedown_called === "test", "e.onmousedown_called = " + e.onmousedown_called);
 }
 
+function test_override_functions() {
+    function override_func() { return "test"; }
+
+    ok(typeof(window.showModalDialog) === "object", "typeof(window.showModalDialog) = " + typeof(window.showModalDialog));
+    window.showModalDialog = override_func;
+    ok(window.showModalDialog === override_func, "window.showModalDialog != override_func");
+    ok(typeof(window.showModalDialog) === "function", "typeof(window.showModalDialog) = " + typeof(window.showModalDialog));
+
+    document.body.innerHTML = '<div id="divid"></div>';
+    var div = document.getElementById("divid");
+    ok(typeof(div.addBehavior) === "object", "typeof(div.addBehavior) = " + typeof(div.addBehavior));
+    div.addBehavior = override_func;
+    ok(div.addBehavior === override_func, "div.addBehavior != override_func");
+    ok(typeof(div.addBehavior) === "function", "typeof(div.addBehavior) = " + typeof(div.addBehavior));
+
+    var tmp = div.addBehavior();
+    ok(tmp === "test", "div.addBehavior() = " + tmp);
+}
+
 var globalVar = false;
 
 function runTest() {
@@ -128,6 +147,7 @@ function runTest() {
     test_document_name_as_index();
     test_remove_style_attribute();
     test_getter_call();
+    test_override_functions();
 
     var r = window.execScript("globalVar = true;");
     ok(r === undefined, "execScript returned " + r);




More information about the wine-cvs mailing list