aboutsummaryrefslogtreecommitdiff
path: root/tests/test-indicator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-indicator.cc')
-rw-r--r--tests/test-indicator.cc31
1 files changed, 28 insertions, 3 deletions
diff --git a/tests/test-indicator.cc b/tests/test-indicator.cc
index af494ee..3e9d97b 100644
--- a/tests/test-indicator.cc
+++ b/tests/test-indicator.cc
@@ -48,15 +48,32 @@ class IndicatorTest : public ::testing::Test
{
protected:
+ IndicatorPowerDevice * ac_device;
+ IndicatorPowerDevice * battery_device;
+
virtual void SetUp()
{
ensure_glib_initialized ();
+
g_setenv( "GSETTINGS_SCHEMA_DIR", SCHEMA_DIR, TRUE);
- g_message ("GSETTINGS_SCHEMA_DIR is %s", g_getenv("GSETTINGS_SCHEMA_DIR"));
+
+ ac_device = indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/line_power_AC",
+ UP_DEVICE_KIND_LINE_POWER,
+ ". GThemedIcon ac-adapter-symbolic ac-adapter ",
+ 0.0, UP_DEVICE_STATE_UNKNOWN, 0);
+
+ battery_device = indicator_power_device_new (
+ "/org/freedesktop/UPower/devices/battery_BAT0",
+ UP_DEVICE_KIND_BATTERY,
+ ". GThemedIcon battery-good-symbolic gpm-battery-060 battery-good ",
+ 52.871712, UP_DEVICE_STATE_DISCHARGING, 8834);
}
virtual void TearDown()
{
+ g_clear_object (&battery_device);
+ g_clear_object (&ac_device);
}
};
@@ -66,10 +83,18 @@ class IndicatorTest : public ::testing::Test
TEST_F(IndicatorTest, GObjectNew)
{
- ensure_glib_initialized ();
-
GObject * o = G_OBJECT (g_object_new (INDICATOR_POWER_TYPE, NULL));
ASSERT_TRUE (o != NULL);
ASSERT_TRUE (IS_INDICATOR_POWER(o));
g_object_unref (o);
}
+
+TEST_F(IndicatorTest, SetDevices)
+{
+ IndicatorPower * power = INDICATOR_POWER(g_object_new (INDICATOR_POWER_TYPE, NULL));
+ IndicatorPowerDevice * devices[] = { ac_device, battery_device };
+
+ indicator_power_set_devices (power, devices, G_N_ELEMENTS(devices));
+
+ g_object_unref (power);
+}