aboutsummaryrefslogtreecommitdiff
path: root/tests/test-indicator.cc
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2012-05-25 14:58:56 -0500
committerCharles Kerr <charles.kerr@canonical.com>2012-05-25 14:58:56 -0500
commit34c756aa7a894ee9c12f3dce0b4ae6e4ac6a30a8 (patch)
tree7903071895251f1b2cbdebeaac2e4014fbc62f2f /tests/test-indicator.cc
parent33f4e3d7024984b8b4f3b4fe0b1dfa4ec8ab5700 (diff)
downloadayatana-indicator-power-34c756aa7a894ee9c12f3dce0b4ae6e4ac6a30a8.tar.gz
ayatana-indicator-power-34c756aa7a894ee9c12f3dce0b4ae6e4ac6a30a8.tar.bz2
ayatana-indicator-power-34c756aa7a894ee9c12f3dce0b4ae6e4ac6a30a8.zip
modify IndicatorPower to use IndicatorPowerDevices internally
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);
+}