Skip to content

Commit

Permalink
improved RGBDSensor_nws_yarp_test
Browse files Browse the repository at this point in the history
  • Loading branch information
randaz81 committed Sep 19, 2023
1 parent 5b6ed37 commit b2d9541
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/devices/RGBDSensorClient/tests/RGBDSensorClient_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ TEST_CASE("dev::RGBDSensorClientTest", "[yarp::dev]")
REQUIRE(result_att); }

//wait some time
yarp::os::Time::delay(0.1);
yarp::os::SystemClock::delaySystem(1.0);
INFO("rgbdSensor_nws_yarp and fakeDepthCamera ready");

//create the client
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using namespace yarp::dev;
using namespace yarp::sig;
using namespace yarp::os;

TEST_CASE("dev::Rangefinder2D_nws_yarpTest", "[yarp::dev]")
TEST_CASE("dev::rgbdSensor_nws_yarpTest", "[yarp::dev]")
{
YARP_REQUIRE_PLUGIN("fakeDepthCamera", "device");
YARP_REQUIRE_PLUGIN("rgbdSensor_nws_yarp", "device");
Expand All @@ -39,5 +39,39 @@ TEST_CASE("dev::Rangefinder2D_nws_yarpTest", "[yarp::dev]")
CHECK(nws_driver.close());
}

SECTION("Test the rgbdSensor_nws_yarp device with fakeDepthCamera device attached")
{
PolyDriver dd_fake;
PolyDriver dd_nws;
Property p_fake;
Property p_nws;

//open
p_nws.put("device", "rgbdSensor_nws_yarp");
p_nws.put("name", "/rgbd_nws");
p_fake.put("device", "fakeDepthCamera");
REQUIRE(dd_fake.open(p_fake));
REQUIRE(dd_nws.open(p_nws));

yarp::os::SystemClock::delaySystem(0.5);

//attach
{
yarp::dev::WrapperSingle* ww_nws; dd_nws.view(ww_nws);
REQUIRE(ww_nws);
bool result_att = ww_nws->attach(&dd_fake);
REQUIRE(result_att);
}

//Wait some time
yarp::os::SystemClock::delaySystem(1.0);

//Close all polydrivers and check
{
CHECK(dd_nws.close());
CHECK(dd_fake.close());
}
}

Network::setLocalMode(false);
}

0 comments on commit b2d9541

Please sign in to comment.