2 * check-helpers.c - Source for some check helpers
3 * Copyright (C) 2007-2008 Collabora Ltd.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include "check-helpers.h"
25 static gboolean expecting_critical
= FALSE
;
26 static gboolean received_critical
= FALSE
;
29 check_helper_log_critical_func (const gchar
*log_damain
,
30 GLogLevelFlags log_level
,
35 if (!expecting_critical
)
37 fail("Unexpected critical message: %s\n", message
);
40 g_assert (log_level
& G_LOG_LEVEL_CRITICAL
);
42 received_critical
= TRUE
;
48 return received_critical
;
52 expect_critical (gboolean expected
)
54 expecting_critical
= expected
;
55 received_critical
= FALSE
;
59 check_helpers_init (void)
61 g_log_set_handler (NULL
, G_LOG_LEVEL_CRITICAL
,
62 check_helper_log_critical_func
, NULL
);