aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt22
-rw-r--r--tests/indicator-test.cc8
2 files changed, 27 insertions, 3 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index bc2df0d..d9bfe0b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -11,6 +11,28 @@ add_library (gtest STATIC
target_link_libraries(gtest ${GTEST_LIBS})
###########################
+# GSettings Schema
+###########################
+
+# build the necessary schemas
+set_directory_properties (PROPERTIES
+ ADDITIONAL_MAKE_CLEAN_FILES gschemas.compiled)
+set_source_files_properties (gschemas.compiled GENERATED)
+
+# GSettings:
+# compile the indicator-sound schema into a gschemas.compiled file in this directory,
+# and help the tests to find that file by setting -DSCHEMA_DIR
+set (SCHEMA_DIR ${CMAKE_CURRENT_BINARY_DIR})
+add_definitions(-DSCHEMA_DIR="${SCHEMA_DIR}")
+execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas
+ OUTPUT_VARIABLE COMPILE_SCHEMA_EXECUTABLE
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+add_custom_command (OUTPUT gschemas.compiled
+ DEPENDS ${CMAKE_BINARY_DIR}/data/com.canonical.indicator.sound.gschema.xml
+ COMMAND cp -f ${CMAKE_BINARY_DIR}/data/*gschema.xml ${SCHEMA_DIR}
+ COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR})
+
+###########################
# Vala Mocks
###########################
diff --git a/tests/indicator-test.cc b/tests/indicator-test.cc
index 31494d4..636db1d 100644
--- a/tests/indicator-test.cc
+++ b/tests/indicator-test.cc
@@ -39,6 +39,9 @@ protected:
//addMock(buildBustleMock("indicator-test-system.bustle", DBUS_TEST_SERVICE_BUS_SYSTEM));
g_setenv("LD_PRELOAD", PA_MOCK_LIB, TRUE);
+ g_setenv("GSETTINGS_SCHEMA_DIR", SCHEMA_DIR, TRUE);
+ g_setenv("GSETTINGS_BACKEND", "memory", TRUE);
+
as = std::make_shared<AccountsServiceMock>();
addMock(*as);
@@ -81,8 +84,8 @@ TEST_F(IndicatorTest, DesktopMenu) {
EXPECT_MENU_ATTRIB(std::vector<int>({0, 0, 0}), "action", "indicator.mute");
EXPECT_MENU_ATTRIB(std::vector<int>({0, 0, 0}), "label", "Mute");
- EXPECT_MENU_ATTRIB(std::vector<int>({0, 2}), "action", "indicator.desktop-settings");
- EXPECT_MENU_ATTRIB(std::vector<int>({0, 2}), "label", "Sound Settingsā€¦");
+ EXPECT_MENU_ATTRIB(std::vector<int>({0, 1}), "action", "indicator.desktop-settings");
+ EXPECT_MENU_ATTRIB(std::vector<int>({0, 1}), "label", "Sound Settingsā€¦");
}
TEST_F(IndicatorTest, BaseActions) {
@@ -99,7 +102,6 @@ TEST_F(IndicatorTest, BaseActions) {
ASSERT_ACTION_EXISTS("mute");
ASSERT_ACTION_STATE_TYPE("mute", G_VARIANT_TYPE_BOOLEAN);
- EXPECT_ACTION_STATE("mute", false);
ASSERT_ACTION_EXISTS("mic-volume");
ASSERT_ACTION_STATE_TYPE("mic-volume", G_VARIANT_TYPE_DOUBLE);