19#include <catch2/catch_amalgamated.hpp>
22TEST_CASE(
"pm::depthimage_compression_zlibTest",
"[yarp::pm]")
24 YARP_REQUIRE_PLUGIN(
"depthimage_compression_zlib",
"portmonitor")
40 TestCase {
"fast_tcp",
false},
41 TestCase {
"fast_tcp+send.portmonitor+file.depthimage_compression_zlib+type.dll+recv.portmonitor+file.depthimage_compression_zlib+type.dll",
true}
44 SECTION(
"Test depth image compression with portmonitor: " + tc.carrier)
50 receiver.
open(
"/recv");
56 constexpr int width = 10;
57 constexpr int height = 10;
63 for (
int y = 0; y < height; y++)
65 for (
int x = 0; x < width; x++)
67 float depth_value =
static_cast<float>(x + y * width) / 10.0f;
68 img.
pixel(x, y) = depth_value;
77 REQUIRE(receivedImg !=
nullptr);
80 CHECK(receivedImg->
width() == width);
81 CHECK(receivedImg->
height() == height);
84 for (
int y = 0; y < height; y++)
86 for (
int x = 0; x < width; x++)
88 float expected_value =
static_cast<float>(x + y * width) / 10.0f;
89 float actual_value = receivedImg->
pixel(x, y);
90 CHECK(actual_value == expected_value);
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
T * read(bool shouldWait=true) override
Read an available object from the port.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::BufferedPort::write.
static Carrier * getCarrierTemplate(const std::string &name)
Get template for carrier.
static bool connect(const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true)
Request that an output port connect to an input port.
static bool setLocalMode(bool flag)
Chooses whether communication is process-local.
Utilities for manipulating the YARP network, including initialization and shutdown.
T & pixel(size_t x, size_t y)
size_t width() const
Gets width of image in pixels.
void resize(size_t imgWidth, size_t imgHeight)
Reallocate an image to be of a desired size, throwing away its current contents.
size_t height() const
Gets height of image in pixels.
TEST_CASE("pm::depthimage_compression_zlibTest", "[yarp::pm]")
void delay(double seconds)
Wait for a certain number of seconds.
The main, catch-all namespace for YARP.