Skip to content

Commit

Permalink
integration_tests: add test for camera capture
Browse files Browse the repository at this point in the history
  • Loading branch information
julianoes committed Nov 4, 2021
1 parent b9c76a7 commit 3e5dc4b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/integration_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ add_executable(integration_tests_runner
action_goto.cpp
action_hold.cpp
calibration.cpp
camera_capture_info.cpp
camera_mode.cpp
camera_settings.cpp
camera_status.cpp
Expand Down
37 changes: 37 additions & 0 deletions src/integration_tests/camera_capture_info.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "integration_test_helper.h"
#include "mavsdk.h"
#include <iostream>
#include <functional>
#include <atomic>
#include "plugins/camera/camera.h"

using namespace mavsdk;

TEST(CameraTest, CaptureInfo)
{
Mavsdk mavsdk;

ConnectionResult ret = mavsdk.add_udp_connection();
ASSERT_EQ(ret, ConnectionResult::Success);

// Wait for system to connect via heartbeat.
std::this_thread::sleep_for(std::chrono::seconds(2));

ASSERT_EQ(mavsdk.systems().size(), 1);

auto system = mavsdk.systems().at(0);
auto camera = Camera{system};

std::this_thread::sleep_for(std::chrono::seconds(2));

EXPECT_EQ(camera.take_photo(), Camera::Result::Success);

bool received_capture_info = false;
camera.subscribe_capture_info([&received_capture_info](Camera::CaptureInfo capture_info) {
received_capture_info = true;
LogInfo() << capture_info;
});

std::this_thread::sleep_for(std::chrono::seconds(5));
EXPECT_TRUE(received_capture_info);
}

0 comments on commit 3e5dc4b

Please sign in to comment.