Flutter Engine
The Flutter Engine
fl_test_gtk_logs.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_LINUX_TESTING_FL_TEST_GTK_LOGS_H_
6#define FLUTTER_SHELL_PLATFORM_LINUX_TESTING_FL_TEST_GTK_LOGS_H_
7
8#include <gtk/gtk.h>
9
10namespace flutter {
11namespace testing {
12
13/**
14 * Ensures that GTK has been initialized. If GTK has not been initialized, it
15 * will be initialized using `gtk_init()`. It will also set the GTK log writer
16 * function to monitor the log output, recording the log levels that have been
17 * received in a bitfield accessible via {@link fl_get_received_gtk_log_levels}
18 *
19 * To retrieve the bitfield of recorded log levels, use
20 * `fl_get_received_gtk_log_levels()`.
21 *
22 * @param[in] writer The custom log writer function to use. If `nullptr`, or it
23 * returns G_LOG_WRITER_UNHANDLED, the default log writer function will be
24 * called.
25 *
26 * @brief Ensures that GTK has been initialized and starts monitoring logs.
27 */
28void fl_ensure_gtk_init(GLogWriterFunc writer = nullptr);
29
30/**
31 * Resets the recorded GTK log levels to zero.
32 *
33 * @brief Resets the recorded log levels.
34 */
36
37/**
38 * Returns a bitfield containing the GTK log levels that have been seen since
39 * the last time they were reset.
40 *
41 * @brief Returns the recorded log levels.
42 *
43 * @return A `GLogLevelFlags` bitfield representing the recorded log levels.
44 */
45GLogLevelFlags fl_get_received_gtk_log_levels();
46
47} // namespace testing
48} // namespace flutter
49#endif // FLUTTER_SHELL_PLATFORM_LINUX_TESTING_FL_TEST_GTK_LOGS_H_
GLogLevelFlags fl_get_received_gtk_log_levels()
Returns the recorded log levels.
void fl_ensure_gtk_init(GLogWriterFunc writer)
Ensures that GTK has been initialized and starts monitoring logs.
void fl_reset_received_gtk_log_levels()
Resets the recorded log levels.