reflectivity/l500/test-dependencies.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 // * While not streaming, activating IR Reflectivity option should make sure the visual preset is 'Max Range' and the sensor mode is 'VGA',
15 // if it is not it will set the visual preset to max range and the sensor mode to 'VGA'.
16 // * Starting non VGA stream when IR Reflectivity is on, turns it off.
17 // * Activating IR Reflectivity while Max Usable Range is off
18 // should turn on Max Usable Range option.
19 // If the MUR option was turned on by activating IR Reflectivity,
20 // Turning off IR Reflectivity should turn off MUR option.
21 // * If MUR option was already on when IR Reflectivity was turned on,
22 // turning off IR Reflectivity should not turn off MUR option.
23 // * While streaming, Activating IR Reflectivity while Max Usable Range is off
24 // should turn on Max Usable Range option.
25 // If the MUR option was turned on by activating IR Reflectivity,
26 // Turning off IR Reflectivity should turn off MUR option.
27 // * Verify turning off MUR option turns off IR Reflectivity option,
28 // Reflectivity require MUR to be on otherwise it can't work.
29 //
30 // Note: * L515 specific test
31 // * Test will pass if no L515 device is connected.
32 // * Test will be performed on the first L515 device detected.
33 
34 TEST_CASE( "IR Reflectivity option change visual preset and sensor mode if not streaming", "[reflectivity]" )
35 {
36  auto ds
38 
39  // Verify alt IR is off
40  if( ds.supports( RS2_OPTION_ALTERNATE_IR ) )
41  ds.set_option( RS2_OPTION_ALTERNATE_IR, 0 );
42 
48 }
49 
50 TEST_CASE("Starting streaming non VGA sensor mode turns off IR Reflectivity", "[reflectivity]")
51 {
52  auto ds
54 
55  // Verify alt IR is off
56  if (ds.supports(RS2_OPTION_ALTERNATE_IR))
57  ds.set_option(RS2_OPTION_ALTERNATE_IR, 0);
58 
61 
62  // Verify activating IR Reflectivity
65 
66 
67  auto profiles = ds.get_stream_profiles();
68  // Find a profile that sensor mode != VGA
69  auto non_vga_depth_profile
70  = std::find_if(profiles.begin(), profiles.end(), [](rs2::stream_profile sp) {
71  auto vp = sp.as< rs2::video_stream_profile >();
72 
73  return ((sp.stream_type() == RS2_STREAM_DEPTH) && (sp.format() == RS2_FORMAT_Z16)
74  && (vp.width() != 640) && (vp.height() != 480));
75  });
76 
77  REQUIRE(non_vga_depth_profile != profiles.end());
78  ds.open(*non_vga_depth_profile);
79  ds.start([](rs2::frame f) {});
80 
81  // Verify turned off
83 
84  ds.stop();
85  ds.close();
86 }
87 
88 TEST_CASE("Automatically turn on MUR option - non streaming", "[reflectivity]")
89 {
90  auto ds
92 
93  // Verify alt IR is off
94  if (ds.supports(RS2_OPTION_ALTERNATE_IR))
95  ds.set_option(RS2_OPTION_ALTERNATE_IR, 0);
96 
100  // Verify automatically turn on of MUR option
104 
105  // Verify automatically turn off of MUR option
109 
110  // Turn on MUR
112 
116 
119  // Verify MUR stays on
121 }
122 
123 
124 TEST_CASE("Automatically turn on/off MUR option - streaming", "[reflectivity]")
125 {
126  auto ds
128 
129  // Verify alt IR is off
130  if (ds.supports(RS2_OPTION_ALTERNATE_IR))
131  ds.set_option(RS2_OPTION_ALTERNATE_IR, 0);
132 
136 
137  auto depth_vga_profile
139 
140  REQUIRE(depth_vga_profile);
141 
142  ds.open(depth_vga_profile);
143  ds.start([](rs2::frame f) {});
144 
145  // Verify automatically turn on of MUR option
149 
150  // Verify automatically turn off of MUR option
154 
155  // Turn on MUR
157 
161 
164  // Verify MUR stays on
166 
167  ds.stop();
168  ds.close();
169 }
170 
171 TEST_CASE("Turning off MUR option turns off IR Reflectivity", "[reflectivity]")
172 {
173  auto depth_sensor
176  REQUIRE(mur);
178 
179  // Verify alt IR is off before enabling IR Reflectivity
180  if (mur.supports(RS2_OPTION_ALTERNATE_IR))
181  mur.set_option(RS2_OPTION_ALTERNATE_IR, 0);
182 
183  auto depth_vga_profile
185 
186  REQUIRE(depth_vga_profile);
187 
188  // Check while not streaming
189  mur.set_option(RS2_OPTION_ENABLE_MAX_USABLE_RANGE, 1.f);
190  mur.set_option(RS2_OPTION_ENABLE_IR_REFLECTIVITY, 1.f);
191  CHECK(mur.get_option(RS2_OPTION_ENABLE_IR_REFLECTIVITY));
192  mur.set_option(RS2_OPTION_ENABLE_MAX_USABLE_RANGE, 0);
194 
195  mur.open(depth_vga_profile);
196  mur.start([](rs2::frame f) {});
197 
198  // Check while streaming
199  mur.set_option(RS2_OPTION_ENABLE_MAX_USABLE_RANGE, 1.f);
200  mur.set_option(RS2_OPTION_ENABLE_IR_REFLECTIVITY, 1.f);
201  CHECK(mur.get_option(RS2_OPTION_ENABLE_IR_REFLECTIVITY));
202  mur.set_option(RS2_OPTION_ENABLE_MAX_USABLE_RANGE, 0);
204 
205  mur.stop();
206  mur.close();
207 }
GLdouble f
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
T as() const
Definition: rs_sensor.hpp:333
#define CHECK_NOTHROW(...)
Definition: catch.hpp:17421
TEST_CASE("IR Reflectivity option change visual preset and sensor mode if not streaming","[reflectivity]")
#define CHECK(condition)
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