diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-device.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/test-device.cc b/tests/test-device.cc index 02493dc..18bdc08 100644 --- a/tests/test-device.cc +++ b/tests/test-device.cc @@ -39,38 +39,38 @@ class DeviceTest : public ::testing::Test { private: - guint handler_id; + guint log_handler_id; - int log_count; + int log_count_ipower_actual; static void log_count_func (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) { - reinterpret_cast<DeviceTest*>(user_data)->log_count++; + reinterpret_cast<DeviceTest*>(user_data)->log_count_ipower_actual++; } protected: - int expected_ipower_log_messages; + int log_count_ipower_expected; protected: virtual void SetUp() { const GLogLevelFlags flags = GLogLevelFlags(G_LOG_LEVEL_CRITICAL|G_LOG_LEVEL_WARNING); - handler_id = g_log_set_handler ("Indicator-Power", flags, log_count_func, this); - expected_ipower_log_messages = 0; - log_count = 0; + log_handler_id = g_log_set_handler ("Indicator-Power", flags, log_count_func, this); + log_count_ipower_expected = 0; + log_count_ipower_actual = 0; ensure_glib_initialized (); } virtual void TearDown() { - ASSERT_EQ (expected_ipower_log_messages, log_count); - g_log_remove_handler ("Indicator-Power", handler_id); + ASSERT_EQ (log_count_ipower_expected, log_count_ipower_actual); + g_log_remove_handler ("Indicator-Power", log_handler_id); } protected: @@ -230,7 +230,7 @@ TEST_F(DeviceTest, BadAccessors) indicator_power_device_get_state (device); indicator_power_device_get_percentage (device); indicator_power_device_get_object_path (device); - expected_ipower_log_messages += 5; + log_count_ipower_expected += 5; // test that these functions can handle being passed non-device GObjects device = reinterpret_cast<IndicatorPowerDevice*>(g_cancellable_new ()); @@ -239,7 +239,7 @@ TEST_F(DeviceTest, BadAccessors) indicator_power_device_get_state (device); indicator_power_device_get_percentage (device); indicator_power_device_get_object_path (device); - expected_ipower_log_messages += 5; + log_count_ipower_expected += 5; g_object_unref (device); } @@ -254,7 +254,7 @@ TEST_F(DeviceTest, IconNames) GObject * o = G_OBJECT(device); // bad arguments - expected_ipower_log_messages++; + log_count_ipower_expected++; ASSERT_TRUE (indicator_power_device_get_icon_names (NULL) == NULL); // power @@ -481,11 +481,11 @@ TEST_F(DeviceTest, Labels) g_setenv ("LANG", "en_US.UTF-8", TRUE); // bad args: NULL device - expected_ipower_log_messages++; + log_count_ipower_expected++; check_strings (NULL, NULL, NULL, NULL); // bad args: a GObject that isn't a device - expected_ipower_log_messages++; + log_count_ipower_expected++; GObject * o = G_OBJECT(g_cancellable_new()); check_strings ((IndicatorPowerDevice*)o, NULL, NULL, NULL); g_object_unref (o); |