reflectivity/l500/test-bad-conditions.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2021 Intel Corporation. All Rights Reserved.
3 
4 //#test:tag reflectivity
5 //#test:device L500*
6 
7 #include "../../func-common.h"
8 
9 // Test group description:
10 // * This tests group verifies IR reflectivity option restrictions,
11 // according to [RS-8358].
12 //
13 // Current test description:
14 // * Enabling IR Reflectivity option while streaming require Visual Preset = 'Max Range' and Sensor Mode = 'VGA'.
15 // If not an exception should be thrown.
16 // * If Alternate IR option is on, turning on IR Reflectivity
17 // should throw an exception.
18 //
19 // Note: * L515 specific test.
20 // * Test will pass if no L515 device is connected.
21 // * Test will be performed on the first L515 device detected.
22 
23 TEST_CASE( "Reflectivity while streaming require Max Range Preset", "[reflectivity]" )
24 {
25  auto ds
27 
28  // Make sure alt IR is off
29  if( ds.supports( RS2_OPTION_ALTERNATE_IR ) )
30  ds.set_option( RS2_OPTION_ALTERNATE_IR, 0 );
31 
33  auto depth_vga_profile
35  REQUIRE( depth_vga_profile );
36 
37  ds.open( depth_vga_profile );
38  ds.start( []( rs2::frame f ) {} );
39 
40  // Verify failure
42  // Verify stay off
44 
45  ds.stop();
46  ds.close();
47 }
48 
49 
50 TEST_CASE("Reflectivity while streaming require VGA Sensor Mode", "[reflectivity]")
51 {
52  auto ds
54 
55  // Make sure alt IR is off
56  if (ds.supports(RS2_OPTION_ALTERNATE_IR))
57  ds.set_option(RS2_OPTION_ALTERNATE_IR, 0);
58 
60 
61  // Find a profile that sensor mode != VGA
62  auto profiles = ds.get_stream_profiles();
63  auto non_vga_depth_profile
64  = std::find_if(profiles.begin(), profiles.end(), [](rs2::stream_profile sp) {
65  auto vp = sp.as< rs2::video_stream_profile >();
66 
67  return ((sp.stream_type() == RS2_STREAM_DEPTH) && (sp.format() == RS2_FORMAT_Z16)
68  && (vp.width() != 640) && (vp.height() != 480));
69  });
70 
71  REQUIRE(non_vga_depth_profile != profiles.end());
72 
73  ds.open(*non_vga_depth_profile);
74  ds.start([](rs2::frame f) {});
75 
76  // Verify failure
78  // Verify stay off
80 
81  ds.stop();
82  ds.close();
83 }
84 
85 TEST_CASE("Enable IR Reflectivity when Alternate IR is on fails", "[reflectivity]")
86 {
87  auto ds
89 
90  if (!ds.supports(RS2_OPTION_ALTERNATE_IR))
91  {
92  std::cout << "Sensor not supporting alternate IR, test skipped" << std::endl;
93  exit(0);
94  }
95 
96  ds.set_option(RS2_OPTION_ALTERNATE_IR, 1.f);
97 
100 
103 }
GLdouble f
TEST_CASE("Reflectivity while streaming require Max Range Preset","[reflectivity]")
std::ostream & cout()
REQUIRE(n_callbacks==1)
rs2::depth_sensor find_first_supported_depth_sensor_or_exit(const std::string &dev_name, rs2_option opt)
Definition: func-common.h:77
#define CHECK_THROWS(...)
Definition: catch.hpp:17415
static const textual_icon exit
Definition: model-views.h:254
rs2::stream_profile get_profile_by_stream_parameters(rs2::sensor s, rs2_stream stream=RS2_STREAM_ANY, rs2_format format=RS2_FORMAT_ANY, int width=-1, int height=-1, int fps=-1, int stream_index=-1)
Definition: func-common.h:227
CHECK_FALSE(inverse(inverse(p))==p)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:11