mshtml/tests: Fix events test when pointer is on a corner.

Nicolas Le Cam niko.lecam at gmail.com
Mon Nov 2 16:49:23 CST 2009


2009/10/30 Jacek Caban <jacek at codeweavers.com>:
> Hi Nicolas,
>
> Nicolas Le Cam wrote:
>>
>> Hi Jacek,
>>
>> Thanks for feedback.
>> It should handle pointer in every corners IMHO, the left corner can
>> cause failures in winetest.
>>
>> I'll try to find a better solution. Do you have any hints ?
>>
>
> The test in line 472 is invalid. It looks like all we can do is check if
> get_x returned something. I'd suggest to set l to 0xdeadbeef before get_x
> call and test that the value has changed (ok(x != 0xdeadbeef, ...)). That's
> all we can do. The same applies to get_client[XY] and get_offset[XY] tests.
>
>
> Thanks,git br
>   Jacek
>
>
Hi Jacek,

I did what you've suggested (patch's attached for reference) but I
don't think it's the right solution.
Test passes on Wine and Windows with such a patch, but we're now
ignoring the fact that values are completely different on Wine (only
-1 and 0) and Windows (cursor's position relative to something).

I'm trying to find a way to compare values against results from
GetCursorPos and friends. What do you think about that, could that be
a solution ?

Thanks,
Nicolas Le Cam
-------------- next part --------------
From f8a5e03e8ac228e0ad22af07d4bb3e5a9853a9a5 Mon Sep 17 00:00:00 2001
From: Nicolas Le Cam <niko.lecam at gmail.com>
Date: Sat, 31 Oct 2009 14:31:41 +0100
Subject: mshtml/tests: Fix events test when pointer is on a corner.

---
 dlls/mshtml/tests/events.c |   40 ++++++++++++++++------------------------
 1 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/dlls/mshtml/tests/events.c b/dlls/mshtml/tests/events.c
index 9d23775..d781e00 100644
--- a/dlls/mshtml/tests/events.c
+++ b/dlls/mshtml/tests/events.c
@@ -65,7 +65,6 @@ DEFINE_EXPECT(timeout);
 static HWND container_hwnd = NULL;
 static IHTMLWindow2 *window;
 static IOleDocumentView *view;
-static BOOL xy_todo;
 
 typedef struct {
     LONG x;
@@ -466,10 +465,11 @@ static void _test_event_x(unsigned line, IHTMLEventObj *event, LONG exl)
     LONG l;
     HRESULT hres;
 
+    l = 0xdeadbeef;
     hres = IHTMLEventObj_get_x(event, &l);
     ok_(__FILE__,line)(hres == S_OK, "get_x failed: %08x\n", hres);
     if(exl == -10) /* don't test the exact value */
-        todo_wine ok_(__FILE__,line)(l > 0, "x = %d\n", l);
+        ok_(__FILE__,line)(l != 0xdeadbeef, "x = %d\n", l);
     else
         ok_(__FILE__,line)(l == exl, "x = %d, expected %d\n", l, exl);
 }
@@ -479,10 +479,11 @@ static void _test_event_y(unsigned line, IHTMLEventObj *event, LONG exl)
     LONG l;
     HRESULT hres;
 
+    l = 0xdeadbeef;
     hres = IHTMLEventObj_get_y(event, &l);
     ok_(__FILE__,line)(hres == S_OK, "get_y failed: %08x\n", hres);
     if(exl == -10) /* don't test the exact value */
-        todo_wine ok_(__FILE__,line)(l > 0, "y = %d\n", l);
+        ok_(__FILE__,line)(l != 0xdeadbeef, "y = %d\n", l);
     else
         ok_(__FILE__,line)(l == exl, "y = %d, expected %d\n", l, exl);
 }
@@ -492,13 +493,11 @@ static void _test_event_clientx(unsigned line, IHTMLEventObj *event, LONG exl)
     LONG l;
     HRESULT hres;
 
+    l = 0xdeadbeef;
     hres = IHTMLEventObj_get_clientX(event, &l);
     ok_(__FILE__,line)(hres == S_OK, "get_clientX failed: %08x\n", hres);
     if(exl == -10)  {/* don't test the exact value */
-        if(xy_todo)
-            todo_wine ok_(__FILE__,line)(l > 0, "clientX = %d\n", l);
-        else
-            ok_(__FILE__,line)(l > 0, "clientX = %d\n", l);
+        ok_(__FILE__,line)(l != 0xdeadbeef, "clientX = %d\n", l);
     }else {
         ok_(__FILE__,line)(l == exl, "clientX = %d, expected %d\n", l, exl);
     }
@@ -509,13 +508,11 @@ static void _test_event_clienty(unsigned line, IHTMLEventObj *event, LONG exl)
     LONG l;
     HRESULT hres;
 
+    l = 0xdeadbeef;
     hres = IHTMLEventObj_get_clientY(event, &l);
     ok_(__FILE__,line)(hres == S_OK, "get_clientY failed: %08x\n", hres);
     if(exl == -10)  {/* don't test the exact value */
-        if(xy_todo)
-            todo_wine ok_(__FILE__,line)(l > 0, "clientY = %d\n", l);
-        else
-            ok_(__FILE__,line)(l > 0, "clientY = %d\n", l);
+        ok_(__FILE__,line)(l != 0xdeadbeef, "clientY = %d\n", l);
     }else {
         ok_(__FILE__,line)(l == exl, "clientY = %d, expected %d\n", l, exl);
     }
@@ -526,10 +523,11 @@ static void _test_event_offsetx(unsigned line, IHTMLEventObj *event, LONG exl)
     LONG l;
     HRESULT hres;
 
+    l = 0xdeadbeef;
     hres = IHTMLEventObj_get_offsetX(event, &l);
     ok_(__FILE__,line)(hres == S_OK, "get_offsetX failed: %08x\n", hres);
     if(exl == -10) /* don't test the exact value */
-        todo_wine ok_(__FILE__,line)(l > 0, "offsetX = %d\n", l);
+        ok_(__FILE__,line)(l != 0xdeadbeef, "offsetX = %d\n", l);
     else
         ok_(__FILE__,line)(l == exl, "offsetX = %d, expected %d\n", l, exl);
 }
@@ -539,10 +537,11 @@ static void _test_event_offsety(unsigned line, IHTMLEventObj *event, LONG exl)
     LONG l;
     HRESULT hres;
 
+    l = 0xdeadbeef;
     hres = IHTMLEventObj_get_offsetY(event, &l);
     ok_(__FILE__,line)(hres == S_OK, "get_offsetY failed: %08x\n", hres);
     if(exl == -10) /* don't test the exact value */
-        todo_wine ok_(__FILE__,line)(l > 0, "offsetY = %d\n", l);
+        ok_(__FILE__,line)(l != 0xdeadbeef, "offsetY = %d\n", l);
     else
         ok_(__FILE__,line)(l == exl, "offsetY = %d, expected %d\n", l, exl);
 }
@@ -552,13 +551,11 @@ static void _test_event_screenx(unsigned line, IHTMLEventObj *event, LONG exl)
     LONG l;
     HRESULT hres;
 
+    l = 0xdeadbeef;
     hres = IHTMLEventObj_get_screenX(event, &l);
     ok_(__FILE__,line)(hres == S_OK, "get_screenX failed: %08x\n", hres);
     if(exl == -10) { /* don't test the exact value */
-        if(xy_todo)
-            todo_wine ok_(__FILE__,line)(l > 0, "screenX = %d\n", l);
-        else
-            ok_(__FILE__,line)(l > 0, "screenX = %d\n", l);
+        ok_(__FILE__,line)(l != 0xdeadbeef, "screenX = %d\n", l);
     }else {
         ok_(__FILE__,line)(l == exl, "screenX = %d, expected %d\n", l, exl);
     }
@@ -569,13 +566,11 @@ static void _test_event_screeny(unsigned line, IHTMLEventObj *event, LONG exl)
     LONG l;
     HRESULT hres;
 
+    l = 0xdeadbeef;
     hres = IHTMLEventObj_get_screenY(event, &l);
     ok_(__FILE__,line)(hres == S_OK, "get_screenY failed: %08x\n", hres);
     if(exl == -10) { /* don't test the exact value */
-        if(xy_todo)
-            todo_wine ok_(__FILE__,line)(l > 0, "screenY = %d\n", l);
-        else
-            ok_(__FILE__,line)(l > 0, "screenY = %d\n", l);
+        ok_(__FILE__,line)(l != 0xdeadbeef, "screenY = %d\n", l);
     }else {
         ok_(__FILE__,line)(l == exl, "screenY = %d, expected %d\n", l, exl);
     }
@@ -963,8 +958,6 @@ static void test_onclick(IHTMLDocument2 *doc)
         CHECK_CALLED(document_onclick);
     }
 
-    xy_todo = TRUE;
-
     SET_EXPECT(div_onclick);
     SET_EXPECT(div_onclick_attached);
     SET_EXPECT(body_onclick);
@@ -1555,7 +1548,6 @@ static void run_test(const char *str, testfunc_t test)
     MSG msg;
     HRESULT hres;
 
-    xy_todo = FALSE;
     doc = create_document();
     set_client_site(doc, TRUE);
     doc_load_string(doc, str);
-- 
1.6.3.3


More information about the wine-devel mailing list