Skip to content

Commit

Permalink
feat:添加bitblt截图测试
Browse files Browse the repository at this point in the history
  • Loading branch information
GengGode committed Dec 11, 2023
1 parent 60a8685 commit 2cc46c1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/frame_capture_bitblt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
get_filename_component(dir_name ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(test_name test_${dir_name})
add_executable(${test_name} main.cpp)
set_property(TARGET ${test_name} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set_target_properties(${test_name} PROPERTIES FOLDER "tests")
target_link_libraries(${test_name} ${OpenCV_LIBS})
add_test(NAME ${test_name} COMMAND ${test_name})
19 changes: 19 additions & 0 deletions tests/frame_capture_bitblt/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <opencv2/opencv.hpp>
#include <Windows.h>
#include <iostream>
#include "frame/capture/capture.include.h"
#include "frame/capture/capture.bitblt.h"

int main()
{
auto capture = std::make_shared<tianli::capture::capture_bitblt>();
capture->set_handle(GetDesktopWindow());
cv::Mat frame;
capture->get_frame(frame);
if (frame.empty())
std::cout << "frame is empty" << std::endl;
else
std::cout << "frame is not empty" << std::endl;
cv::imwrite("test.png", frame);
return 0;
}

0 comments on commit 2cc46c1

Please sign in to comment.