ctkDICOMIndexerTest1.cpp 958 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Qt includes
  2. #include <QApplication>
  3. #include <QDebug>
  4. #include <QDir>
  5. #include <QFileInfo>
  6. #include <QTreeView>
  7. #include <QSqlQuery>
  8. // ctkDICOMCore includes
  9. #include "ctkDICOMDatabase.h"
  10. #include "ctkDICOMIndexer.h"
  11. // STD includes
  12. #include <iostream>
  13. int ctkDICOMIndexerTest1( int argc, char * argv [] )
  14. {
  15. QApplication app(argc, argv);
  16. ctkDICOMDatabase database;
  17. ctkDICOMIndexer indexer;
  18. // Test ctkDICOMIndexer::addDirectory()
  19. // just check if it doesn't crash
  20. indexer.addDirectory(database, QString());
  21. // might work (if there are some DCM images in temp
  22. indexer.addDirectory(database, QDir::tempPath());
  23. // give an invalid destination name
  24. indexer.addDirectory(database, QDir::tempPath(), QDir::tempPath() + "/@#$%^&*{}[]");
  25. // make sure it doesn't crash
  26. indexer.refreshDatabase(database, QString());
  27. // make sure it doesn't crash
  28. indexer.refreshDatabase(database, QDir::tempPath());
  29. return EXIT_SUCCESS;
  30. }