1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-18 20:34:39 +01:00

Only enable gui in tests that need it.

This commit is contained in:
John Maguire 2010-03-26 12:50:27 +00:00
parent 2b812a76fd
commit 1cad21a3e0
2 changed files with 18 additions and 8 deletions

View File

@ -55,7 +55,7 @@ add_custom_target(build_tests
add_dependencies(test build_tests)
# Given a file foo_test.cpp, creates a target foo_test and adds it to the test target.
macro(add_test_file test_source)
macro(add_test_file test_source gui_required)
get_filename_component(TEST_NAME ${test_source} NAME_WE)
add_executable(${TEST_NAME}
EXCLUDE_FROM_ALL
@ -63,16 +63,22 @@ macro(add_test_file test_source)
main.cpp
)
target_link_libraries(${TEST_NAME} gmock clementine_lib test_utils)
set(GUI_REQUIRED ${gui_required})
if (GUI_REQUIRED)
set_target_properties(${TEST_NAME} PROPERTIES
COMPILE_DEFINITIONS GUI)
endif (GUI_REQUIRED)
add_custom_command(TARGET test POST_BUILD
COMMAND ./${TEST_NAME})
add_dependencies(build_tests ${TEST_NAME})
endmacro (add_test_file)
add_test_file(m3uparser_test.cpp)
add_test_file(song_test.cpp)
add_test_file(librarybackend_test.cpp)
add_test_file(albumcoverfetcher_test.cpp)
add_test_file(xspfparser_test.cpp)
add_test_file(library_test.cpp)
add_test_file(albumcovermanager_test.cpp)
add_test_file(m3uparser_test.cpp false)
add_test_file(song_test.cpp false)
add_test_file(librarybackend_test.cpp false)
add_test_file(albumcoverfetcher_test.cpp false)
add_test_file(xspfparser_test.cpp false)
add_test_file(library_test.cpp false)
add_test_file(albumcovermanager_test.cpp true)

View File

@ -25,7 +25,11 @@ int main(int argc, char** argv) {
testing::InitGoogleMock(&argc, argv);
testing::AddGlobalTestEnvironment(new MetatypesEnvironment);
#ifdef GUI
QApplication a(argc, argv);
#else
QCoreApplication a(argc, argv);
#endif
testing::AddGlobalTestEnvironment(new ResourcesEnvironment);
return RUN_ALL_TESTS();