mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 06:56:14 +01:00
Convert g_printf() to g_test_message() to capture messages on TAP
This commit is contained in:
parent
4589ff080d
commit
87a4cea9e4
@ -79,7 +79,7 @@ read_all (int fd,
|
|||||||
|
|
||||||
if (error != G_IO_ERROR_NONE)
|
if (error != G_IO_ERROR_NONE)
|
||||||
{
|
{
|
||||||
g_print ("io-channel-basic: ...from %d: %d\n", fd, error);
|
g_test_message ("io-channel-basic: ...from %d: %d", fd, error);
|
||||||
if (error == G_IO_ERROR_AGAIN)
|
if (error == G_IO_ERROR_AGAIN)
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
@ -207,18 +207,16 @@ recv_windows_message (GIOChannel *channel,
|
|||||||
|
|
||||||
if (error != G_IO_ERROR_NONE)
|
if (error != G_IO_ERROR_NONE)
|
||||||
{
|
{
|
||||||
g_print ("io-channel-basic: ...reading Windows message: G_IO_ERROR_%s\n",
|
g_test_message ("io-channel-basic: ...reading Windows message: G_IO_ERROR_%s",
|
||||||
(error == G_IO_ERROR_AGAIN ? "AGAIN" :
|
(error == G_IO_ERROR_AGAIN ? "AGAIN" : (error == G_IO_ERROR_INVAL ? "INVAL" : (error == G_IO_ERROR_UNKNOWN ? "UNKNOWN" : "???"))));
|
||||||
(error == G_IO_ERROR_INVAL ? "INVAL" :
|
|
||||||
(error == G_IO_ERROR_UNKNOWN ? "UNKNOWN" : "???"))));
|
|
||||||
if (error == G_IO_ERROR_AGAIN)
|
if (error == G_IO_ERROR_AGAIN)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_print ("io-channel-basic: ...Windows message for 0x%p: %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT "\n",
|
g_test_message ("io-channel-basic: ...Windows message for 0x%p: %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT,
|
||||||
msg.hwnd, msg.message, msg.wParam, (gintptr) msg.lParam);
|
msg.hwnd, msg.message, msg.wParam, (gintptr) msg.lParam);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -234,8 +232,8 @@ window_procedure (HWND hwnd,
|
|||||||
WPARAM wparam,
|
WPARAM wparam,
|
||||||
LPARAM lparam)
|
LPARAM lparam)
|
||||||
{
|
{
|
||||||
g_print ("io-channel-basic: window_procedure for 0x%p: %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT "\n",
|
g_test_message ("io-channel-basic: window_procedure for 0x%p: %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT,
|
||||||
hwnd, message, wparam, (gintptr) lparam);
|
hwnd, message, wparam, (gintptr) lparam);
|
||||||
return DefWindowProc (hwnd, message, wparam, lparam);
|
return DefWindowProc (hwnd, message, wparam, lparam);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -268,20 +266,11 @@ spawn_process (int children_nb)
|
|||||||
wcl.lpszClassName = "io-channel-basic";
|
wcl.lpszClassName = "io-channel-basic";
|
||||||
|
|
||||||
klass = RegisterClass (&wcl);
|
klass = RegisterClass (&wcl);
|
||||||
|
g_assert_cmpint (klass, !=, 0);
|
||||||
if (!klass)
|
|
||||||
{
|
|
||||||
g_print ("io-channel-basic: RegisterClass failed\n");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
hwnd = CreateWindow (MAKEINTATOM(klass), "io-channel-basic", 0, 0, 0, 10, 10,
|
hwnd = CreateWindow (MAKEINTATOM(klass), "io-channel-basic", 0, 0, 0, 10, 10,
|
||||||
NULL, NULL, wcl.hInstance, NULL);
|
NULL, NULL, wcl.hInstance, NULL);
|
||||||
if (!hwnd)
|
g_assert_nonnull (hwnd);
|
||||||
{
|
|
||||||
g_print ("io-channel-basic: CreateWindow failed\n");
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
windows_messages_channel =
|
windows_messages_channel =
|
||||||
g_io_channel_win32_new_messages ((guint) (guintptr) hwnd);
|
g_io_channel_win32_new_messages ((guint) (guintptr) hwnd);
|
||||||
@ -338,8 +327,8 @@ spawn_process (int children_nb)
|
|||||||
pollresult = g_io_channel_win32_poll (&pollfd, 1, 100);
|
pollresult = g_io_channel_win32_poll (&pollfd, 1, 100);
|
||||||
end = g_get_monotonic_time();
|
end = g_get_monotonic_time();
|
||||||
|
|
||||||
g_print ("io-channel-basic: had to wait %" G_GINT64_FORMAT "s, result:%d\n",
|
g_test_message ("io-channel-basic: had to wait %" G_GINT64_FORMAT "s, result:%d",
|
||||||
g_date_time_difference (end, start) / 1000000, pollresult);
|
(end - start) / 1000000, pollresult);
|
||||||
#endif
|
#endif
|
||||||
g_io_channel_unref (my_read_channel);
|
g_io_channel_unref (my_read_channel);
|
||||||
}
|
}
|
||||||
@ -389,8 +378,8 @@ run_process (int argc, char *argv[])
|
|||||||
int msg = WM_USER + (rand () % 100);
|
int msg = WM_USER + (rand () % 100);
|
||||||
WPARAM wparam = rand ();
|
WPARAM wparam = rand ();
|
||||||
LPARAM lparam = rand ();
|
LPARAM lparam = rand ();
|
||||||
g_print ("io-channel-basic: child posting message %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT " to 0x%p\n",
|
g_test_message ("io-channel-basic: child posting message %d,%" G_GUINTPTR_FORMAT ",%" G_GINTPTR_FORMAT " to 0x%p",
|
||||||
msg, wparam, (gintptr) lparam, hwnd);
|
msg, wparam, (gintptr) lparam, hwnd);
|
||||||
PostMessage (hwnd, msg, wparam, lparam);
|
PostMessage (hwnd, msg, wparam, lparam);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user