added opencv_test_highgui
authorVadim Pisarevsky <no@email>
Wed, 1 Jun 2011 14:23:55 +0000 (14:23 +0000)
committerVadim Pisarevsky <no@email>
Wed, 1 Jun 2011 14:23:55 +0000 (14:23 +0000)
modules/highgui/CMakeLists.txt
modules/highgui/test/test_drawing.cpp
modules/highgui/test/test_gui.cpp
modules/highgui/test/test_main.cpp
modules/highgui/test/test_precomp.hpp
modules/highgui/test/test_video_io.cpp

index 8017c63..95cc3e6 100644 (file)
@@ -353,3 +353,63 @@ install(TARGETS ${the_target}
 install(FILES ${highgui_ext_hdrs}
         DESTINATION include/opencv2/highgui
         COMPONENT main)
+
+
+############################# highgui tests ################################
+
+include_directories("${CMAKE_CURRENT_SOURCE_DIR}/test"
+                    "${CMAKE_CURRENT_BINARY_DIR}")
+
+set(test_deps opencv_ts opencv_highgui)
+
+foreach(d ${test_deps})
+    if(${d} MATCHES "opencv_")
+        string(REPLACE "opencv_" "${CMAKE_CURRENT_SOURCE_DIR}/../" d_dir ${d})
+        include_directories("${d_dir}/include")
+    endif()
+endforeach()
+
+file(GLOB test_srcs "test/*.cpp")
+file(GLOB test_hdrs "test/*.h*")
+
+source_group("Src" FILES ${test_srcs})
+source_group("Include" FILES ${test_hdrs})
+
+set(the_target "opencv_test_highgui")
+
+add_executable(${the_target} ${test_srcs} ${test_hdrs})
+
+if(PCHSupport_FOUND AND USE_PRECOMPILED_HEADERS)
+    set(pch_header ${CMAKE_CURRENT_SOURCE_DIR}/test/test_precomp.hpp)
+    if(${CMAKE_GENERATOR} MATCHES "Visual*" OR ${CMAKE_GENERATOR} MATCHES "Xcode*")
+        if(${CMAKE_GENERATOR} MATCHES "Visual*")
+            set(${the_target}_pch "test/test_precomp.cpp")
+        endif()            
+        add_native_precompiled_header(${the_target} ${pch_header})
+    elseif(CMAKE_COMPILER_IS_GNUCXX AND ${CMAKE_GENERATOR} MATCHES ".*Makefiles")
+        add_precompiled_header(${the_target} ${pch_header})
+    endif()
+endif()
+
+# Additional target properties
+set_target_properties(${the_target} PROPERTIES
+    DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
+    RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}"
+    )
+       
+if(ENABLE_SOLUTION_FOLDERS)
+       set_target_properties(${the_target} PROPERTIES FOLDER "tests")
+endif()        
+
+add_dependencies(${the_target} ${test_deps})
+
+# Add the required libraries for linking:
+target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} ${test_deps})
+
+enable_testing()
+get_target_property(LOC ${the_target} LOCATION)
+add_test(${the_target} "${LOC}")
+
+if(WIN32)
+    install(TARGETS ${the_target} RUNTIME DESTINATION bin COMPONENT main)
+endif()
index 908ea41..4d9e157 100644 (file)
@@ -41,6 +41,8 @@
 
 #include "test_precomp.hpp"
 
+#if 0
+
 using namespace cv;
 
 //#define DRAW_TEST_IMAGE
@@ -408,3 +410,5 @@ int CV_DrawingTest_C::checkLineIterator( Mat& _img )
 
 CV_DrawingTest_CPP drawing_test_cpp;
 CV_DrawingTest_C drawing_test_c;
+
+#endif
index 59c0f0e..2e31ba8 100644 (file)
@@ -40,7 +40,9 @@
 //
 //M*/
 
-#include "cvtest.h"
+#include "test_precomp.hpp"
+
+#if 0
 #include <string>
 #include <iostream>
 #include <fstream>
@@ -103,5 +105,6 @@ void CV_HighGuiOnlyGuiTest::run( int /*start_from */)
 }
 
 CV_HighGuiOnlyGuiTest highGuiOnlyGui_test;
+#endif
 
 
index db32ab1..6a686e6 100644 (file)
@@ -1,2 +1,4 @@
 #include "test_precomp.hpp"
-#include "opencv2/ts/ts_main.hpp"
+
+CV_TEST_MAIN("cv")
+
index 7d837ce..91f80b0 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "opencv2/ts/ts.hpp"
 #include "opencv2/imgproc/imgproc.hpp"
-#include "opencv2/core/imgproc_c.h"
+#include "opencv2/imgproc/imgproc_c.h"
 #include <iostream>
 
 #endif
index ceb8f31..cb342a3 100644 (file)
@@ -42,6 +42,8 @@
 
 #include "test_precomp.hpp"
 
+#if 0
+
 #include <string>
 #include <iostream>
 #include <fstream>
@@ -310,3 +312,5 @@ CV_HighGuiTest HighGui_test;
 
 #endif
 
+#endif
+