From 92b48e8afa58cab0612fdc49546ea66666e73ab5 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 26 Oct 2012 09:08:59 +0200 Subject: add unit tests to confirm the device refcounts are correct s.t. IndicatorPower isn't leaking devices --- tests/test-indicator.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/test-indicator.cc') diff --git a/tests/test-indicator.cc b/tests/test-indicator.cc index b9f7321..5480774 100644 --- a/tests/test-indicator.cc +++ b/tests/test-indicator.cc @@ -71,6 +71,8 @@ class IndicatorTest : public ::testing::Test virtual void TearDown() { + ASSERT_EQ (1, G_OBJECT(battery_device)->ref_count); + ASSERT_EQ (1, G_OBJECT(ac_device)->ref_count); g_object_unref (battery_device); g_object_unref (ac_device); } -- cgit v1.2.3 From a8d3382188e2fad083a287c9656052273f91e845 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 26 Oct 2012 09:14:11 +0200 Subject: silence the known/nonbug gtk and glib warnings --- tests/test-indicator.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/test-indicator.cc') diff --git a/tests/test-indicator.cc b/tests/test-indicator.cc index 5480774..824a5ac 100644 --- a/tests/test-indicator.cc +++ b/tests/test-indicator.cc @@ -29,6 +29,16 @@ with this program. If not, see . namespace { + void quiet_log_func (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer user_data) + { + // instantiating an indicator w/o a window causes lots + // of glib/gtk warnings... silence them so that they don't + // obscure any other warnings generated by the tests. + } + void ensure_glib_initialized () { static bool initialized = false; @@ -37,6 +47,8 @@ namespace { initialized = true; g_type_init(); + g_log_set_handler ("Gtk", (GLogLevelFlags)(G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING), quiet_log_func, NULL); + g_log_set_handler ("GLib-GObject", (GLogLevelFlags)(G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING), quiet_log_func, NULL); } } } -- cgit v1.2.3