Parcourir la source

Cleanup header files for DICOM Core unit tests

Don't use QApplication when a QCoreApplication is enough.
Julien Finet il y a 14 ans
Parent
commit
6b78853126

+ 22 - 8
Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatabaseTest1.cpp

@@ -1,6 +1,25 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
 
 // Qt includes
-#include <QApplication>
+#include <QCoreApplication>
 #include <QDir>
 #include <QTimer>
 
@@ -13,7 +32,7 @@
 
 int ctkDICOMDatabaseTest1( int argc, char * argv [] )
 {
-  QApplication app(argc, argv);
+  QCoreApplication app(argc, argv);
 
   ctkDICOMDatabase database;
   QDir databaseDirectory = QDir::temp();
@@ -73,10 +92,5 @@ int ctkDICOMDatabaseTest1( int argc, char * argv [] )
   database.closeDatabase();
   database.initializeDatabase();
 
-  if (argc <= 1 || QString(argv[1]) != "-I")
-    {
-    QTimer::singleShot(200, &app, SLOT(quit()));
-    }
-
-  return app.exec();
+  return EXIT_SUCCESS;
 }

+ 18 - 4
Libs/DICOM/Core/Testing/Cpp/ctkDICOMDatasetTest1.cpp

@@ -1,8 +1,22 @@
+/*=========================================================================
 
-// Qt includes
-#include <QApplication>
-#include <QDir>
-#include <QTimer>
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
 
 // ctkDICOMCore includes
 #include "ctkDICOMDataset.h"

+ 21 - 2
Libs/DICOM/Core/Testing/Cpp/ctkDICOMIndexerTest1.cpp

@@ -1,6 +1,25 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
 
 // Qt includes
-#include <QApplication>
+#include <QCoreApplication>
 #include <QDebug>
 #include <QDir>
 #include <QFileInfo>
@@ -16,7 +35,7 @@
 
 int ctkDICOMIndexerTest1( int argc, char * argv [] )
 {
-  QApplication app(argc, argv);
+  QCoreApplication app(argc, argv);
   
   ctkDICOMDatabase database;
   ctkDICOMIndexer indexer;

+ 19 - 0
Libs/DICOM/Core/Testing/Cpp/ctkDICOMModelTest1.cpp

@@ -1,3 +1,22 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
 
 // Qt includes
 #include <QApplication>

+ 21 - 3
Libs/DICOM/Core/Testing/Cpp/ctkDICOMPersonNameTest1.cpp

@@ -1,7 +1,25 @@
+/*=========================================================================
+
+  Library:   CTK
+
+  Copyright (c) Kitware Inc.
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.commontk.org/LICENSE
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+
+=========================================================================*/
 
 // Qt includes
-#include <QApplication>
-#include <QDir>
+#include <QCoreApplication>
 #include <QTimer>
 
 // ctkDICOMCore includes
@@ -13,7 +31,7 @@
 
 int ctkDICOMPersonNameTest1( int argc, char * argv [] )
 {
-  QApplication app(argc, argv);
+  QCoreApplication app(argc, argv);
 
   ctkDICOMPersonName personName("lastName", "firstName", "middleName", "namePrefix", "nameSuffix");
   if (personName.lastName() != "lastName")

+ 2 - 2
Libs/DICOM/Core/Testing/Cpp/ctkDICOMTest1.cpp

@@ -1,7 +1,7 @@
 
 // Qt includes
+#include <QCoreApplication>
 #include <QTextStream>
-#include <QApplication>
 
 // ctkDICOMCore includes
 #include "ctkDICOMDatabase.h"
@@ -12,7 +12,7 @@
 
 int ctkDICOMTest1(int argc, char * argv []) {
   
-  QApplication app(argc, argv);
+  QCoreApplication app(argc, argv);
   QTextStream out(stdout);
   try
   {