Commit ef3c0ba8 authored by Richard Lärkäng's avatar Richard Lärkäng
Browse files

Use kde4_add_test, based on macros from kdelibs

svn path=/trunk/KDE/kdemultimedia/libkcddb/; revision=649555
parent c59e60e1
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/.. )
if(KDE4_BUILD_TESTS)
set(syncsmtpsubmittest_SRCS syncsmtpsubmittest.cpp )
kde4_automoc(${syncsmtpsubmittest_SRCS})
kde4_add_executable(syncsmtpsubmittest RUN_UNINSTALLED ${syncsmtpsubmittest_SRCS})
target_link_libraries(syncsmtpsubmittest ${KDE4_KDECORE_LIBS} kcddb )
set(asyncsmtpsubmittest_SRCS asyncsmtpsubmittest.cpp )
kde4_automoc(${asyncsmtpsubmittest_SRCS})
kde4_add_executable(asyncsmtpsubmittest RUN_UNINSTALLED ${asyncsmtpsubmittest_SRCS})
target_link_libraries(asyncsmtpsubmittest ${KDE4_KDECORE_LIBS} kcddb )
set(asynchttplookuptest_SRCS asynchttplookuptest.cpp )
kde4_automoc(${asynchttplookuptest_SRCS})
kde4_add_executable(asynchttplookuptest RUN_UNINSTALLED ${asynchttplookuptest_SRCS})
target_link_libraries(asynchttplookuptest ${KDE4_KDECORE_LIBS} kcddb ${QT_QTTEST_LIBRARY} )
add_test(asynchttplookuptest ${EXECUTABLE_OUTPUT_PATH}/asynccddblookuptest)
set(asynccddblookuptest_SRCS asynccddblookuptest.cpp )
kde4_automoc(${asynccddblookuptest_SRCS})
kde4_add_executable(asynccddblookuptest RUN_UNINSTALLED ${asynccddblookuptest_SRCS})
target_link_libraries(asynccddblookuptest ${KDE4_KDECORE_LIBS} kcddb ${QT_QTTEST_LIBRARY} )
add_test(asynccddblookuptest ${EXECUTABLE_OUTPUT_PATH}/asynccddblookuptest)
set(synccddblookuptest_SRCS synccddblookuptest.cpp )
kde4_automoc(${synccddblookuptest_SRCS})
kde4_add_executable(synccddblookuptest RUN_UNINSTALLED ${synccddblookuptest_SRCS})
target_link_libraries(synccddblookuptest ${KDE4_KDECORE_LIBS} kcddb ${QT_QTTEST_LIBRARY} )
add_test(synccddblookuptest ${EXECUTABLE_OUTPUT_PATH}/synccddblookuptest)
set(synchttplookuptest_SRCS synchttplookuptest.cpp )
kde4_automoc(${synchttplookuptest_SRCS})
kde4_add_executable(synchttplookuptest RUN_UNINSTALLED ${synchttplookuptest_SRCS})
target_link_libraries(synchttplookuptest ${KDE4_KDECORE_LIBS} kcddb ${QT_QTTEST_LIBRARY} )
add_test(synchttplookuptest ${EXECUTABLE_OUTPUT_PATH}/synchttplookuptest)
set(asynchttpsubmittest_SRCS asynchttpsubmittest.cpp )
kde4_automoc(${asynchttpsubmittest_SRCS})
kde4_add_executable(asynchttpsubmittest RUN_UNINSTALLED ${asynchttpsubmittest_SRCS})
target_link_libraries(asynchttpsubmittest ${KDE4_KDECORE_LIBS} kcddb )
set(synchttpsubmittest_SRCS synchttpsubmittest.cpp )
kde4_automoc(${synchttpsubmittest_SRCS})
kde4_add_executable(synchttpsubmittest RUN_UNINSTALLED ${synchttpsubmittest_SRCS})
target_link_libraries(synchttpsubmittest ${KDE4_KDECORE_LIBS} kcddb )
set(sitestest_SRCS sitestest.cpp )
kde4_automoc(${sitestest_SRCS})
kde4_add_executable(sitestest RUN_UNINSTALLED ${sitestest_SRCS})
target_link_libraries(sitestest ${KDE4_KDECORE_LIBS} kcddb )
set(utf8test_SRCS utf8test.cpp )
kde4_automoc(${utf8test_SRCS})
kde4_add_executable(utf8test RUN_UNINSTALLED ${utf8test_SRCS})
target_link_libraries(utf8test ${KDE4_KDECORE_LIBS} kcddb ${QT_QTTEST_LIBRARY} )
add_test(utf8test ${EXECUTABLE_OUTPUT_PATH}/utf8test)
set(musicbrainztest_SRCS musicbrainztest.cpp )
kde4_automoc(${musicbrainztest_SRCS})
kde4_add_executable(musicbrainztest RUN_UNINSTALLED ${musicbrainztest_SRCS})
target_link_libraries(musicbrainztest ${KDE4_KDECORE_LIBS} kcddb ${QT_QTTEST_LIBRARY} )
add_test(musicbrainztest ${EXECUTABLE_OUTPUT_PATH}/musicbrainztest)
set(asyncmusicbrainztest_SRCS asyncmusicbrainztest.cpp )
kde4_automoc(${asyncmusicbrainztest_SRCS})
kde4_add_executable(asyncmusicbrainztest RUN_UNINSTALLED ${asyncmusicbrainztest_SRCS})
target_link_libraries(asyncmusicbrainztest ${KDE4_KDECORE_LIBS} kcddb ${QT_QTTEST_LIBRARY} )
add_test(asyncmusicbrainztest ${EXECUTABLE_OUTPUT_PATH}/asyncmusicbrainztest)
set(cdinfotest_SRCS cdinfotest.cpp )
kde4_automoc(${cdinfotest_SRCS})
kde4_add_executable(cdinfotest RUN_UNINSTALLED ${cdinfotest_SRCS})
target_link_libraries(cdinfotest ${KDE4_KDECORE_LIBS} kcddb ${QT_QTTEST_LIBRARY} )
add_test(cdinfotest ${EXECUTABLE_OUTPUT_PATH}/cdinfotest)
endif(KDE4_BUILD_TESTS)
# Tests don't need to go into toplevel/bin, they are fine in the current dir.
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR} )
MACRO(KCDDB_BUILD_TESTS)
FOREACH(_testname ${ARGN})
kde4_automoc(${_testname}.cpp)
kde4_add_test(${_testname} ${_testname}.cpp)
target_link_libraries(${_testname} ${KDE4_KDEUI_LIBS}
${QT_QTTEST_LIBRARY} kcddb)
ENDFOREACH(_testname)
ENDMACRO(KCDDB_BUILD_TESTS)
MACRO(KCDDB_EXECUTE_TESTS)
FOREACH(_testname ${ARGN})
add_test(kcddb-${_testname} ${EXECUTABLE_OUTPUT_PATH}/${_testname})
ENDFOREACH(_testname)
ENDMACRO(KCDDB_EXECUTE_TESTS)
set(kcddb_unittests
asynchttplookuptest
asynccddblookuptest
synccddblookuptest
synchttplookuptest
utf8test
musicbrainztest
asyncmusicbrainztest
cdinfotest
)
KCDDB_BUILD_TESTS(
${kcddb_unittests}
syncsmtpsubmittest
asyncsmtpsubmittest
asynchttpsubmittest
synchttpsubmittest
sitestest
)
KCDDB_EXECUTE_TESTS(
${kcddb_unittests})
......@@ -64,11 +64,11 @@ void AsyncCDDBLookupTest::testLookup()
// If revision doesn't match, test probably needs to be updated
// See: http://www.freedb.org/freedb/jazz/a1107d0a for updated data
QCOMPARE(m_info.get("revision").toInt(), 3);
QCOMPARE(m_info.get("revision").toInt(), 4);
QCOMPARE(m_info.get(Artist).toString(),QString("Various"));
QCOMPARE(m_info.get(Title).toString(),QString("The K&D Sessions [disc 1]"));
QCOMPARE(m_info.get(Genre).toString(),QString("Trip-Hop"));
QCOMPARE(m_info.get(Artist).toString(),QString("Kruder & Dorfmeister"));
QCOMPARE(m_info.get(Title).toString(),QString("K&D Sessions"));
QCOMPARE(m_info.get(Genre).toString(),QString("Tribal"));
QCOMPARE(m_info.get(Year).toInt(),1998);
QCOMPARE(m_info.track(0).get(Title).toString(),QString("Heroes [kruder's long loose bossa]"));
QCOMPARE(m_info.track(1).get(Title).toString(),QString("Jazz Master [k&d session]"));
......
......@@ -65,11 +65,11 @@ void AsyncHTTPLookupTest::testLookup()
// If revision doesn't match, test probably needs to be updated
// See: http://www.freedb.org/freedb/jazz/a1107d0a for updated data
QCOMPARE(m_info.get("revision").toInt(), 3);
QCOMPARE(m_info.get("revision").toInt(), 4);
QCOMPARE(m_info.get(Artist).toString(),QString("Various"));
QCOMPARE(m_info.get(Title).toString(),QString("The K&D Sessions [disc 1]"));
QCOMPARE(m_info.get(Genre).toString(),QString("Trip-Hop"));
QCOMPARE(m_info.get(Artist).toString(),QString("Kruder & Dorfmeister"));
QCOMPARE(m_info.get(Title).toString(),QString("K&D Sessions"));
QCOMPARE(m_info.get(Genre).toString(),QString("Tribal"));
QCOMPARE(m_info.get(Year).toInt(),1998);
QCOMPARE(m_info.track(0).get(Title).toString(),QString("Heroes [kruder's long loose bossa]"));
QCOMPARE(m_info.track(1).get(Title).toString(),QString("Jazz Master [k&d session]"));
......
......@@ -65,17 +65,17 @@ void SyncCDDBLookupTest::testLookup()
{
// If revision doesn't match, test probably needs to be updated
// See: http://www.freedb.org/freedb/misc/3e0c3a05 for updated data
QCOMPARE(i.get("revision").toInt(), 12);
QCOMPARE(i.get("revision").toInt(), 16);
QCOMPARE(i.get(Artist).toString(),QString("Pink Floyd"));
QCOMPARE(i.get(Title).toString(),QString("Atom Heart Mother"));
QCOMPARE(i.get(Genre).toString(),QString("Psychedelic Rock"));
QCOMPARE(i.get(Year).toInt(),1970);
QCOMPARE(i.track(0).get(Title).toString(),QString("Atom Heart Mother: a) Father's Shout b) Breast Milky c) Mother Fore d) Funky Dung e) Mind Your Throats Please f) Remergence"));
QCOMPARE(i.track(0).get(Title).toString(),QString("Atom heart mother: a) Father's shout b) Breast milky c) Mother fore d) Funky dung e) Mind your throats please f) Remergence"));
QCOMPARE(i.track(1).get(Title).toString(),QString("If"));
QCOMPARE(i.track(2).get(Title).toString(),QString("Summer '68"));
QCOMPARE(i.track(3).get(Title).toString(),QString("Fat Old Sun"));
QCOMPARE(i.track(4).get(Title).toString(),QString("Alan's Psychedelic Breakfast: a) Rise And Shine b) Sunny Side Up c) Morning Glory"));
QCOMPARE(i.track(4).get(Title).toString(),QString("Alan's psychedelic breakfast: a) Rise and shine b) Sunny side up c) Morning glory"));
QCOMPARE(i.track(0).get(Comment).toString(),QString(""));
QCOMPARE(i.track(1).get(Comment).toString(),QString(""));
QCOMPARE(i.track(2).get(Comment).toString(),QString(""));
......
......@@ -65,17 +65,16 @@ void SyncHTTPLookupTest::testLookup()
{
// If revision doesn't match, test probably needs to be updated
// See: http://www.freedb.org/freedb/misc/3e0c3a05 for updated data
QCOMPARE(i.get("revision").toInt(), 12);
QCOMPARE(i.get("revision").toInt(), 16);
QCOMPARE(i.get(Artist).toString(),QString("Pink Floyd"));
QCOMPARE(i.get(Title).toString(),QString("Atom Heart Mother"));
QCOMPARE(i.get(Genre).toString(),QString("Psychedelic Rock"));
QCOMPARE(i.get(Year).toInt(),1970);
QCOMPARE(i.track(0).get(Title).toString(),QString("Atom Heart Mother: a) Father's Shout b) Breast Milky c) Mother Fore d) Funky Dung e) Mind Your Throats Please f) Remergence"));
QCOMPARE(i.track(1).get(Title).toString(),QString("If"));
QCOMPARE(i.track(2).get(Title).toString(),QString("Summer '68"));
QCOMPARE(i.track(3).get(Title).toString(),QString("Fat Old Sun"));
QCOMPARE(i.track(4).get(Title).toString(),QString("Alan's Psychedelic Breakfast: a) Rise And Shine b) Sunny Side Up c) Morning Glory"));
QCOMPARE(i.track(4).get(Title).toString(),QString("Alan's psychedelic breakfast: a) Rise and shine b) Sunny side up c) Morning glory"));
QCOMPARE(i.track(0).get(Comment).toString(),QString(""));
QCOMPARE(i.track(1).get(Comment).toString(),QString(""));
QCOMPARE(i.track(2).get(Comment).toString(),QString(""));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment