YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
fakeFrameGrabber_test.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
10
11#include <yarp/os/Network.h>
12#include <yarp/sig/Image.h>
13#include <yarp/sig/Vector.h>
14#include <yarp/dev/PolyDriver.h>
15#include <yarp/os/Time.h>
16
17#include <array>
18#include <string>
19
20#include <catch2/catch_amalgamated.hpp>
21#include <harness.h>
22
23using namespace yarp::os;
24using namespace yarp::dev;
25using namespace yarp::sig;
26
27
28TEST_CASE("dev::fakeFrameGrabberTest", "[yarp::dev]")
29{
30 YARP_REQUIRE_PLUGIN("fakeFrameGrabber", "device");
31
32 Network::setLocalMode(true);
33
34 SECTION("Test the IFrameGrabberImage interface")
35 {
36 // Open the device
37 PolyDriver dd;
38 Property p;
39 p.put("device", "fakeFrameGrabber");
40 REQUIRE(dd.open(p));
41
42 // Get the IFrameGrabberImage interface
43 IFrameGrabberImage* iFrameGrabberImage = nullptr;
44 REQUIRE(dd.view(iFrameGrabberImage));
45
47
48 // Close the device
49 CHECK(dd.close());
50 }
51
52
53 SECTION("Test the IRgbVisualParams interface")
54 {
55 // Open the device
56 PolyDriver dd;
57 Property p;
58 p.put("device","fakeFrameGrabber");
59 REQUIRE(dd.open(p));
60
61 // Get the IRgbVisualParams interface
62 IRgbVisualParams* rgbParams = nullptr;
64
66
67 // Close the device
68 CHECK(dd.close()); // client close reported successful
69 }
70
71 // TODO Add tests for the other interfaces
72
73 Network::setLocalMode(false);
74}
contains the definition of a Vector type
bool view(T *&x)
Get an interface to the device driver.
An interface for retrieving intrinsic parameter from a rgb camera.
A container for a device driver.
Definition PolyDriver.h:23
bool close() override
Close the DeviceDriver.
bool open(const std::string &txt)
Construct and configure a device by its common name.
A mini-server for performing network communication in the background.
A class for storing options and configuration information.
Definition Property.h:33
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
Definition Property.cpp:987
TEST_CASE("dev::fakeFrameGrabberTest", "[yarp::dev]")
void exec_IRgbVisualParams_test_1(IRgbVisualParams *irgb)
void exec_IFrameGrabberImage_test_1(IFrameGrabberImage *iframe)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.