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.cc52
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);
+}
+