From 88d486192c176f938b09ee86c5cd6f95dfd02aba Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 24 May 2012 19:06:58 -0500 Subject: add unit tests confirming that the device accessor functions won't crash when you pass NULL for the device --- tests/test-device.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests/test-device.cc') 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); +} -- cgit v1.2.3