ctkDICOMIndexerTest1.cpp 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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.commontk.org/LICENSE
  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 <QDebug>
  17. #include <QDir>
  18. #include <QFileInfo>
  19. #include <QTreeView>
  20. #include <QSqlQuery>
  21. // ctkDICOMCore includes
  22. #include "ctkDICOMDatabase.h"
  23. #include "ctkDICOMIndexer.h"
  24. // STD includes
  25. #include <iostream>
  26. int ctkDICOMIndexerTest1( int argc, char * argv [] )
  27. {
  28. QCoreApplication app(argc, argv);
  29. ctkDICOMDatabase database;
  30. ctkDICOMIndexer indexer;
  31. // Test ctkDICOMIndexer::addDirectory()
  32. // just check if it doesn't crash
  33. indexer.addDirectory(database, QString());
  34. // might work (if there are some DCM images in temp
  35. indexer.addDirectory(database, QDir::tempPath());
  36. // give an invalid destination name
  37. indexer.addDirectory(database, QDir::tempPath(), QDir::tempPath() + "/@#$%^&*{}[]");
  38. // make sure it doesn't crash
  39. indexer.refreshDatabase(database, QString());
  40. // make sure it doesn't crash
  41. indexer.refreshDatabase(database, QDir::tempPath());
  42. return EXIT_SUCCESS;
  43. }