diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 841bfcd..77a80d3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -43,6 +43,7 @@ target_include_directories(webarkit_test PRIVATE "${build_opencv_SOURCE_DIR}/libs/opencv/modules/core/include" "${build_opencv_SOURCE_DIR}/libs/opencv/modules/features2d/include" "${build_opencv_SOURCE_DIR}/libs/opencv/modules/flann/include" + "${build_opencv_SOURCE_DIR}/libs/opencv/modules/imgcodecs/include" "${build_opencv_SOURCE_DIR}/libs/opencv/modules/imgproc/include" "${build_opencv_SOURCE_DIR}/libs/opencv/modules/video/include" "${build_opencv_SOURCE_DIR}/libs/opencv_contrib/modules/xfeatures2d/include" @@ -60,10 +61,12 @@ target_link_libraries( "${build_opencv_SOURCE_DIR}/lib/libopencv_calib3d.a" "${build_opencv_SOURCE_DIR}/lib/libopencv_features2d.a" "${build_opencv_SOURCE_DIR}/lib/libopencv_flann.a" + "${build_opencv_SOURCE_DIR}/lib/libopencv_imgcodecs.a" "${build_opencv_SOURCE_DIR}/lib/libopencv_video.a" "${build_opencv_SOURCE_DIR}/lib/libopencv_xfeatures2d.a" "${build_opencv_SOURCE_DIR}/lib/libopencv_imgproc.a" "${build_opencv_SOURCE_DIR}/lib/libopencv_core.a" + "${build_opencv_SOURCE_DIR}/3rdparty/lib/liblibopenjp2.a" "${build_opencv_SOURCE_DIR}/3rdparty/lib/libzlib.a" GTest::gtest_main ) diff --git a/tests/pinball.jpg b/tests/pinball.jpg new file mode 100644 index 0000000..d1444ad Binary files /dev/null and b/tests/pinball.jpg differ diff --git a/tests/webarkit_test.cc b/tests/webarkit_test.cc index c5640e6..7c88f64 100644 --- a/tests/webarkit_test.cc +++ b/tests/webarkit_test.cc @@ -1,6 +1,7 @@ #include #include #include +#include class WebARKitEnumTest : public testing::TestWithParam> {}; @@ -76,4 +77,31 @@ TEST(WebARKitTest, CheckWebARKitVersion) { manager.initialiseBase(webarkit::TRACKER_TYPE::AKAZE_TRACKER); // Check if the WebARKit version is correct EXPECT_STREQ(manager.getWebARKitVersion().c_str(), "1.0.0"); +} + +TEST(WebARKitTest, InitTrackerTest) { + // Create a WebARKitManager object + webarkit::WebARKitManager manager; + // Init the manager with the Akaze tracker + manager.initialiseBase(webarkit::TRACKER_TYPE::AKAZE_TRACKER); + // Load the test image + cv::Mat image = cv::imread("pinball.jpg"); + + if(image.data == NULL) { + std::cout << "Something wrong while reading the image!" << std::endl; + } + + if(image.empty()) { + image = cv::Mat(2048, 1637, CV_8UC4, cv::Scalar(0, 0, 0, 0)); + } + + ASSERT_FALSE(image.empty()); + + int width = image.cols; + int height = image.rows; + unsigned char* data = image.data; + EXPECT_EQ(image.cols, 1637); + EXPECT_EQ(image.rows, 2048); + // Check if initTracker returns sucessfully + EXPECT_TRUE(manager.initTracker(data, width, height)); } \ No newline at end of file