ctkDICOMIndexerTest1.cpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. // Qt includes
  15. #include <QCoreApplication>
  16. #include <QDir>
  17. // ctkDICOMCore includes
  18. #include "ctkDICOMDatabase.h"
  19. #include "ctkDICOMIndexer.h"
  20. // STD includes
  21. #include <iostream>
  22. int ctkDICOMIndexerTest1( int argc, char * argv [] )
  23. {
  24. QCoreApplication app(argc, argv);
  25. ctkDICOMDatabase database;
  26. ctkDICOMIndexer indexer;
  27. // Test ctkDICOMIndexer::addDirectory()
  28. // just check if it doesn't crash
  29. indexer.addDirectory(database, QString());
  30. // might work (if there are some DCM images in temp
  31. indexer.addDirectory(database, QDir::tempPath());
  32. // give an invalid destination name
  33. indexer.addDirectory(database, QDir::tempPath(), QDir::tempPath() + "/@#$%^&*{}[]");
  34. // make sure it doesn't crash
  35. indexer.refreshDatabase(database, QString());
  36. // make sure it doesn't crash
  37. indexer.refreshDatabase(database, QDir::tempPath());
  38. // ensure all concurrent inserts are complete
  39. indexer.waitForImportFinished();
  40. return EXIT_SUCCESS;
  41. }