diff --git a/src/devices/RGBDSensorClient/tests/RGBDSensorClient_test.cpp b/src/devices/RGBDSensorClient/tests/RGBDSensorClient_test.cpp index cfd71761b4..34307df369 100644 --- a/src/devices/RGBDSensorClient/tests/RGBDSensorClient_test.cpp +++ b/src/devices/RGBDSensorClient/tests/RGBDSensorClient_test.cpp @@ -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 { diff --git a/src/devices/RGBDSensor_nws_yarp/tests/RGBDSensor_nws_yarp_test.cpp b/src/devices/RGBDSensor_nws_yarp/tests/RGBDSensor_nws_yarp_test.cpp index 08a7f6c7da..f93c687a6f 100644 --- a/src/devices/RGBDSensor_nws_yarp/tests/RGBDSensor_nws_yarp_test.cpp +++ b/src/devices/RGBDSensor_nws_yarp/tests/RGBDSensor_nws_yarp_test.cpp @@ -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"); @@ -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); }