From 0b46d0852fa764f5a9cc5d7a71c279ed56c1401d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 1 Jun 2012 13:57:03 -0500 Subject: In indicator_power_device_get_time_details(), add a test for non-devices being passed in. --- tests/test-device.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests/test-device.cc') diff --git a/tests/test-device.cc b/tests/test-device.cc index 525eee0..5d68880 100644 --- a/tests/test-device.cc +++ b/tests/test-device.cc @@ -388,8 +388,20 @@ TEST_F(DeviceTest, Labels) char * real_lang = g_strdup(g_getenv ("LANG")); g_setenv ("LANG", "en_US.UTF-8", TRUE); + /* bad args: NULL device */ + check_strings (NULL, NULL, NULL, NULL); + + /* bad args: a GObject that isn't a device */ + GObject * o = G_OBJECT(g_cancellable_new()); + check_strings ((IndicatorPowerDevice*)o, NULL, NULL, NULL); + g_object_unref (o); + + /** + *** + **/ + IndicatorPowerDevice * device = INDICATOR_POWER_DEVICE (g_object_new (INDICATOR_POWER_DEVICE_TYPE, NULL)); - GObject * o = G_OBJECT(device); + o = G_OBJECT(device); /* charging */ g_object_set (o, INDICATOR_POWER_DEVICE_KIND, UP_DEVICE_KIND_BATTERY, -- cgit v1.2.3