Vincent Povirk : user32/tests: Don' t check menu items when testing MNS_CHECKORBMP.

Alexandre Julliard julliard at winehq.org
Thu Sep 4 08:27:10 CDT 2008


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Wed Sep  3 16:08:22 2008 -0500

user32/tests: Don't check menu items when testing MNS_CHECKORBMP.

If the MNS_CHECKORBMP style is set on a menu, and the menu is checked,
the bitmap is not drawn. For the menu tests, that means we get no
WM_DRAWITEM message for an owner-drawn bitmap, and the bounding box of
the bitmap is not tested. We should leave the menu item unchecked in
this case so we can test it.

---

 dlls/user32/tests/menu.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/tests/menu.c b/dlls/user32/tests/menu.c
index 4e879c6..74cb2a0 100644
--- a/dlls/user32/tests/menu.c
+++ b/dlls/user32/tests/menu.c
@@ -357,7 +357,8 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt,
     MOD_GotDrawItemMsg = FALSE;
     mii.fMask = MIIM_FTYPE | MIIM_DATA | MIIM_STATE;
     mii.fType = 0;
-    mii.fState = MF_CHECKED;
+    /* check the menu item unless MNS_CHECKORBMP is set */
+    mii.fState = (mnuopt != 2 ? MFS_CHECKED : MFS_UNCHECKED);
     mii.dwItemData =0;
     MODsizes[0] = bmpsize;
     hastab = 0;
@@ -447,10 +448,20 @@ static void test_mbs_help( int ispop, int hassub, int mnuopt,
     if( hbmp == HBMMENU_CALLBACK && MOD_GotDrawItemMsg) {
         /* check the position of the bitmap */
         /* horizontal */
-        expect = ispop ? (4 + ( mnuopt  ? 0 : GetSystemMetrics(SM_CXMENUCHECK)))
-            : 3;
-        ok( expect == MOD_rc[0].left,
-                "bitmap left is %d expected %d\n", MOD_rc[0].left, expect);
+        if (!ispop)
+            expect = 3;
+        else if (mnuopt == 0)
+            expect = 4 + GetSystemMetrics(SM_CXMENUCHECK);
+        else if (mnuopt == 1)
+            expect = 4;
+        else /* mnuopt == 2 */
+            expect = 2;
+        if (ispop && mnuopt == 2)
+            todo_wine ok( expect == MOD_rc[0].left,
+                    "bitmap left is %d expected %d\n", MOD_rc[0].left, expect);
+        else
+            ok( expect == MOD_rc[0].left,
+                    "bitmap left is %d expected %d\n", MOD_rc[0].left, expect);
         failed = failed || !(expect == MOD_rc[0].left);
         /* vertical */
         expect = (rc.bottom - rc.top - MOD_rc[0].bottom + MOD_rc[0].top) / 2;




More information about the wine-cvs mailing list