aboutsummaryrefslogtreecommitdiff
path: root/tests/test-device.cc
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2013-06-19 21:13:09 +0000
committerTarmac <Unknown>2013-06-19 21:13:09 +0000
commit0ce78de0eae6f44a0afe6e5b4bdc6da83f6dbdf8 (patch)
treece626b15bcfb92beec4487a6b7fe50ef4be91dac /tests/test-device.cc
parent0b0585581a8da994362ef4cfe3a2168917a47ff4 (diff)
parent258f3ad689ae4ba49e2813a5051b4968d568f999 (diff)
downloadayatana-indicator-power-0ce78de0eae6f44a0afe6e5b4bdc6da83f6dbdf8.tar.gz
ayatana-indicator-power-0ce78de0eae6f44a0afe6e5b4bdc6da83f6dbdf8.tar.bz2
ayatana-indicator-power-0ce78de0eae6f44a0afe6e5b4bdc6da83f6dbdf8.zip
Convert the power indicator into a service that exports GMenus and GActions in accordance with our indicator-ng design.
Approved by PS Jenkins bot, Ted Gould.
Diffstat (limited to 'tests/test-device.cc')
-rw-r--r--tests/test-device.cc27
1 files changed, 14 insertions, 13 deletions
diff --git a/tests/test-device.cc b/tests/test-device.cc
index ab329f1..987b201 100644
--- a/tests/test-device.cc
+++ b/tests/test-device.cc
@@ -17,9 +17,10 @@ You should have received a copy of the GNU General Public License along
with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <gio/gio.h>
#include <gtest/gtest.h>
#include "device.h"
-#include "indicator-power.h"
+#include "service.h"
class DeviceTest : public ::testing::Test
{
@@ -29,12 +30,12 @@ class DeviceTest : public ::testing::Test
int log_count_ipower_actual;
- static void log_count_func (const gchar *log_domain,
- GLogLevelFlags log_level,
- const gchar *message,
- gpointer user_data)
+ static void log_count_func (const gchar * log_domain G_GNUC_UNUSED,
+ GLogLevelFlags log_level G_GNUC_UNUSED,
+ const gchar * message G_GNUC_UNUSED,
+ gpointer gself)
{
- reinterpret_cast<DeviceTest*>(user_data)->log_count_ipower_actual++;
+ reinterpret_cast<DeviceTest*>(gself)->log_count_ipower_actual++;
}
protected:
@@ -542,7 +543,7 @@ TEST_F(DeviceTest, Labels)
device will take longest to charge (and optionally how long it will take). */
TEST_F(DeviceTest, ChoosePrimary)
{
- GSList * device_list;
+ GList * device_list;
IndicatorPowerDevice * a;
IndicatorPowerDevice * b;
@@ -580,8 +581,8 @@ TEST_F(DeviceTest, ChoosePrimary)
};
device_list = NULL;
- device_list = g_slist_append (device_list, a);
- device_list = g_slist_append (device_list, b);
+ device_list = g_list_append (device_list, a);
+ device_list = g_list_append (device_list, b);
for (int i=0, n=G_N_ELEMENTS(tests); i<n; i++)
{
@@ -597,14 +598,14 @@ TEST_F(DeviceTest, ChoosePrimary)
INDICATOR_POWER_DEVICE_TIME, guint64(tests[j].time),
INDICATOR_POWER_DEVICE_PERCENTAGE, tests[j].percentage,
NULL);
- ASSERT_EQ (a, indicator_power_choose_primary_device(device_list));
+ ASSERT_EQ (a, indicator_power_service_choose_primary_device(device_list));
/* reverse the list to check that list order doesn't matter */
- device_list = g_slist_reverse (device_list);
- ASSERT_EQ (a, indicator_power_choose_primary_device(device_list));
+ device_list = g_list_reverse (device_list);
+ ASSERT_EQ (a, indicator_power_service_choose_primary_device(device_list));
}
}
// cleanup
- g_slist_free_full (device_list, g_object_unref);
+ g_list_free_full (device_list, g_object_unref);
}