Skip to content

Improved gtests#20

Merged
kalwalt merged 9 commits intodevfrom
improved-gtests
Oct 25, 2023
Merged

Improved gtests#20
kalwalt merged 9 commits intodevfrom
improved-gtests

Conversation

@kalwalt
Copy link
Copy Markdown
Member

@kalwalt kalwalt commented Oct 24, 2023

More gtest to WebARKit code...
List of tests implemented:

  • tests for enums (webarkit::TRACKER_TYPE and webarkit::ColorSpace)
  • tests for config values inside WebARKitConfig.cpp
  • tests for manager.initialiseBase for all types of trackers.
  • test for manager.initTracker (with the Akaze tracker)
  • test for manager.shutdown

@kalwalt kalwalt added enhancement New feature or request C/C++ code concerning the C/C++ code design and improvements labels Oct 24, 2023
@kalwalt kalwalt self-assigned this Oct 24, 2023
@kalwalt
Copy link
Copy Markdown
Member Author

kalwalt commented Oct 24, 2023

I would test the initTracker function in this way:

// other headers
#include <opencv2/imgcodecs.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/opencv.hpp>

// other tests...

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");
  int width = image.cols;
  int height = image.rows;
  unsigned char* data = image.data;
  // Check if initTracker returns sucessfully
  EXPECT_TRUE(manager.initTracker(data, width, height));
}

but i need to provide the necessary opencv headers and libs with openc-em. I will do this first.

@kalwalt
Copy link
Copy Markdown
Member Author

kalwalt commented Oct 24, 2023

i didn't include the openjpeg static lib in the final opencv-em compilation, i will fix this soon.

PostEdit: no it's included even if WITH_JPEG=OFF

- new opencv-em version 0.1.3
@kalwalt
Copy link
Copy Markdown
Member Author

kalwalt commented Oct 25, 2023

with the latest commit tests are passing but cv::imread function can not read the jpeg image, so i developed a workaround providing a fake image only to test the initTracker function. Obviously it's not correct but it's enough to pass this test.
Maybe there is another solution instead of providing opencv includes and libs links (specifying exactly the links...), that is install opencv in the preferred path:

# in opencv/build
cmake .. -dcmake_install_prefix=/home/user/path/to/deps/
cmake --build . --target install

then, configure your project with the same prefix:

# in your project/build
cmake .. -dcmake_prefix_path=/home/user/path/to/deps/

in your cmake files, simply use find_package(opencv)

Another solution is to develop our Docker image with all inside...

- test for manager shutdown
@kalwalt kalwalt merged commit 18fcf1f into dev Oct 25, 2023
@kalwalt kalwalt deleted the improved-gtests branch June 6, 2024 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C/C++ code concerning the C/C++ code design and improvements enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant