Commit 74ad854e authored by Jörg Höhle's avatar Jörg Höhle Committed by Alexandre Julliard

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

parent 72be7fe3
...@@ -136,7 +136,8 @@ static BOOL spurious_message(LPMSG msg) ...@@ -136,7 +136,8 @@ static BOOL spurious_message(LPMSG msg)
} }
/* A single ok() in each code path allows to prefix this with todo_wine */ /* 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 */ { /* Use type 0 as meaning no message */
MSG msg; MSG msg;
BOOL seen; BOOL seen;
...@@ -145,17 +146,17 @@ static void test_notification(HWND hwnd, const char* command, WPARAM type) ...@@ -145,17 +146,17 @@ static void test_notification(HWND hwnd, const char* command, WPARAM type)
if(type && !seen) { if(type && !seen) {
/* We observe transient delayed notification, mostly on native. /* We observe transient delayed notification, mostly on native.
* Notification is not always present right when mciSend returns. */ * 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); MsgWaitForMultipleObjects(0, NULL, FALSE, 3000, QS_POSTMESSAGE);
seen = PeekMessageA(&msg, hwnd, MM_MCINOTIFY, MM_MCINOTIFY, PM_REMOVE); seen = PeekMessageA(&msg, hwnd, MM_MCINOTIFY, MM_MCINOTIFY, PM_REMOVE);
} }
if(!seen) 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) 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) else if(msg.message != MM_MCINOTIFY)
ok(msg.message == MM_MCINOTIFY, "got %04x instead of MM_MCINOTIFY from command %s\n", msg.message, command); ok_(__FILE__,line)(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); 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) static void test_openCloseWAVE(HWND hwnd)
......
...@@ -61,7 +61,8 @@ static void CALLBACK callback_func(HWAVEOUT hwo, UINT uMsg, ...@@ -61,7 +61,8 @@ static void CALLBACK callback_func(HWAVEOUT hwo, UINT uMsg,
cbinst = dwInstance; /* MYCBINST, see midiOut/StreamOpen */ 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 */ { /* Use message type 0 as meaning no message */
MSG msg; MSG msg;
if (hwnd) { if (hwnd) {
...@@ -74,29 +75,29 @@ static void test_notification(HWND hwnd, const char* command, UINT m1, DWORD_PTR ...@@ -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 * Perhaps the OS preempts the player thread after setting MHDR_DONE
* or clearing MHDR_INQUEUE, before calling DriverCallback. */ * or clearing MHDR_INQUEUE, before calling DriverCallback. */
DWORD rc; 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); SetLastError(0xDEADBEEF);
rc = MsgWaitForMultipleObjects(0, NULL, FALSE, 3000, QS_POSTMESSAGE); 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); seen = PeekMessageA(&msg, hwnd, 0, 0, PM_REMOVE);
} }
if (seen) { 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); msg.message, msg.wParam, msg.lParam, command);
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");
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.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 { else {
/* FIXME: MOM_POSITIONCB and MOM_DONE are so close that a queue is needed. */ /* FIXME: MOM_POSITIONCB and MOM_DONE are so close that a queue is needed. */
if (cbmsg) { 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 */ cbmsg = 0; /* Mark as read */
cbval1 = cbval2 = WHATEVER; 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);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment