Commit 65c7ddb1 authored by Jasem Mutlaq's avatar Jasem Mutlaq

Enabling Tests directory again and organizing test directory for the upcoming...

Enabling Tests directory again and organizing test directory for the upcoming unit tests. Adding a sample DMS testing class. Also fixed includes for many files after removing explicit include of KStars main directory in the includes list
parent 9ad2d70f
......@@ -43,8 +43,6 @@ find_package(Eigen3 REQUIRED)
add_definitions(${EIGEN_DEFINITIONS})
include_directories(${EIGEN3_INCLUDE_DIR})
#PyKDE4 Package TODO? Is there KF5 Package?
find_package(CFitsio)
if (CFITSIO_FOUND)
set(HAVE_CFITSIO 1)
......@@ -99,8 +97,6 @@ endif()
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS -Dfexceptions)
enable_testing(true)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-kstars.h.cmake
${CMAKE_CURRENT_BINARY_DIR}/config-kstars.h )
......@@ -110,20 +106,13 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/kstars/version.h.cmake
# let our config.h be found first in any case
include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR})
# FIXME should we explicitly include it?
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_subdirectory(doc)
add_subdirectory(kstars)
add_subdirectory(datahandlers)
# FIXME Enable Tests later!
#add_subdirectory(Tests)
enable_testing(true)
add_subdirectory(Tests)
install(FILES org.kde.kstars.appdata.xml DESTINATION ${KDE_INSTALL_DATAROOTDIR}/appdata/)
#if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
# macro_display_feature_log()
#endif (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
include_directories( ${kstars_SOURCE_DIR} )
# QT4_AUTOMOC( ${kstars_SRCS} )
# add_library( KStarsAll SHARED ${kstars_extra_SRCS})
include_directories(
${kstars_SOURCE_DIR}/kstars/tools
${kstars_SOURCE_DIR}/kstars/skyobjects
${kstars_SOURCE_DIR}/kstars/skycomponents
${kstars_SOURCE_DIR}/kstars/auxiliary
${kstars_SOURCE_DIR}/kstars/time
)
#include_directories( ${kstars_SOURCE_DIR} )
FIND_PACKAGE(Qt4 REQUIRED)
SET( TEST_LIBRARIES ${QT_QTTEST_LIBRARY} ${QT_LIBRARIES}
FIND_PACKAGE(Qt5Test REQUIRED)
SET( TEST_LIBRARIES
Qt5::Core
Qt5::Test
LibKSDataHandlers
htmesh
${KDE4_KDECORE_LIBS}
${KDE4_KNEWSTUFF3_LIBS}
${KDE4_KIO_LIBS}
${ZLIB_LIBRARIES}
${QT_QTSQL_LIBRARY}
KStarsLib
)
SET( KSParserTests_SRCS testcsvparser.cpp testfwparser.cpp )
QT4_AUTOMOC( ${KSParserTests_SRCS} )
QT4_AUTOMOC( testfwparser.cpp )
ADD_EXECUTABLE( testcsvparser testcsvparser.cpp )
TARGET_LINK_LIBRARIES( testcsvparser ${TEST_LIBRARIES} ${QT_QTTEST_LIBRARY})
ADD_TEST( NAME CSVParserTest COMMAND testcsvparser )
ADD_EXECUTABLE( testfwparser testfwparser.cpp )
TARGET_LINK_LIBRARIES( testfwparser ${TEST_LIBRARIES} ${QT_QTTEST_LIBRARY})
ADD_TEST( NAME FixedWidthParserTest COMMAND testfwparser )
add_subdirectory(auxiliary)
SET( KSParserTests_SRCS testcsvparser.cpp testfwparser.cpp )
ADD_EXECUTABLE( testcsvparser testcsvparser.cpp )
TARGET_LINK_LIBRARIES( testcsvparser ${TEST_LIBRARIES})
ADD_TEST( NAME CSVParserTest COMMAND testcsvparser )
ADD_EXECUTABLE( testfwparser testfwparser.cpp )
TARGET_LINK_LIBRARIES( testfwparser ${TEST_LIBRARIES})
ADD_TEST( NAME FixedWidthParserTest COMMAND testfwparser )
ADD_EXECUTABLE( testdms testdms.cpp )
TARGET_LINK_LIBRARIES( testdms ${TEST_LIBRARIES})
ADD_TEST( NAME DMSTest COMMAND testdms )
......@@ -26,7 +26,7 @@
#include "testcsvparser.h"
#include <QDir>
#include <ktemporaryfile.h>
#include <QTemporaryFile>
TestCSVParser::TestCSVParser(): QObject() {
}
......@@ -85,9 +85,9 @@ void TestCSVParser::initTestCase() {
"either\n"));
test_cases_.append(",,,,,,,,,,,\n");
test_cases_.append("\n");
KTemporaryFile temp_file;
temp_file.setPrefix(QDir::tempPath() + "/");
temp_file.setSuffix(".txt");
QTemporaryFile temp_file;
//temp_file.setPrefix(QDir::tempPath() + QDir::separator());
//temp_file.setSuffix(".txt");
temp_file.setAutoRemove(false);
QVERIFY(temp_file.open());
test_file_name_ = temp_file.fileName();
......@@ -289,5 +289,3 @@ void TestCSVParser::CSVReadMissingFile() {
QTEST_MAIN(TestCSVParser)
#include "testcsvparser.moc"
......@@ -18,10 +18,11 @@
#ifndef TESTCSVPARSER_H
#define TESTCSVPARSER_H
#include <QtTest/QtTest>
#include <KDebug>
#include "datahandlers/ksparser.h"
#include "kstars/ksfilereader.h"
#include "ksparser.h"
#include "ksfilereader.h"
class TestCSVParser: public QObject {
......
/* KStars Testing - DMS
Copyright (C) 2016 Jasem Mutlaq <mutlaqja@ikarustech.com>
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#include "testdms.h"
#include "nan.h"
TestDMS::TestDMS(): QObject()
{
}
TestDMS::~TestDMS()
{
}
void TestDMS::checkDefaultConstructor()
{
/*
* Test 1: Checks Default Constructor
*/
dms d;
QCOMPARE(d.Degrees(), NaN::d);
}
QTEST_MAIN(TestDMS)
/* KStars Testing - DMS
Copyright (C) 2016 Jasem Mutlaq <mutlaqja@ikarustech.com>
This application is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
*/
#ifndef TESTDMS_H
#define TESTDMS_H
#include <QtTest/QtTest>
#include <QDebug>
#include "auxiliary/dms.h"
class TestDMS: public QObject
{
Q_OBJECT
public:
TestDMS();
~TestDMS();
private slots:
void checkDefaultConstructor();
};
#endif
......@@ -18,7 +18,7 @@
#include "testfwparser.h"
#include <QDir>
#include <ktemporaryfile.h>
#include <QTemporaryFile>
TestFWParser::TestFWParser(): QObject() {
}
......@@ -30,9 +30,9 @@ void TestFWParser::initTestCase() {
" \n");
test_cases_.append("this is an ex\n\n");
KTemporaryFile temp_file;
temp_file.setPrefix(QDir::tempPath() + "/");
temp_file.setSuffix(".txt");
QTemporaryFile temp_file;
//temp_file.setPrefix(QDir::tempPath() + QDir::separator());
//temp_file.setSuffix(".txt");
temp_file.setAutoRemove(false);
QVERIFY(temp_file.open());
test_file_name_ = temp_file.fileName();
......@@ -176,9 +176,6 @@ void TestFWParser::FWReadMissingFile()
}
}
QTEST_MAIN(TestFWParser)
#include "testfwparser.moc"
......@@ -17,10 +17,12 @@
#ifndef TESTFWPARSER_H
#define TESTFWPARSER_H
#include <QtTest/QtTest>
#include <KDebug>
#include "datahandlers/ksparser.h"
#include "kstars/ksfilereader.h"
#include <QDebug>
#include "ksparser.h"
#include "auxiliary/ksfilereader.h"
class TestFWParser: public QObject {
......
......@@ -15,7 +15,7 @@
* *
***************************************************************************/
#include "datahandlers/catalogdb.h"
#include "catalogdb.h"
#include "kstars/version.h"
......
......@@ -18,12 +18,6 @@
#ifndef CATALOGDB_H
#define CATALOGDB_H
#include <datahandlers/ksparser.h>
#include <datahandlers/catalogdata.h>
#include <datahandlers/catalogentrydata.h>
#include "kstars/skyobjects/starobject.h"
#include "kstars/skyobjects/deepskyobject.h"
#include "kstars/skycomponents/skycomponent.h"
#include <QStandardPaths>
#include <KLocalizedString>
#include <QDebug>
......@@ -39,6 +33,12 @@
#include <QFile>
#include <QDir>
#include "ksparser.h"
#include "catalogdata.h"
#include "catalogentrydata.h"
#include "starobject.h"
#include "deepskyobject.h"
#include "skycomponent.h"
/* Some notes about the database. (skycomponents.sqlite)
* 1) The uid for Object Designation is the uid being used by objects in KStars
......
......@@ -17,7 +17,7 @@
#ifndef KSTARS_KSPARSER_H
#define KSTARS_KSPARSER_H
#include "kstars/auxiliary/ksfilereader.h"
#include <QStandardPaths>
#include <QList>
#include <QFile>
......@@ -25,6 +25,8 @@
#include <QDebug>
#include <QVariant>
#include "ksfilereader.h"
/**
* @brief Generic class for text file parsers used in KStars.
* Read rows using ReadCSVRow() regardless of the type of parser.
......
......@@ -547,14 +547,9 @@ ki18n_wrap_ui(kstars_SRCS
skycomponents/notifyupdatesui.ui
)
#FIXME We need to port this
#kde4_add_app_icon(kstars_SRCS "${CMAKE_CURRENT_SOURCE_DIR}/hi*-app-kstars.png")
add_executable(kstars main.cpp)
add_library( KStarsLib STATIC ${kstars_SRCS})
# FIXME TODO
#target_include_directories(KStarsLib INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR}/>")
target_link_libraries(KStarsLib
LibKSDataHandlers
htmesh
......@@ -564,8 +559,6 @@ target_link_libraries(KStarsLib
KF5::KIOFileWidgets
KF5::WidgetsAddons
KF5::Plotting
# KF5::TextEditor
# KF5::DBusAddons
KF5::IconThemes
Qt5::Gui
Qt5::PrintSupport
......
......@@ -15,19 +15,18 @@
* *
***************************************************************************/
#include "exportimagedialog.h"
#include "kstars/kstars.h"
#include "kstars/skymap.h"
#include "../printing/legend.h"
#include "kstars/skyqpainter.h"
#include "imageexporter.h"
#include <KMessageBox>
#include <QtSvg/QSvgGenerator>
#include <QDir>
#include <QDesktopWidget>
#include <KMessageBox>
#include "exportimagedialog.h"
#include "kstars.h"
#include "skymap.h"
#include "printing/legend.h"
#include "skyqpainter.h"
#include "imageexporter.h"
ExportImageDialogUI::ExportImageDialogUI(QWidget *parent)
: QFrame(parent)
......
......@@ -22,7 +22,7 @@
#include "ksnumbers.h"
#include "ksuserdb.h"
#include "datahandlers/catalogdb.h"
#include "catalogdb.h"
#include <QList>
#include <QMap>
......
......@@ -33,9 +33,9 @@
#include "pwizfovsh.h"
#include "pwizchartcontents.h"
#include "pwizprint.h"
#include "kstars/projections/projector.h"
#include "projections/projector.h"
#include "kstars.h"
#include "kstars/kstarsdata.h"
#include "kstarsdata.h"
#include "skymap.h"
#include "legend.h"
#include "shfovexporter.h"
......
......@@ -22,7 +22,7 @@
#include "printingwizard.h"
#include "dialogs/finddialog.h"
#include "pwizobjectselection.h"
#include "kstars/kstarsdata.h"
#include "kstarsdata.h"
#include "dialogs/detaildialog.h"
PWizFovShUI::PWizFovShUI(PrintingWizard *wizard, QWidget *parent) : QFrame(parent),
......
......@@ -15,15 +15,16 @@
* *
***************************************************************************/
#include "Options.h"
#include "shfovexporter.h"
#include "starhopper.h"
#include "targetlistcomponent.h"
#include "kstars/kstarsdata.h"
#include "kstarsdata.h"
#include "skymapcomposite.h"
#include "kstars/skymap.h"
#include "skymap.h"
#include "skypoint.h"
#include "printingwizard.h"
#include "Options.h"
ShFovExporter::ShFovExporter(PrintingWizard *wizard, SkyMap *map) : m_Map(map), m_ParentWizard(wizard)
{}
......
......@@ -19,7 +19,7 @@
#define ASTEROIDSCOMPONENT_H
#include "solarsystemlistcomponent.h"
#include "datahandlers/ksparser.h"
#include "ksparser.h"
#include <QList>
#include "typedef.h"
......
......@@ -24,12 +24,15 @@
#include <QFile>
#include <QPixmap>
#include <QTextStream>
#include "kstars/Options.h"
#include "kstars/kstarsdata.h"
#include "kstars/skymap.h"
#include "Options.h"
#include "kstarsdata.h"
#include "skymap.h"
#include "skypainter.h"
#include "skyobjects/starobject.h"
#include "skyobjects/deepskyobject.h"
#include "kstars/skypainter.h"
QStringList CatalogComponent::m_Columns
= QString( "ID RA Dc Tp Nm Mg Flux Mj Mn PA Ig" )
......
......@@ -21,7 +21,7 @@
#include "listcomponent.h"
#include "Options.h"
#include "datahandlers/catalogdb.h"
#include "catalogdb.h"
struct stat;
......
......@@ -21,7 +21,7 @@
class SkyLabeler;
#include "solarsystemlistcomponent.h"
#include "datahandlers/ksparser.h"
#include "ksparser.h"
#include <QList>
/** @class CometsComponent
......
......@@ -16,9 +16,11 @@
***************************************************************************/
#include "constellationartcomponent.h"
#include "kstars/auxiliary/ksfilereader.h"
#include "kstars/skymap.h"
#include "kstars/projections/projector.h"
#include "constellationsart.h"
#include "auxiliary/ksfilereader.h"
#include "skymap.h"
#include "culturelist.h"
#include "projections/projector.h"
ConstellationArtComponent::ConstellationArtComponent( SkyComposite *parent, CultureList *cultures ):SkyComponent(parent)
{
......
......@@ -17,27 +17,16 @@
#ifndef ConstellationArtComponent_H
#define ConstellationArtComponent_H
#include "kstars/Options.h"
#include "kstars/skyobjects/constellationsart.h"
#include "skycomponent.h"
#include <QImage>
#include <QSqlDatabase>
#include "kstars/projections/projector.h"
#include "kstars/auxiliary/dms.h"
#include "kstars/skymap.h"
#include "kstars/skyqpainter.h"
#include "Options.h"
#include "skycomponent.h"
class ConstellationsArt;
class QColor;
class SkyMap;
class SkyPoint;
class SkyMesh;
class QImage;
class dms;
class Projector;
class QSqlDatabase;
class SkyMap;
class CultureList;
class SkyQPainter;
/**
* @class ConstellationArtComponent
......
......@@ -23,7 +23,7 @@
#include <QObject>
#include "skycomponent.h"
#include "skylabel.h"
#include "datahandlers/ksparser.h"
#include "ksparser.h"
#define NNGCFILES 14
......
......@@ -31,7 +31,7 @@
#include "skyobjects/skypoint.h"
#include "ksfilereader.h"
#include "skypainter.h"
#include "kstars/projections/projector.h"
#include "projections/projector.h"
FlagComponent::FlagComponent( SkyComposite *parent )
: PointListComponent(parent)
......
......@@ -26,7 +26,7 @@
#include "skyobjects/starobject.h"
#include "skyobjects/deepskyobject.h"
#include "skyobjects/ksplanet.h"
#include "kstars/skyobjects/constellationsart.h"
#include "skyobjects/constellationsart.h"
#include "targetlistcomponent.h"
#include "constellationboundarylines.h"
......
......@@ -15,7 +15,7 @@
* *
***************************************************************************/
#include "constellationsart.h"
#include "kstars/texturemanager.h"
#include "texturemanager.h"
ConstellationsArt::ConstellationsArt(dms midpointra, dms midpointdec, double pa, double w, double h, QString abbreviation, QString filename)
......
......@@ -23,11 +23,11 @@
#include <QImage>
#include "skycomponent.h"
#include "culturelist.h"
#include "kstars/skypainter.h"
#include "kstars/skyobjects/skyobject.h"
#include "kstars/skycomponents/constellationartcomponent.h"
#include "skypainter.h"
#include "skyobjects/skyobject.h"
#include "skycomponents/constellationartcomponent.h"
#include "skypoint.h"
#include "kstars/auxiliary/dms.h"
#include "auxiliary/dms.h"
class QImage;
class SkyPoint;
......
......@@ -21,7 +21,7 @@
#include <qimage.h>
#include <qpoint.h>
#include "kstars/skyobjects/skyobject.h"
#include "skyobject.h"
#include "dms.h"
class QImage;
......
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