8 #if !defined(MAKEFILE) || ( defined(LR200_TEST) || defined(R200_TEST) || defined(ZR300_TEST) ) 10 #define CATCH_CONFIG_MAIN 26 #define NOEXCEPT_FALSE 28 #define NOEXCEPT_FALSE noexcept(false) 32 TEST_CASE(
"DS-dev metadata enumerates correctly",
"[live] [DS-device]")
40 for (
int i = 0; i<device_count; ++i)
45 SECTION(
"device name identification ")
50 if (b) std::cout <<
"Camera type " <<
s << std::endl;
54 SECTION(
"device serial number has ten decimal digits")
58 for (
int i = 0; i<10; ++i)
REQUIRE(isdigit(serial[i]));
63 TEST_CASE(
"DS-device devices support all required options",
"[live] [DS-device]")
71 for (
int i = 0; i<device_count; ++i)
76 SECTION(
"device supports standard picture options and DS-device extension options")
80 const int supported_options[] = {
118 std::stringstream ss;
122 INFO(ss.str().c_str());
123 if (std::find(std::begin(supported_options),
std::end(supported_options), i) !=
std::end(supported_options))
133 TEST_CASE(
"DS-device head content verification",
"[live] [DS-device]")
140 std::vector<std::string> invalid_keywords = {
"",
"N/A" };
142 for (
int i = 0; i<device_count; ++i)
147 SECTION(
"device supports standard picture options and DS-device extension options")
155 REQUIRE(std::none_of(invalid_keywords.begin(), invalid_keywords.end(), [&](
std::string const&
s) {
return s ==
val; }));
172 TEST_CASE(
"DS-device device extrinsics are within expected parameters",
"[live] [DS-device]")
180 for (
int i = 0; i<device_count; ++i)
185 SECTION(
"no extrinsic transformation between DEPTH and INFRARED")
194 SECTION(
"only x-axis translation (~70 mm) between DEPTH and INFRARED2")
206 SECTION(
"only translation between DEPTH and RECTIFIED_COLOR")
214 SECTION(
"depth scale is 0.001 (by default)")
221 TEST_CASE(
"DS-device infrared2 streaming modes exactly match infrared streaming modes",
"[live] [DS-device]")
229 for (
int i = 0; i<device_count; ++i)
236 REQUIRE(infrared_mode_count > 0);
240 for (
int j = 0; j<infrared_mode_count; ++j)
243 int infrared_width = 0, infrared_height = 0, infrared_framerate = 0;
rs_format infrared_format =
RS_FORMAT_ANY;
246 int infrared2_width = 0, infrared2_height = 0, infrared2_framerate = 0;
rs_format infrared2_format =
RS_FORMAT_ANY;
249 REQUIRE(infrared_width == infrared2_width);
250 REQUIRE(infrared_height == infrared2_height);
251 REQUIRE(infrared_format == infrared2_format);
252 REQUIRE(infrared_framerate == infrared2_framerate);
285 TEST_CASE(
"DS-device streams 480x360 depth",
"[live] [DS-device] [one-camera]")
290 TEST_CASE(
"DS-device streams 628x468 depth",
"[live] [DS-device] [one-camera]")
295 TEST_CASE(
"DS-device streams 320x240 depth",
"[live] [DS-device] [one-camera]")
300 TEST_CASE(
"DS-device streams 480x360 depth (30 fps)",
"[live] [DS-device] [one-camera]")
305 TEST_CASE(
"DS-device streams 628x468 depth (30 fps)",
"[live] [DS-device] [one-camera]")
310 TEST_CASE(
"DS-device streams 320x240 depth (30 fps)",
"[live] [DS-device] [one-camera]")
315 TEST_CASE(
"DS-device streams 480x360 depth (90 fps)",
"[live] [DS-device] [one-camera]")
320 TEST_CASE(
"DS-device streams 628x468 depth (90 fps)",
"[live] [DS-device] [one-camera]")
325 TEST_CASE(
"DS-device streams 320x240 depth (90 fps)",
"[live] [DS-device] [one-camera]")
334 TEST_CASE(
"DS-device streams HD color",
"[live] [DS-device] [one-camera]")
339 TEST_CASE(
"DS-device streams VGA color",
"[live] [DS-device] [one-camera]")
344 TEST_CASE(
"DS-device streams VGA color (60 fps)",
"[live] [DS-device] [one-camera]")
349 TEST_CASE(
"DS-device streams 480x360 depth and HD color",
"[live] [DS-device] [one-camera]")
355 TEST_CASE(
"DS-device streams 628x468 depth and HD color",
"[live] [DS-device] [one-camera]")
361 TEST_CASE(
"DS-device streams 320x240 depth and HD color",
"[live] [DS-device] [one-camera]")
367 TEST_CASE(
"DS-device streams 480x360 depth and VGA color",
"[live] [DS-device] [one-camera]")
373 TEST_CASE(
"DS-device streams 628x468 depth and VGA color",
"[live] [DS-device] [one-camera]")
379 TEST_CASE(
"DS-device streams 320x240 depth and VGA color",
"[live] [DS-device] [one-camera]")
385 TEST_CASE(
"DS-device streams 480x360 depth and VGA color (60 fps)",
"[live] [DS-device] [one-camera]")
396 TEST_CASE(
"DS-device streams 640x480 infrared (left 8 bit)",
"[live] [DS-device] [one-camera]")
401 TEST_CASE(
"DS-device streams 640x480 infrared (left 16 bit)",
"[live] [DS-device] [one-camera]")
406 TEST_CASE(
"DS-device streams 640x480 infrared (right 8 bit)",
"[live] [DS-device] [one-camera]")
411 TEST_CASE(
"DS-device streams 640x480 infrared (right 16 bit)",
"[live] [DS-device] [one-camera]")
416 TEST_CASE(
"DS-device streams 640x480 infrared (left+right 8 bit)",
"[live] [DS-device] [one-camera]")
422 TEST_CASE(
"DS-device streams 640x480 infrared (left+right 16 bit)",
"[live] [DS-device] [one-camera]")
428 TEST_CASE(
"DS-device streams 480x360 depth and 492x372 infrared (left+right 16 bit)",
"[live] [DS-device] [one-camera]")
435 TEST_CASE(
"DS-device streams 480x360 depth, VGA color, and 492x372 infrared",
"[live] [DS-device] [one-camera]")
443 TEST_CASE(
"DS-device streams 628x468 depth, VGA color, and 640x480 infrared",
"[live] [DS-device] [one-camera]")
451 TEST_CASE(
"DS-device streams 320x240 depth, VGA color, and 332x252 infrared",
"[live] [DS-device] [one-camera]")
463 TEST_CASE(
"DS-device streams 640x480 depth and infrared",
"[live] [DS-device] [one-camera]")
470 TEST_CASE(
"DS-device streams 628x468 depth and infrared",
"[live] [DS-device] [one-camera]")
477 TEST_CASE(
"DS-device streams 492x372 depth and infrared",
"[live] [DS-device] [one-camera]")
484 TEST_CASE(
"DS-device streams 480x360 depth and infrared",
"[live] [DS-device] [one-camera]")
491 TEST_CASE(
"DS-device streams 332x252 depth and infrared",
"[live] [DS-device] [one-camera]")
498 TEST_CASE(
"DS-device streams 320x240 depth and infrared",
"[live] [DS-device] [one-camera]")
510 TEST_CASE(
"DS-device supports RS_OPTION_R200_LR_AUTO_EXPOSURE_ENABLED",
"[live] [DS-device]")
515 TEST_CASE(
"DS-device RGB White Balance",
"[live] [DS-device] [one-camera]")
521 TEST_CASE(
"DS-device supports RS_OPTION_R200_LR_GAIN",
"[live] [DS-device]")
526 TEST_CASE(
"DS-device supports RS_OPTION_R200_LR_EXPOSURE",
"[live] [DS-device]")
535 TEST_CASE(
"DS-device emitter defaults to off if depth is not enabled/streamed",
"[live] [DS-device]")
560 TEST_CASE(
"DS-device emitter defaults to on if depth is enabled/streamed",
"[live] [DS-device]")
582 TEST_CASE(
"DS-device emitter can be enabled even if depth is not enabled/streamed",
"[live] [DS-device]")
610 TEST_CASE(
"DS-device emitter can be turned off even if depth is enabled/streamed",
"[live] [DS-device]")
636 TEST_CASE(
"DS-device emitter can be turned on and off after streaming has begun",
"[live] [DS-device]")
660 TEST_CASE(
"DS-device supports RS_OPTION_R200_DEPTH_UNITS",
"[live] [DS-device]")
673 for (
int value : {100, 500, 1000, 2000, 10000})
682 TEST_CASE(
"DS-device supports RS_OPTION_R200_DEPTH_CLAMP_MIN",
"[live] [DS-device]")
687 TEST_CASE(
"DS-device supports RS_OPTION_R200_DEPTH_CLAMP_MAX",
"[live] [DS-device]")
692 TEST_CASE(
"DS-device verify standard UVC Controls set/get",
"[live] [DS-device]")
714 std::this_thread::sleep_for(std::chrono::milliseconds(1000));
721 std::vector<double> initial_values;
722 std::vector<double> modified_values;
723 std::vector<double> verification_values;
724 for (
int i=first; i<= last; i++)
727 initial_values.resize(test_options.size());
728 modified_values.resize(test_options.size());
729 verification_values.resize(test_options.size());
736 double min=0, max=0, step=0;
737 for (
int i=first; i<= last; i++)
740 if (initial_values[i] == max)
741 modified_values[i] = initial_values[i]- step;
743 modified_values[i] = initial_values[i]+ step;
748 std::this_thread::sleep_for(std::chrono::milliseconds(500));
755 for (
int i=first; i<= last; i++)
757 #if defined(_WINDOWS) || defined(WIN32) || defined(WIN64) 762 REQUIRE(modified_values[i]!=initial_values[i]);
763 REQUIRE(modified_values[i]==verification_values[i]);
773 TEST_CASE(
"a single DS-device can stream a variety of reasonable streaming mode combinations",
"[live] [DS-device] [one-camera]")
777 SECTION(
"exactly one device is connected")
786 SECTION(
"device name identification ")
791 if (b) std::cout <<
"Camera type " <<
s << std::endl;
795 SECTION(
"streaming is possible in some reasonable configurations")
797 SECTION(
"streaming DEPTH 480, 360, RS_FORMAT_Z16, 60")
804 SECTION(
"streaming [DEPTH,480,360,Z16,60] [COLOR,480,360,RGB8,60]")
812 SECTION(
"streaming [DEPTH,480,360,Z16,60] [IR,480,360,Y8,60]")
820 SECTION(
"streaming [IR,492,372,Y16,60] [IR2,492,372,Y16,60]")
828 SECTION(
"streaming [DEPTH,480,360,Z16,60] [COLOR,640,480,RGB8,60] [IR,480,360,Y8,60] [IR2,480,360,Y8,60]")
840 TEST_CASE(
"streaming five configurations sequentionally",
"[live] [DS-device] [one-camera]")
844 SECTION(
"exactly one device is connected")
856 if (b) std::cout <<
"Camera type " <<
s << std::endl;
void rs_get_stream_intrinsics(const rs_device *device, rs_stream stream, rs_intrinsics *intrin, rs_error **error)
Retrieves intrinsic camera parameters for a specific stream.
const char * rs_camera_info_to_string(rs_camera_info info)
int rs_get_device_count(const rs_context *context, rs_error **error)
Determines number of connected devices.
void rs_get_device_options(rs_device *device, const rs_option *options, unsigned int count, double *values, rs_error **error)
Efficiently retrieves the value of an arbitrary number of options, using minimal hardware IO...
void rs_set_device_options(rs_device *device, const rs_option *options, unsigned int count, const double *values, rs_error **error)
Efficiently sets the value of an arbitrary number of options, using minimal hardware IO...
GLsizei const GLchar *const * string
void rs_set_device_option(rs_device *device, rs_option option, double value, rs_error **error)
Sets the current value of a single option.
const char * rs_get_device_name(const rs_device *device, rs_error **error)
Retrieves human-readable device model string.
rs_option
Defines general configuration controls.
float rs_get_device_depth_scale(const rs_device *device, rs_error **error)
Retrieves mapping between the units of the depth image and meters.
void test_ds_device_streaming(std::initializer_list< stream_mode > modes)
void require_zero_vector(const float(&vector)[3])
void rs_get_stream_mode(const rs_device *device, rs_stream stream, int index, int *width, int *height, rs_format *format, int *framerate, rs_error **error)
Determines the properties of a specific streaming mode.
int rs_get_stream_mode_count(const rs_device *device, rs_stream stream, rs_error **error)
Determines the number of streaming modes available for a given stream.
rs_format rs_get_stream_format(const rs_device *device, rs_stream stream, rs_error **error)
Retrieves the pixel format for a specific stream.
double rs_get_device_option(rs_device *device, rs_option option, rs_error **error)
Retrieves the current value of a single option.
void rs_get_device_extrinsics(const rs_device *device, rs_stream from_stream, rs_stream to_stream, rs_extrinsics *extrin, rs_error **error)
Retrieves extrinsic transformation between the viewpoints of two different streams.
rs_camera_info
Read-only strings that can be queried from the device.
int rs_device_supports_option(const rs_device *device, rs_option option, rs_error **error)
Determines if the device allows a specific option to be queried and set.
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
void test_streaming(rs_device *device, std::initializer_list< stream_mode > modes)
void rs_enable_stream(rs_device *device, rs_stream stream, int width, int height, rs_format format, int framerate, rs_error **error)
Enables a specific stream and requests specific properties.
rs_format
Formats: defines how each stream can be encoded.
const char * rs_get_device_info(const rs_device *device, rs_camera_info info, rs_error **error)
Retrieves camera specific information, such as versions of various internal componnents.
int rs_supports_camera_info(rs_device *device, rs_camera_info info_param, rs_error **error)
Returns true if given camera information parameter is supported by the device.
GLsizei const GLfloat * value
void require_identity_matrix(const float(&matrix)[9])
GLboolean GLboolean GLboolean b
Cross-stream extrinsics: encode the topology describing how the different devices are connected...
void rs_get_device_option_range(rs_device *device, rs_option option, double *min, double *max, double *step, rs_error **error)
Retrieves the available range of values for a supported option.
void test_options(rs_device *device, rs_option *option_list, size_t options, std::vector< double > good_values, std::vector< double > bad_values, std::vector< double > &ret_values, const std::string &expected_success_msg, const std::string &expected_error_msg, bool bWrite)
int rs_get_stream_framerate(const rs_device *device, rs_stream stream, rs_error **error)
Retrieves the frame rate for a specific stream.
const char * rs_option_to_string(rs_option option)
TEST_CASE("DS-dev metadata enumerates correctly","[live] [DS-device]")
rs_device * rs_get_device(rs_context *context, int index, rs_error **error)
Retrieves connected device by index.
const char * rs_get_device_serial(const rs_device *device, rs_error **error)
Retrieves unique serial number of the device.
void rs_enable_stream_preset(rs_device *device, rs_stream stream, rs_preset preset, rs_error **error)
Enables a specific stream and requests properties using a preset.
#define SECTION(name, description)
void rs_start_device(rs_device *device, rs_error **error)
Begins streaming on all enabled streams for this device.
void rs_stop_device(rs_device *device, rs_error **error)
Ends data acquisition for the specified source providers.
void test_ds_device_option(rs_option option, std::initializer_list< int > values, std::initializer_list< int > bad_values, int when)
static const std::vector< std::string > ds_names