diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 10 | ||||
-rw-r--r-- | tests/test-indicator.cc | 27 |
2 files changed, 33 insertions, 4 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 341abdd..8169e3a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,6 @@ TESTS = -CLEANFILES = +CLEANFILES = +BUILT_SOURCES = check_PROGRAMS = ### @@ -34,6 +35,11 @@ TEST_CPPFLAGS = \ $(INDICATOR_CFLAGS) \ $(COVERAGE_CFLAGS) +BUILT_SOURCES += gschemas.compiled +CLEANFILES += gschemas.compiled +gschemas.compiled: Makefile + @glib-compile-schemas --targetdir=$(abs_builddir) $(top_builddir)/data + TESTS += test-device check_PROGRAMS += test-device test_device_SOURCES = test-device.cc @@ -44,7 +50,7 @@ TESTS += test-indicator check_PROGRAMS += test-indicator test_indicator_SOURCES = test-indicator.cc test_indicator_LDADD = $(TEST_LIBS) -test_indicator_CPPFLAGS = $(TEST_CPPFLAGS) +test_indicator_CPPFLAGS = $(TEST_CPPFLAGS) -DSCHEMA_DIR="\"$(top_builddir)/tests/\"" ### ### diff --git a/tests/test-indicator.cc b/tests/test-indicator.cc index e3533e9..af494ee 100644 --- a/tests/test-indicator.cc +++ b/tests/test-indicator.cc @@ -22,6 +22,10 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include "device.h" #include "indicator-power.h" +/*** +**** +***/ + namespace { void ensure_glib_initialized () @@ -40,7 +44,27 @@ namespace **** ***/ -TEST(IndicatorTest, GObjectNew) +class IndicatorTest : public ::testing::Test +{ + protected: + + 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")); + } + + virtual void TearDown() + { + } +}; + +/*** +**** +***/ + +TEST_F(IndicatorTest, GObjectNew) { ensure_glib_initialized (); @@ -49,4 +73,3 @@ TEST(IndicatorTest, GObjectNew) ASSERT_TRUE (IS_INDICATOR_POWER(o)); g_object_unref (o); } - |