Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify DICOM testing removing needs for installing CTK #1167

Merged
merged 4 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions Applications/ctkDICOMHost/Testing/Cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,7 @@ ctkFunctionGetTargetLibraries(KIT_target_libraries)
ctk_add_executable_utf8(${KIT}CppTests ${Tests})
TARGET_LINK_LIBRARIES(${KIT}CppTests ${KIT_target_libraries} ${QT_LIBRARIES})

SET( KIT_TESTS ${CPP_TEST_PATH}/${KIT}CppTests)
IF(WIN32)
SET(KIT_TESTS ${CPP_TEST_PATH}/${CMAKE_BUILD_TYPE}/${KIT}CppTests)
ENDIF(WIN32)

MACRO( SIMPLE_TEST TESTNAME )
ADD_TEST( ${TESTNAME} ${KIT_TESTS} ${TESTNAME} )
SET_PROPERTY(TEST ${TESTNAME} PROPERTY LABELS ${PROJECT_NAME})
ENDMACRO( SIMPLE_TEST )

#
# Add Tests
#
SIMPLE_TEST(ctkDICOMHostTest1)
SIMPLE_TEST( ctkDICOMHostTest1 $<TARGET_FILE:ctkDICOMHost> )
13 changes: 12 additions & 1 deletion Applications/ctkDICOMHost/Testing/Cpp/ctkDICOMHostTest1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,26 @@
// Qt includes
#include <QCoreApplication>
#include <QProcess>
#include <QStringList>

// STD includes
#include <cstdlib>
#include <iostream>

//-----------------------------------------------------------------------------
int ctkDICOMHostTest1(int argc, char * argv [])
{
QCoreApplication app(argc, argv);
QString command = QString("ctkDICOMHost");

QStringList arguments = app.arguments();
arguments.pop_front(); // remove "program" name
if (!arguments.count())
{
std::cerr << "Usage: ctkDICOMHostTest1 /path/to/ctkDICOMHost" << std::endl;
return EXIT_FAILURE;
}

QString command = arguments.at(0);
QProcess process;
process.start(command, /* arguments= */ QStringList());
bool res = process.waitForStarted();
Expand Down
9 changes: 8 additions & 1 deletion Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@
// Qt includes
#include <QCoreApplication>
#include <QDir>
#include <QTemporaryDir>
#include <QTimer>

// ctkCore includes
#include <ctkCoreTestingMacros.h>

// ctkDICOMCore includes
#include "ctkDICOMDatabase.h"

Expand All @@ -35,8 +39,11 @@ int ctkDICOMDatabaseTest1( int argc, char * argv [] )
{
QCoreApplication app(argc, argv);

QTemporaryDir tempDirectory;
CHECK_BOOL(tempDirectory.isValid(), true);

ctkDICOMDatabase database;
QDir databaseDirectory = QDir::temp();
QDir databaseDirectory(tempDirectory.path());
QFileInfo databaseFile(databaseDirectory, QString("database.test"));
database.openDatabase(databaseFile.absoluteFilePath());

Expand Down
9 changes: 8 additions & 1 deletion Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@
// Qt includes
#include <QCoreApplication>
#include <QDir>
#include <QTemporaryDir>
#include <QTimer>

// ctkCore includes
#include <ctkCoreTestingMacros.h>

// ctkDICOMCore includes
#include "ctkDICOMDatabase.h"

Expand All @@ -44,8 +48,11 @@ int ctkDICOMDatabaseTest2( int argc, char * argv [] )

QString dicomFilePath(argv[1]);

QTemporaryDir tempDirectory;
CHECK_BOOL(tempDirectory.isValid(), true);

ctkDICOMDatabase database;
QDir databaseDirectory = QDir::temp();
QDir databaseDirectory(tempDirectory.path());
databaseDirectory.remove("ctkDICOMDatabase.sql");
databaseDirectory.remove("ctkDICOMTagCache.sql");

Expand Down
9 changes: 7 additions & 2 deletions Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
// Qt includes
#include <QCoreApplication>
#include <QDir>
#include <QTemporaryDir>

// ctkCore includes
#include <ctkCoreTestingMacros.h>

// ctkDICOMCore includes
#include "ctkDICOMDatabase.h"
Expand All @@ -41,9 +45,10 @@ int ctkDICOMDatabaseTest3( int argc, char * argv [] )
return EXIT_FAILURE;
}

QDir databaseDirectory = QDir::temp();
databaseDirectory.remove("ctkDICOMDatabase.sql");
QTemporaryDir tempDirectory;
CHECK_BOOL(tempDirectory.isValid(), true);

QDir databaseDirectory(tempDirectory.path());
QFileInfo databaseFile(databaseDirectory, QString("database.test"));
QString databaseFileName(databaseFile.absoluteFilePath());

Expand Down
9 changes: 8 additions & 1 deletion Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
// Qt includes
#include <QCoreApplication>
#include <QDir>
#include <QTemporaryDir>

// ctkCore includes
#include <ctkCoreTestingMacros.h>

// ctkDICOMCore includes
#include "ctkDICOMDatabase.h"
Expand All @@ -43,8 +47,11 @@ int ctkDICOMDatabaseTest4( int argc, char * argv [] )

QString dicomFilePath(argv[1]);

QTemporaryDir tempDirectory;
CHECK_BOOL(tempDirectory.isValid(), true);

ctkDICOMDatabase database;
QDir databaseDirectory = QDir::temp();
QDir databaseDirectory(tempDirectory.path());
databaseDirectory.remove("ctkDICOMDatabase.sql");
databaseDirectory.remove("ctkDICOMTagCache.sql");

Expand Down
9 changes: 8 additions & 1 deletion Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
// Qt includes
#include <QCoreApplication>
#include <QDir>
#include <QTemporaryDir>

// ctkCore includes
#include <ctkCoreTestingMacros.h>

// ctkDICOMCore includes
#include "ctkDICOMDatabase.h"
Expand All @@ -43,8 +47,11 @@ int ctkDICOMDatabaseTest5( int argc, char * argv [] )

QString dicomFilePath(argv[1]);

QTemporaryDir tempDirectory;
CHECK_BOOL(tempDirectory.isValid(), true);

ctkDICOMDatabase database;
QDir databaseDirectory = QDir::temp();
QDir databaseDirectory(tempDirectory.path());
databaseDirectory.remove("ctkDICOMDatabase.sql");
databaseDirectory.remove("ctkDICOMTagCache.sql");

Expand Down
9 changes: 8 additions & 1 deletion Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest6.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
// Qt includes
#include <QCoreApplication>
#include <QDir>
#include <QTemporaryDir>

// ctkCore includes
#include <ctkCoreTestingMacros.h>

// ctkDICOMCore includes
#include "ctkDICOMDatabase.h"
Expand All @@ -43,8 +47,11 @@ int ctkDICOMDatabaseTest6( int argc, char * argv [] )

QString dicomFilePath(argv[1]);

QTemporaryDir tempDirectory;
CHECK_BOOL(tempDirectory.isValid(), true);

ctkDICOMDatabase database;
QDir databaseDirectory = QDir::temp();
QDir databaseDirectory(tempDirectory.path());
databaseDirectory.remove("ctkDICOMDatabase.sql");
databaseDirectory.remove("ctkDICOMTagCache.sql");

Expand Down
9 changes: 8 additions & 1 deletion Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest7.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
// Qt includes
#include <QCoreApplication>
#include <QDir>
#include <QTemporaryDir>

// ctkCore includes
#include <ctkCoreTestingMacros.h>

// ctkDICOMCore includes
#include "ctkDICOMDatabase.h"
Expand All @@ -34,8 +38,11 @@ int ctkDICOMDatabaseTest7( int argc, char * argv [] )
{
QCoreApplication app(argc, argv);

QTemporaryDir tempDirectory;
CHECK_BOOL(tempDirectory.isValid(), true);

ctkDICOMDatabase database;
QDir databaseDirectory = QDir::temp();
QDir databaseDirectory(tempDirectory.path());
databaseDirectory.remove("ctkDICOMDatabase.sql");
databaseDirectory.remove("ctkDICOMTagCache.sql");

Expand Down
6 changes: 3 additions & 3 deletions Libs/DICOM/Core/ctkDICOMTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ QString ctkDICOMTesterPrivate::findFile(const QStringList& nameFilters, const QS
//------------------------------------------------------------------------------
QString ctkDICOMTesterPrivate::findDCMQRSCPExecutable()const
{
return this->findFile(QStringList("dcmqrscp*"), "CMakeExternals/Install/bin");
return this->findFile(QStringList("dcmqrscp*"), "../DCMTK-build/bin");
}

//------------------------------------------------------------------------------
Expand All @@ -146,13 +146,13 @@ QString ctkDICOMTesterPrivate::findDCMQRSCPConfigFile()const
//------------------------------------------------------------------------------
QString ctkDICOMTesterPrivate::findStoreSCUExecutable()const
{
return this->findFile(QStringList("storescu*"), "CMakeExternals/Install/bin");
return this->findFile(QStringList("storescu*"), "../DCMTK-build/bin");
}

//------------------------------------------------------------------------------
QString ctkDICOMTesterPrivate::findStoreSCPExecutable()const
{
return this->findFile(QStringList("storescp*"), "CMakeExternals/Install/bin");
return this->findFile(QStringList("storescp*"), "../DCMTK-build/bin");
}

//------------------------------------------------------------------------------
Expand Down