diff options
author | Ted Gould <ted@gould.cx> | 2015-02-09 12:05:06 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2015-02-09 12:05:06 -0600 |
commit | a30edaddc32d70d8a64fe8158b879620ead22e87 (patch) | |
tree | 1331bf2cfe5d924040ad12eaa3ad2bcc5bc617bb /tests | |
parent | fe57009ba87b4cd9403cd219c26cc9487ac5d276 (diff) | |
parent | 1b0c78a1bd4237a920a569a64efe6bd006e4a9ca (diff) | |
download | ayatana-indicator-sound-a30edaddc32d70d8a64fe8158b879620ead22e87.tar.gz ayatana-indicator-sound-a30edaddc32d70d8a64fe8158b879620ead22e87.tar.bz2 ayatana-indicator-sound-a30edaddc32d70d8a64fe8158b879620ead22e87.zip |
Update to trunk
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 25 | ||||
-rw-r--r-- | tests/indicator-test.cc | 8 |
2 files changed, 29 insertions, 4 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bc2df0d..38a76ae 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,6 +11,29 @@ 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}/gsettings-schemas") +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_SOURCE_DIR}/data/com.canonical.indicator.sound.gschema.xml + COMMAND mkdir -p ${SCHEMA_DIR} + COMMAND cp -f ${CMAKE_SOURCE_DIR}/data/*gschema.xml ${SCHEMA_DIR} + COMMAND ${COMPILE_SCHEMA_EXECUTABLE} ${SCHEMA_DIR}) + +########################### # Vala Mocks ########################### @@ -217,7 +240,7 @@ add_definitions( -DINDICATOR_SOUND_SERVICE_BINARY="${CMAKE_BINARY_DIR}/src/indicator-sound-service" -DPA_MOCK_LIB="${CMAKE_CURRENT_BINARY_DIR}/libpulse-mock.so" ) -add_executable (indicator-test indicator-test.cc) +add_executable (indicator-test indicator-test.cc gschemas.compiled) target_link_libraries ( indicator-test gtest diff --git a/tests/indicator-test.cc b/tests/indicator-test.cc index 07d5f91..f7d0b2b 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); |