| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 | // Qt includes#include <QCoreApplication>#include <QFileInfo>// ctkDICOMCore includes#include "ctkDICOMTester.h"// STD includes#include <iostream>#include <cstdlib>void printUsage(){  std::cout << " ctkDICOMTesterTest1 [<dcmqrscp>] [<configfile>]" << std::endl;}int ctkDICOMTesterTest1(int argc, char * argv []){  QCoreApplication app(argc, argv);  ctkDICOMTester tester;    if (argc > 1)    {    tester.setDCMQRSCPExecutable(argv[1]);    if (tester.dcmqrscpExecutable() != argv[1])      {       std::cerr << __LINE__                 << ": Failed to set dcmqrscp: " << argv[1]                 << " value:" << qPrintable(tester.dcmqrscpExecutable())                 << std::endl;       return EXIT_FAILURE;      }    }  if (argc > 2)    {    tester.setDCMQRSCPConfigFile(argv[2]);    if (tester.dcmqrscpConfigFile() != argv[2])      {       std::cerr << __LINE__                 << ": Failed to set dcmqrscp config file: " << argv[2]                 << " value:" << qPrintable(tester.dcmqrscpConfigFile())                 << std::endl;       return EXIT_FAILURE;      }    }  QString dcmqrscp(tester.dcmqrscpExecutable());  QString dcmqrscpConf(tester.dcmqrscpConfigFile());  if (!QFileInfo(dcmqrscp).exists() ||      !QFileInfo(dcmqrscp).isExecutable())    {    std::cerr << __LINE__              << ": Wrong dcmqrscp executable: " << qPrintable(dcmqrscp)              << std::endl;    }  if (!QFileInfo(dcmqrscpConf).exists() ||      !QFileInfo(dcmqrscpConf).isReadable())    {    std::cerr << __LINE__              << ": Wrong dcmqrscp executable: " << qPrintable(dcmqrscp)              << std::endl;    }  QProcess* process = tester.startDCMQRSCP();  if (!process)    {    std::cerr << __LINE__              << ": Failed to start dcmqrscp: " << qPrintable(dcmqrscp)              << " with config file:" << qPrintable(dcmqrscpConf) << std::endl;    return EXIT_FAILURE;    }  bool res = tester.stopDCMQRSCP();  if (!res)    {    std::cerr << __LINE__              << ": Failed to stop dcmqrscp: " << qPrintable(dcmqrscp)              << " with config file:" << qPrintable(dcmqrscpConf) << std::endl;    return EXIT_FAILURE;    }  process = tester.startDCMQRSCP();  if (!process)    {    std::cerr << __LINE__              << ": Failed to start dcmqrscp: " << qPrintable(dcmqrscp)              << " with config file:" << qPrintable(dcmqrscpConf)              << std::endl;    return EXIT_FAILURE;    }  process = tester.startDCMQRSCP();  if (process)    {    std::cerr << __LINE__              << ": Failed to start dcmqrscp: " << qPrintable(dcmqrscp)              << " with config file:"<< qPrintable(dcmqrscpConf) << std::endl;    return EXIT_FAILURE;    }  res = tester.stopDCMQRSCP();  if (!res)    {    std::cerr << __LINE__              << ": Failed to stop dcmqrscp: " << qPrintable(dcmqrscp)              << " with config file:" << qPrintable(dcmqrscpConf) << std::endl;    return EXIT_FAILURE;    }  // there should be no process to stop  res = tester.stopDCMQRSCP();  if (res)    {    std::cerr << __LINE__              << ": Failed to stop dcmqrscp: " << qPrintable(dcmqrscp)              << " with config file:" << qPrintable(dcmqrscpConf) << std::endl;    return EXIT_FAILURE;    }  return EXIT_SUCCESS;}
 |