diff --git a/Modules/ToFHardware/Testing/mitkToFCameraPMDPlayerControllerTest.cpp b/Modules/ToFHardware/Testing/mitkToFCameraPMDPlayerControllerTest.cpp index f571b55e58..d02b29711b 100644 --- a/Modules/ToFHardware/Testing/mitkToFCameraPMDPlayerControllerTest.cpp +++ b/Modules/ToFHardware/Testing/mitkToFCameraPMDPlayerControllerTest.cpp @@ -1,73 +1,76 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2010-03-12 14:05:50 +0100 (Fr, 12 Mrz 2010) $ Version: $Revision: 16010 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "mitkToFConfig.h" #include #include #include #include /**Documentation * test for the class "ToFCameraPMDPlayerController". */ int mitkToFCameraPMDPlayerControllerTest(int /* argc */, char* /*argv*/[]) { MITK_TEST_BEGIN("ToFCameraPMDPlayerController"); //initialize test mitk::ToFCameraPMDPlayerDevice::Pointer pmdPlayerDevice = mitk::ToFCameraPMDPlayerDevice::New(); mitk::ToFCameraPMDPlayerController::Pointer testObject = mitk::ToFCameraPMDPlayerController::New(); MITK_TEST_CONDITION_REQUIRED( !(testObject.GetPointer() == NULL),"Testing object initialization!"); MITK_TEST_CONDITION_REQUIRED( testObject->GetCaptureHeight()== 200,"Testing member variable init 1!"); MITK_TEST_CONDITION_REQUIRED( testObject->GetCaptureWidth() == 200 ,"Testing member variable init 2!"); //testing the creation of a connection without valid data MITK_TEST_CONDITION_REQUIRED( !testObject->OpenCameraConnection(),"Testing OpenConnection without valid data!"); MITK_TEST_CONDITION_REQUIRED( testObject->GetIntegrationTime() == 0, "Testing passing of integration time from PMD data!"); MITK_TEST_CONDITION_REQUIRED( testObject->GetModulationFrequency() == 0, "Testing passing of modulation frequency from PMD data!"); // set some valid data and test connecting again! TODO: Set the data to generic dir!! std::string filePath = MITK_TOF_DATA_DIR; std::string fileName = "/TestSequence.pmd"; filePath.append(fileName); pmdPlayerDevice->SetStringProperty("PMDFileName", filePath.c_str()); testObject = dynamic_cast(pmdPlayerDevice->GetController().GetPointer()); // current implementation for mitkToFCameraPMDPlayerController only works for 32 bit machines, so we need to check // the platform we are working on! std::string platformVar = MITK_TOF_PLATFORM; - if( platformVar == "W32") + if( platformVar == "W32") { - MITK_TEST_CONDITION_REQUIRED( testObject->OpenCameraConnection(),"Testing OpenConnection with valid data!"); - MITK_TEST_CONDITION_REQUIRED( !testObject->GetIntegrationTime() == 0, "Testing passing of integration time from PMD data!"); - MITK_TEST_CONDITION_REQUIRED( !testObject->GetModulationFrequency() == 0, "Testing passing of modulation frequency from PMD data!"); + if(std::string(MITK_TOF_PMDFILE_SOURCE_PLUGIN) != "") + { + MITK_TEST_CONDITION_REQUIRED( testObject->OpenCameraConnection(),"Testing OpenConnection with valid data!"); + MITK_TEST_CONDITION_REQUIRED( !testObject->GetIntegrationTime() == 0, "Testing passing of integration time from PMD data!"); + MITK_TEST_CONDITION_REQUIRED( !testObject->GetModulationFrequency() == 0, "Testing passing of modulation frequency from PMD data!") + } // testing disconnection MITK_TEST_CONDITION_REQUIRED ( testObject->CloseCameraConnection(), "Testing CloseConnection with data!"); } else { MITK_TEST_CONDITION_REQUIRED( true, "Test case skipped! Wrong platfrom configuration, no driver available!"); } // test end MITK_TEST_END(); } diff --git a/Modules/ToFHardware/Testing/mitkToFCameraPMDPlayerDeviceTest.cpp b/Modules/ToFHardware/Testing/mitkToFCameraPMDPlayerDeviceTest.cpp index 15dcb9be33..03b683ee36 100644 --- a/Modules/ToFHardware/Testing/mitkToFCameraPMDPlayerDeviceTest.cpp +++ b/Modules/ToFHardware/Testing/mitkToFCameraPMDPlayerDeviceTest.cpp @@ -1,61 +1,64 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2010-03-12 14:05:50 +0100 (Fr, 12 Mrz 2010) $ Version: $Revision: 16010 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include #include #include /**Documentation * test for the class "ToFCameraPMDPlayerDevice". */ int mitkToFCameraPMDPlayerDeviceTest(int /* argc */, char* /*argv*/[]) { MITK_TEST_BEGIN("ToFCameraPMDPlayerDevice"); std::string fileName = MITK_TOF_DATA_DIR; fileName = fileName + "/TestSequence.pmd"; mitk::ToFCameraPMDPlayerDevice::Pointer tofCameraPMDPlayerDevice = mitk::ToFCameraPMDPlayerDevice::New(); tofCameraPMDPlayerDevice->SetProperty("PMDFileName",mitk::StringProperty::New(fileName)); std::string platform = MITK_TOF_PLATFORM; // PMDPlayerController only available for W32 systems if (platform=="W32") { - MITK_TEST_CONDITION_REQUIRED(tofCameraPMDPlayerDevice->ConnectCamera(),"Test ConnectCamera()"); + if(std::string(MITK_TOF_PMDFILE_SOURCE_PLUGIN) != "") + { + MITK_TEST_CONDITION_REQUIRED(tofCameraPMDPlayerDevice->ConnectCamera(),"Test ConnectCamera()"); + } tofCameraPMDPlayerDevice->StartCamera(); tofCameraPMDPlayerDevice->UpdateCamera(); float* distances = new float[40000]; float* amplitudes = new float[40000]; float* intensities = new float[40000]; int imageSequence = 0; MITK_TEST_OUTPUT(<<"Call GetDistances()"); tofCameraPMDPlayerDevice->GetDistances(distances,imageSequence); MITK_TEST_OUTPUT(<<"Call GetAmplitudes()"); tofCameraPMDPlayerDevice->GetAmplitudes(amplitudes,imageSequence); MITK_TEST_OUTPUT(<<"Call GetIntensities()"); tofCameraPMDPlayerDevice->GetIntensities(intensities,imageSequence); tofCameraPMDPlayerDevice->StopCamera(); MITK_TEST_CONDITION_REQUIRED(tofCameraPMDPlayerDevice->DisconnectCamera(),"Test DisconnectCamera()"); delete[] distances; delete[] amplitudes; delete[] intensities; } MITK_TEST_END(); }