aboutsummaryrefslogtreecommitdiff
path: root/tests/test-device.cc
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-05-24 19:06:58 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-05-24 19:06:58 -0500
commit88d486192c176f938b09ee86c5cd6f95dfd02aba (patch)
treec4a7b4d83305aa6d0a106e33250f2b84f70e3af3 /tests/test-device.cc
parent9e188d4b15e27ec26dd139fee61a4af3c522a5a8 (diff)
downloadayatana-indicator-power-88d486192c176f938b09ee86c5cd6f95dfd02aba.tar.gz
ayatana-indicator-power-88d486192c176f938b09ee86c5cd6f95dfd02aba.tar.bz2
ayatana-indicator-power-88d486192c176f938b09ee86c5cd6f95dfd02aba.zip
add unit tests confirming that the device accessor functions won't crash when you pass NULL for the device
Diffstat (limited to 'tests/test-device.cc')
-rw-r--r--tests/test-device.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test-device.cc b/tests/test-device.cc
index 70beeb7..0102185 100644
--- a/tests/test-device.cc
+++ b/tests/test-device.cc
@@ -156,3 +156,17 @@ TEST(DeviceTest, NewFromVariant)
g_object_unref (device);
g_variant_unref (variant);
}
+
+TEST(DeviceTest, BadAccessors)
+{
+ ensure_glib_initialized ();
+
+ // test that these functions can handle being passed NULL pointers
+ IndicatorPowerDevice * device = NULL;
+ indicator_power_device_get_kind(device);
+ indicator_power_device_get_state(device);
+ indicator_power_device_get_object_path(device);
+ indicator_power_device_get_icon(device);
+ indicator_power_device_get_percentage(device);
+ indicator_power_device_get_time(device);
+}