diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2012-05-24 10:15:28 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2012-05-24 10:15:28 -0500 |
commit | 4f74252ce9a8ae3e651cc9e61dc280da82f12d9b (patch) | |
tree | a313a69f3f71ccc36da225fb2bcd218ac8a9d313 /tests | |
parent | f434dc2f9579aeea0c7afe6fa8b78d56c560707f (diff) | |
download | ayatana-indicator-power-4f74252ce9a8ae3e651cc9e61dc280da82f12d9b.tar.gz ayatana-indicator-power-4f74252ce9a8ae3e651cc9e61dc280da82f12d9b.tar.bz2 ayatana-indicator-power-4f74252ce9a8ae3e651cc9e61dc280da82f12d9b.zip |
add test-indicator.cc
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-indicator.cc | 52 |
1 files changed, 52 insertions, 0 deletions
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 <charles.kerr@canonical.com> + +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 <http://www.gnu.org/licenses/>. +*/ + +#include <gtest/gtest.h> + +#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); +} + |