ctkDICOMTesterTest1.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Qt includes
  2. #include <QCoreApplication>
  3. // ctkDICOMCore includes
  4. #include "ctkDICOMTester.h"
  5. // STD includes
  6. #include <iostream>
  7. #include <cstdlib>
  8. void printUsage()
  9. {
  10. std::cout << " ctkDICOMTesterTest1 [<dcmqrscp>] [<configfile>]" << std::endl;
  11. }
  12. int ctkDICOMTesterTest1(int argc, char * argv [])
  13. {
  14. QCoreApplication app(argc, argv);
  15. ctkDICOMTester tester;
  16. if (argc > 1)
  17. {
  18. tester.setDCMQRSCPExecutable(argv[1]);
  19. }
  20. if (argc > 2)
  21. {
  22. tester.setDCMQRSCPConfigFile(argv[2]);
  23. }
  24. QProcess* process = tester.startDCMQRSCP();
  25. if (!process)
  26. {
  27. std::cerr << "Failed to start dcmqrscp" << argv[1] << " with config file:"
  28. << argv[2] << std::endl;
  29. return EXIT_FAILURE;
  30. }
  31. tester.stopDCMQRSCP();
  32. QProcess* process2 = tester.startDCMQRSCP();
  33. if (!process2 || process2 == process)
  34. {
  35. std::cerr << "Failed to start dcmqrscp" << argv[1] << " with config file:"
  36. << argv[2] << std::endl;
  37. return EXIT_FAILURE;
  38. }
  39. QProcess* process3 = tester.startDCMQRSCP();
  40. if (!process3 || process3 != process2)
  41. {
  42. std::cerr << "Failed to start dcmqrscp" << argv[1] << " with config file:"
  43. << argv[2] << std::endl;
  44. return EXIT_FAILURE;
  45. }
  46. tester.stopDCMQRSCP();
  47. tester.stopDCMQRSCP();
  48. return EXIT_SUCCESS;
  49. }