mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
win32: suppress fatal error dialog box when running tests
When running a test program (ie, if g_test_init() has been called), don't pop up a dialog box when a fatal error occurs. Just print the message to stderr and exit. https://bugzilla.gnome.org/show_bug.cgi?id=679683
This commit is contained in:
parent
ac025007cc
commit
e97a2f4195
@ -2877,6 +2877,7 @@ g_compute_hmac_for_string
|
||||
g_test_minimized_result
|
||||
g_test_maximized_result
|
||||
g_test_init
|
||||
g_test_initialized
|
||||
g_test_quick
|
||||
g_test_slow
|
||||
g_test_thorough
|
||||
|
@ -820,7 +820,8 @@ mklevel_prefix (gchar level_prefix[STRING_BUFFER_SIZE],
|
||||
strcat (level_prefix, " **");
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
win32_keep_fatal_message = (log_level & G_LOG_FLAG_FATAL) != 0;
|
||||
if ((log_level & G_LOG_FLAG_FATAL) != 0 && !g_test_initialized ())
|
||||
win32_keep_fatal_message = TRUE;
|
||||
#endif
|
||||
return to_stdout ? 1 : 2;
|
||||
}
|
||||
@ -954,10 +955,13 @@ g_logv (const gchar *log_domain,
|
||||
if ((test_level & G_LOG_FLAG_FATAL) && !masquerade_fatal)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
gchar *locale_msg = g_locale_from_utf8 (fatal_msg_buf, -1, NULL, NULL, NULL);
|
||||
|
||||
MessageBox (NULL, locale_msg, NULL,
|
||||
MB_ICONERROR|MB_SETFOREGROUND);
|
||||
if (win32_keep_fatal_message)
|
||||
{
|
||||
gchar *locale_msg = g_locale_from_utf8 (fatal_msg_buf, -1, NULL, NULL, NULL);
|
||||
|
||||
MessageBox (NULL, locale_msg, NULL,
|
||||
MB_ICONERROR|MB_SETFOREGROUND);
|
||||
}
|
||||
if (IsDebuggerPresent () && !(test_level & G_LOG_FLAG_RECURSION))
|
||||
G_BREAKPOINT ();
|
||||
else
|
||||
|
@ -105,6 +105,16 @@
|
||||
* facilitate running tests and producing nicely formatted test reports.
|
||||
*/
|
||||
|
||||
/**
|
||||
* g_test_initialized:
|
||||
*
|
||||
* Returns %TRUE if g_test_init() has been called.
|
||||
*
|
||||
* Returns: %TRUE if g_test_init() has been called.
|
||||
*
|
||||
* Since: 2.36
|
||||
*/
|
||||
|
||||
/**
|
||||
* g_test_quick:
|
||||
*
|
||||
|
@ -92,6 +92,7 @@ void g_test_init (int *argc,
|
||||
char ***argv,
|
||||
...);
|
||||
/* query testing framework config */
|
||||
#define g_test_initialized() (g_test_config_vars->test_initialized)
|
||||
#define g_test_quick() (g_test_config_vars->test_quick)
|
||||
#define g_test_slow() (!g_test_config_vars->test_quick)
|
||||
#define g_test_thorough() (!g_test_config_vars->test_quick)
|
||||
|
Loading…
Reference in New Issue
Block a user