Skip to content

Commit

Permalink
Revert "Revert "Debugging test initialization.""
Browse files Browse the repository at this point in the history
This reverts commit 844f991
  • Loading branch information
TallFurryMan committed Aug 28, 2020
1 parent 844f991 commit d6d6dbc
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 234 deletions.
147 changes: 0 additions & 147 deletions .gitlab-ci.yml

This file was deleted.

9 changes: 3 additions & 6 deletions Tests/kstars_ui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,9 @@ INCLUDE_DIRECTORIES(${INDI_INCLUDE_DIR})
SET(KSTARS_UI_EKOS_SRC ${KSTARS_UI_TESTS_SRC} test_ekos_wizard.cpp)
SET(KSTARS_UI_EKOS_LIBS ${TEST_LIBRARIES} ${CFITSIO_LIBRARIES} ${INDI_CLIENT_LIBRARIES} ${NOVA_LIBRARIES} z)

# FIXME: this particular test crashes when done on the EGLFS platform
# Disabling until we find the reason, other tests do cover this scenario

# ADD_EXECUTABLE(test_ekos ${KSTARS_UI_EKOS_SRC} test_ekos.cpp)
# TARGET_LINK_LIBRARIES(test_ekos ${KSTARS_UI_EKOS_LIBS})
# ADD_TEST(NAME TestEkosProfiles COMMAND test_ekos)
ADD_EXECUTABLE(test_ekos ${KSTARS_UI_EKOS_SRC} test_ekos.cpp)
TARGET_LINK_LIBRARIES(test_ekos ${KSTARS_UI_EKOS_LIBS})
ADD_TEST(NAME TestEkosProfiles COMMAND test_ekos)

ADD_EXECUTABLE(test_ekos_simulator ${KSTARS_UI_EKOS_SRC} test_ekos_simulator.cpp)
TARGET_LINK_LIBRARIES(test_ekos_simulator ${KSTARS_UI_EKOS_LIBS})
Expand Down
43 changes: 38 additions & 5 deletions Tests/kstars_ui/kstars_ui_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ int run_wizards(int argc, char *argv[])
}
#endif

Q_UNUSED(argc);
Q_UNUSED(argv);

return failure;
}

Expand All @@ -113,6 +110,42 @@ void execute_tests()
}
}

#if !defined(HAVE_INDI)
QTEST_KSTARS_MAIN(KStarsUiTests)
#if 1
//QTEST_KSTARS_MAIN(KStarsUiTests)
#else
// This weak main function serves when only the KStars tests are run, and nothing else.
// It serves as an expanded example to what happens when running tests with KSTARS_UI_TEST.
int __attribute__((weak)) main(int argc, char * argv[])
{
// We create our application
QApplication app(argc, argv);
// We configure our application environment
prepare_tests();
int failure = 0;
// We delay the tests with a timer because we need to run tests in an initialized UI
QTimer::singleShot(1000, QApplication::instance(), [&] {
qDebug("Starting tests...");
// Run KStars wizard
failure |= run_wizards(argc, argv);
// Run example tests - we'd better test our documentation :)
KStarsUiTests tc;
failure |= QTest::qExec(&tc, argc, argv);
qDebug("Tests are done.");
QApplication::instance()->quit();
});
// We launch the UI application, and let delayed tests do their job asynchronously
execute_tests();
// And we return the result
return failure;
}
#endif
9 changes: 1 addition & 8 deletions datahandlers/catalogdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,7 @@

bool CatalogDB::Initialize()
{
skydb_ = QSqlDatabase::addDatabase("QSQLITE", "skydb");
if (!skydb_.isValid())
{
qCCritical(KSTARS_CATALOG()) << "Unable to prepare database of type sqlite!";
return false;
}

skydb_ = QSqlDatabase::addDatabase("QSQLITE", "skydb");
QString dbfile = KSPaths::locate(QStandardPaths::GenericDataLocation, QString("skycomponents.sqlite"));
if (dbfile.isEmpty())
dbfile = KSPaths::writableLocation(QStandardPaths::GenericDataLocation) + QString("skycomponents.sqlite");
Expand Down Expand Up @@ -123,7 +117,6 @@ void CatalogDB::FirstRun()
qCWarning(KSTARS_CATALOG) << query.lastError();
}
}
qCWarning(KSTARS_CATALOG) << "Additional Sky Catalog Database rebuilt.";
}

CatalogDB::~CatalogDB()
Expand Down
66 changes: 0 additions & 66 deletions docker/Dockerfile

This file was deleted.

3 changes: 1 addition & 2 deletions kstars/kstarsdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ namespace
// Calls QApplication::exit
void fatalErrorMessage(QString fname)
{
qCCritical(KSTARS) << i18n("Critical File not Found: %1", fname);
KSNotification::sorry(i18n("The file %1 could not be found. "
"KStars cannot run properly without this file. "
"KStars searches for this file in following locations:\n\n\t"
Expand All @@ -58,6 +57,7 @@ void fatalErrorMessage(QString fname)
fname, QStandardPaths::standardLocations(QStandardPaths::DataLocation).join("\n\t")),
i18n("Critical File Not Found: %1", fname)); // FIXME: Must list locations depending on file type

qDebug() << i18n("Critical File Not Found: %1", fname);
qApp->exit(1);
}

Expand All @@ -66,7 +66,6 @@ void fatalErrorMessage(QString fname)
// Calls QApplication::exit if he don't
bool nonFatalErrorMessage(QString fname)
{
qCWarning(KSTARS) << i18n( "Non-Critical File Not Found: %1", fname );
#ifdef KSTARS_LITE
Q_UNUSED(fname);
return true;
Expand Down

0 comments on commit d6d6dbc

Please sign in to comment.