Jörg Höhle : winmm/tests: Use cpp' s __LINE__ to print meaningful line numbers.

Alexandre Julliard julliard at winehq.org
Tue Mar 30 10:39:46 CDT 2010


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

Author: Jörg Höhle <hoehle at users.sourceforge.net>
Date:   Mon Mar 29 10:15:16 2010 +0200

winmm/tests: Use cpp's __LINE__ to print meaningful line numbers.

---

 dlls/winmm/tests/mci.c  |   13 +++++++------
 dlls/winmm/tests/midi.c |   21 +++++++++++----------
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/dlls/winmm/tests/mci.c b/dlls/winmm/tests/mci.c
index bbc21dd..0e7ce9d 100644
--- a/dlls/winmm/tests/mci.c
+++ b/dlls/winmm/tests/mci.c
@@ -136,7 +136,8 @@ static BOOL spurious_message(LPMSG msg)
 }
 
 /* A single ok() in each code path allows to prefix this with todo_wine */
-static void test_notification(HWND hwnd, const char* command, WPARAM type)
+#define test_notification(hwnd, command, type) test_notification_dbg(hwnd, command, type, __LINE__)
+static void test_notification_dbg(HWND hwnd, const char* command, WPARAM type, int line)
 {   /* Use type 0 as meaning no message */
     MSG msg;
     BOOL seen;
@@ -145,17 +146,17 @@ static void test_notification(HWND hwnd, const char* command, WPARAM type)
     if(type && !seen) {
       /* We observe transient delayed notification, mostly on native.
        * Notification is not always present right when mciSend returns. */
-      trace("Waiting for delayed notification from %s\n", command);
+      trace_(__FILE__,line)("Waiting for delayed notification from %s\n", command);
       MsgWaitForMultipleObjects(0, NULL, FALSE, 3000, QS_POSTMESSAGE);
       seen = PeekMessageA(&msg, hwnd, MM_MCINOTIFY, MM_MCINOTIFY, PM_REMOVE);
     }
     if(!seen)
-        ok(type==0, "Expect message %04lx from %s\n", type, command);
+      ok_(__FILE__,line)(type==0, "Expect message %04lx from %s\n", type, command);
     else if(msg.hwnd != hwnd)
-        ok(msg.hwnd == hwnd, "Didn't get the handle to our test window\n");
+        ok_(__FILE__,line)(msg.hwnd == hwnd, "Didn't get the handle to our test window\n");
     else if(msg.message != MM_MCINOTIFY)
-        ok(msg.message == MM_MCINOTIFY, "got %04x instead of MM_MCINOTIFY from command %s\n", msg.message, command);
-    else ok(msg.wParam == type, "got %04lx instead of MCI_NOTIFY_xyz %04lx from command %s\n", msg.wParam, type, command);
+        ok_(__FILE__,line)(msg.message == MM_MCINOTIFY, "got %04x instead of MM_MCINOTIFY from command %s\n", msg.message, command);
+    else ok_(__FILE__,line)(msg.wParam == type, "got %04lx instead of MCI_NOTIFY_xyz %04lx from command %s\n", msg.wParam, type, command);
 }
 
 static void test_openCloseWAVE(HWND hwnd)
diff --git a/dlls/winmm/tests/midi.c b/dlls/winmm/tests/midi.c
index e531d04..3abdb1d 100644
--- a/dlls/winmm/tests/midi.c
+++ b/dlls/winmm/tests/midi.c
@@ -61,7 +61,8 @@ static void CALLBACK callback_func(HWAVEOUT hwo, UINT uMsg,
     cbinst = dwInstance; /* MYCBINST, see midiOut/StreamOpen */
 }
 
-static void test_notification(HWND hwnd, const char* command, UINT m1, DWORD_PTR p2)
+#define test_notification(hwnd, command, m1, p2) test_notification_dbg(hwnd, command, m1, p2, __LINE__)
+static void test_notification_dbg(HWND hwnd, const char* command, UINT m1, DWORD_PTR p2, int line)
 {   /* Use message type 0 as meaning no message */
     MSG msg;
     if (hwnd) {
@@ -74,29 +75,29 @@ static void test_notification(HWND hwnd, const char* command, UINT m1, DWORD_PTR
            * Perhaps the OS preempts the player thread after setting MHDR_DONE
            * or clearing MHDR_INQUEUE, before calling DriverCallback. */
           DWORD rc;
-          trace("Waiting for delayed message %x from %s\n", m1, command);
+          trace_(__FILE__,line)("Waiting for delayed message %x from %s\n", m1, command);
           SetLastError(0xDEADBEEF);
           rc = MsgWaitForMultipleObjects(0, NULL, FALSE, 3000, QS_POSTMESSAGE);
-          ok(rc==WAIT_OBJECT_0, "Wait failed: %04x %d\n", rc, GetLastError());
+          ok_(__FILE__,line)(rc==WAIT_OBJECT_0, "Wait failed: %04x %d\n", rc, GetLastError());
           seen = PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE);
         }
         if (seen) {
-            trace("Message %x, wParam=%lx, lParam=%lx from %s\n",
+            trace_(__FILE__,line)("Message %x, wParam=%lx, lParam=%lx from %s\n",
                   msg.message, msg.wParam, msg.lParam, command);
-            ok(msg.hwnd==hwnd, "Didn't get the handle to our test window\n");
-            ok(msg.message==m1 && msg.lParam==p2, "bad message %x/%lx from %s, expect %x/%lx\n", msg.message, msg.lParam, command, m1, p2);
+            ok_(__FILE__,line)(msg.hwnd==hwnd, "Didn't get the handle to our test window\n");
+            ok_(__FILE__,line)(msg.message==m1 && msg.lParam==p2, "bad message %x/%lx from %s, expect %x/%lx\n", msg.message, msg.lParam, command, m1, p2);
         }
-        else ok(m1==0, "Expect message %x from %s\n", m1, command);
+        else ok_(__FILE__,line)(m1==0, "Expect message %x from %s\n", m1, command);
     }
     else {
         /* FIXME: MOM_POSITIONCB and MOM_DONE are so close that a queue is needed. */
         if (cbmsg) {
-            ok(cbmsg==m1 && cbval1==p2 && cbval2==0, "bad callback %x/%lx/%lx from %s, expect %x/%lx\n", cbmsg, cbval1, cbval2, command, m1, p2);
+            ok_(__FILE__,line)(cbmsg==m1 && cbval1==p2 && cbval2==0, "bad callback %x/%lx/%lx from %s, expect %x/%lx\n", cbmsg, cbval1, cbval2, command, m1, p2);
             cbmsg = 0; /* Mark as read */
             cbval1 = cbval2 = WHATEVER;
-            ok(cbinst==MYCBINST, "callback dwInstance changed to %lx\n", cbinst);
+            ok_(__FILE__,line)(cbinst==MYCBINST, "callback dwInstance changed to %lx\n", cbinst);
         }
-        else ok(m1==0, "Expect callback %x from %s\n", m1, command);
+        else ok_(__FILE__,line)(m1==0, "Expect callback %x from %s\n", m1, command);
     }
 }
 




More information about the wine-cvs mailing list