From 4f74252ce9a8ae3e651cc9e61dc280da82f12d9b Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 24 May 2012 10:15:28 -0500 Subject: add test-indicator.cc --- tests/test-indicator.cc | 52 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/test-indicator.cc diff --git a/tests/test-indicator.cc b/tests/test-indicator.cc new file mode 100644 index 0000000..2f16176 --- /dev/null +++ b/tests/test-indicator.cc @@ -0,0 +1,52 @@ +/* +Copyright 2012 Canonical Ltd. + +Authors: + Charles Kerr + +This program is free software: you can redistribute it and/or modify it +under the terms of the GNU General Public License version 3, as published +by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranties of +MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program. If not, see . +*/ + +#include + +#include "device.h" +#include "indicator-power.h" + +namespace +{ + void ensure_glib_initialized () + { + static bool initialized = false; + + if (G_UNLIKELY(!initialized)) + { + initialized = true; + g_type_init(); + } + } +} + +/*** +**** +***/ + +TEST(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_clear_pointer (&o, g_object_unref); +} + -- cgit v1.2.3