Commit a07cc1f4 authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr

Make tests compile.

parent 9c39c518
......@@ -31,6 +31,7 @@ find_package(KF5DocTools)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
include(KDEInstallDirs)
include(ECMAddTests)
include(KDECMakeSettings)
include(KDECompilerSettings)
include(ECMInstallIcons)
......@@ -44,6 +45,7 @@ find_package(Qt5 REQUIRED COMPONENTS
XmlPatterns
Quick
QuickWidgets
Test
)
find_package(KF5 CONFIG REQUIRED COMPONENTS
Config
......@@ -66,6 +68,7 @@ ecm_optional_add_subdirectory(images)
ecm_optional_add_subdirectory(icons)
ecm_optional_add_subdirectory(libsound)
ecm_optional_add_subdirectory(liblearnerprofile)
ecm_optional_add_subdirectory(autotests)
# files to install in the artikulate project root directory
install(PROGRAMS artikulate.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
......
###
# Copyright 2013 Andreas Cord-Landwehr <cordlandwehr@kde.org>
# Copyright 2013-2014 Andreas Cord-Landwehr <cordlandwehr@kde.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
......@@ -25,6 +25,7 @@
include_directories(
../src/
../
${CMAKE_CURRENT_BINARY_DIR}
)
......@@ -34,12 +35,12 @@ file(COPY ../data/languages DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/data) # copy
file(COPY testcourses/de.xml DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/data/courses) # copy test files
file(COPY testcourses/fr.xml DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/data/courses) # copy test files
# basic tests course files (input/output)
set (TestCourseFiles_SRCS
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
set(TestCourseFiles_SRCS
testcoursefiles.cpp
)
kde4_add_kcfg_files(TestCourseFiles_SRCS ../src/settings.kcfgc)
kde4_add_executable(TestCourseFiles ${TestCourseFiles_SRCS} )
kconfig_add_kcfg_files(TestCourseFiles_SRCS ../src/settings.kcfgc)
add_executable(TestCourseFiles ${TestCourseFiles_SRCS} )
target_link_libraries(TestCourseFiles
artikulatecore
${QT_QTTEST_LIBRARY}
......@@ -54,14 +55,16 @@ target_link_libraries(TestCourseFiles
${QT_QTDECLARATIVE_LIBRARY}
${QT_QTXMLPATTERNS_LIBRARY}
${QT_QTSQL_LIBRARY}
Qt5::Test
)
add_test(TestCourseFiles TestCourseFiles)
ecm_mark_as_test(TestCourseFiles)
# basic tests language files (input/output)
set (TestLanguageFiles_SRCS
set(TestLanguageFiles_SRCS
testlanguagefiles.cpp
)
kde4_add_executable(TestLanguageFiles ${TestLanguageFiles_SRCS} )
add_executable(TestLanguageFiles ${TestLanguageFiles_SRCS} )
target_link_libraries(TestLanguageFiles
artikulatecore
${QT_QTTEST_LIBRARY}
......@@ -76,5 +79,7 @@ target_link_libraries(TestLanguageFiles
${QT_QTDECLARATIVE_LIBRARY}
${QT_QTXMLPATTERNS_LIBRARY}
${QT_QTSQL_LIBRARY}
Qt5::Test
)
add_test(TestLanguageFiles TestLanguageFiles)
ecm_mark_as_test(TestLanguageFiles)
......@@ -28,7 +28,7 @@
#include "core/resources/courseresource.h"
#include "../src/settings.h"
#include <qtest_kde.h>
#include <QTest>
#include <QDebug>
#include <QTemporaryFile>
......@@ -45,21 +45,22 @@ TestCourseFiles::TestCourseFiles()
void TestCourseFiles::init()
{
KGlobal::dirs()->addResourceDir("appdata" , "./testcourses/");
KGlobal::dirs()->addResourceDir("appdata" , "./");
KGlobal::dirs()->addResourceDir("appdata" , "./autotests/");
KGlobal::dirs()->addResourceDir("appdata" , "./autotests/testcourses/");
//FIXME has to be ported
// KGlobal::dirs()->addResourceDir("appdata" , "./testcourses/");
// KGlobal::dirs()->addResourceDir("appdata" , "./");
// KGlobal::dirs()->addResourceDir("appdata" , "./autotests/");
// KGlobal::dirs()->addResourceDir("appdata" , "./autotests/testcourses/");
systemUseCourseRepositoryValue = Settings::useCourseRepository();
Settings::setUseCourseRepository(false);
Settings::self()->writeConfig();
Settings::self()->save();
}
void TestCourseFiles::cleanup()
{
// reset value
Settings::setUseCourseRepository(systemUseCourseRepositoryValue);
Settings::self()->writeConfig();
Settings::self()->save();
}
void TestCourseFiles::courseSchemeValidationTest()
......@@ -95,7 +96,7 @@ void TestCourseFiles::fileLoadSaveCompleteness()
QFile file(outputFile.fileName());
if (!file.open(QIODevice::ReadOnly)) {
qFatal() << "Could not open file to read.";
qCritical() << "Could not open file to read.";
}
//TODO this only works, since the resource manager not checks uniqueness of course ids!
......@@ -137,4 +138,4 @@ void TestCourseFiles::fileLoadSaveCompleteness()
}
QTEST_KDEMAIN_CORE(TestCourseFiles)
QTEST_MAIN(TestCourseFiles)
......@@ -25,7 +25,7 @@
#include "core/unit.h"
#include "core/phrase.h"
#include <qtest_kde.h>
#include <QTest>
#include <QDebug>
#include <QTemporaryFile>
#include <QUrl>
......@@ -39,9 +39,10 @@
TestLanguageFiles::TestLanguageFiles()
{
KGlobal::dirs()->addResourceDir("appdata" , "./autotests/data");
KGlobal::dirs()->addResourceDir("appdata" , "./autotests");
KGlobal::dirs()->addResourceDir("appdata" , "./");
//FIXME port this
// KGlobal::dirs()->addResourceDir("appdata" , "./autotests/data");
// KGlobal::dirs()->addResourceDir("appdata" , "./autotests");
// KGlobal::dirs()->addResourceDir("appdata" , "./");
}
void TestLanguageFiles::init()
......@@ -135,4 +136,4 @@ void TestLanguageFiles::checkIdUniqueness()
}
QTEST_KDEMAIN_CORE(TestLanguageFiles)
QTEST_MAIN(TestLanguageFiles)
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