mur/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 max-usable-range
5 //#test:device L500*
6 
7 #include "../../func-common.h"
8 
9 // Test group description:
10 // * This tests group verifies depth sensor max usable range option restrictions,
11 // according to [RS-8358]
12 //
13 // Current test description:
14 // * Enabling Max Usable Range option while streaming require Visual Preset = 'Max Range' ,
15 // If not an exception should be thrown
16 // * Enabling Max Usable Range option while streaming require Sensor Mode = 'VGA'
17 // If not an exception should be thrown
18 // * Reading Max Usable Range while Max Usable Range option is off or not streaming - expect exception thrown
19 //
20 // Note: * L515 specific test
21 // * Test will pass if no L515 device is connected
22 // * Test will be performed on the first L515 device detected.
23 
24 TEST_CASE( "Max Usable Range option require Max Range Preset while streaming",
25  "[max-usable-range]" )
26 {
27  auto depth_sensor
30  REQUIRE(mur);
32  auto depth_vga_profile
34 
35  REQUIRE( depth_vga_profile );
36 
37  mur.open( depth_vga_profile );
38  mur.start( []( rs2::frame f ) {} );
39  // Verify failure when visual preset != Max Range
40  CHECK_THROWS( mur.set_option( RS2_OPTION_ENABLE_MAX_USABLE_RANGE, 1.f ) );
41  // Verify stay off
43 
44  mur.stop();
45  mur.close();
46 }
47 
48 TEST_CASE("Max Usable Range option require VGA sensor mode while streaming", "[max-usable-range]")
49 {
50  auto depth_sensor
53  REQUIRE(mur);
55  auto profiles = mur.get_stream_profiles();
56  // Find a profile that sensor mode != VGA
57  auto non_vga_depth_profile
58  = std::find_if(profiles.begin(), profiles.end(), [](rs2::stream_profile sp) {
59  auto vp = sp.as< rs2::video_stream_profile >();
60 
61  return ((sp.stream_type() == RS2_STREAM_DEPTH) && (sp.format() == RS2_FORMAT_Z16)
62  && (vp.width() != 640) && (vp.height() != 480));
63  });
64 
65  REQUIRE(non_vga_depth_profile != profiles.end());
66  mur.open(*non_vga_depth_profile);
67 
68  mur.start([](rs2::frame f) {});
69  // Verify failure when sensor mode != VGA
71  // Verify stay off
73 
74  mur.stop();
75  mur.close();
76 }
77 
78 TEST_CASE("Reading Max Usable Range while option is off or not streaming", "[max-usable-range]")
79 {
80  auto depth_sensor
83  REQUIRE(mur);
84  auto depth_vga_profile
86 
87  REQUIRE(depth_vga_profile);
88 
89  mur.open(depth_vga_profile);
90  mur.start([](rs2::frame f) {});
91 
92  // Verify MUR option is off
93  mur.set_option(RS2_OPTION_ENABLE_MAX_USABLE_RANGE, 0);
94 
95  // Verify function throws when MUR option is off
96  CHECK_THROWS(mur.get_max_usable_depth_range());
97 
98  mur.stop();
99  mur.close();
100 
101  // Turn on MUR option
102  mur.set_option(RS2_OPTION_ENABLE_MAX_USABLE_RANGE, 1);
103 
104  // Verify function throws when not streaming
105  CHECK_THROWS(mur.get_max_usable_depth_range());
106 
107 }
TEST_CASE("Max Usable Range option require Max Range Preset while streaming","[max-usable-range]")
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_THROWS(...)
Definition: catch.hpp:17415
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