winmm/tests: Use cpp's __LINE__ to print meaningful line numbers.
authorJörg Höhle <hoehle@users.sourceforge.net>
Mon, 29 Mar 2010 08:15:16 +0000 (10:15 +0200)
committerAlexandre Julliard <julliard@winehq.org>
Tue, 30 Mar 2010 12:57:51 +0000 (14:57 +0200)
dlls/winmm/tests/mci.c
dlls/winmm/tests/midi.c

index bbc21ddda904f210c8a3f4921a1c04a78afedee8..0e7ce9d82b274fdaac0a121d8f801782d730b9bf 100644 (file)
@@ -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)
index e531d04e0a29d9e94fe825adbad472cc57b20d9a..3abdb1de91ea8f9cbb3388d61ae90a4298523551 100644 (file)
@@ -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);
     }
 }