aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-06-01 13:57:03 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-06-01 13:57:03 -0500
commit0b46d0852fa764f5a9cc5d7a71c279ed56c1401d (patch)
tree188f9004badf2c679173e0b5ba8aca247851e9a1 /tests
parent5b17593fb388ab9febc2e4bc26d8054a34dd58c0 (diff)
downloadayatana-indicator-power-0b46d0852fa764f5a9cc5d7a71c279ed56c1401d.tar.gz
ayatana-indicator-power-0b46d0852fa764f5a9cc5d7a71c279ed56c1401d.tar.bz2
ayatana-indicator-power-0b46d0852fa764f5a9cc5d7a71c279ed56c1401d.zip
In indicator_power_device_get_time_details(), add a test for non-devices being passed in.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-device.cc14
1 files changed, 13 insertions, 1 deletions
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,