ctrols-change/test-values.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2020 Intel Corporation. All Rights Reserved.
3 
4 //#cmake: static!
5 //#test:device L500*
6 
7 #include "../../../func-common.h"
8 #include "../../presets-common.h"
9 #include <l500/l500-options.h>
10 
11 using namespace rs2;
12 
13 // This test checks that after changing one of the hw control, current and default values
14 // of all the others controls are correct
15 TEST_CASE( "check values after hw control changed", "[l500][live]" )
16 {
18  auto dev = devices[0];
19 
21 
22  auto depth_sens = dev.first< rs2::depth_sensor >();
23 
24  auto preset_mode_def = get_camera_preset_mode_defaults( depth_sens );
25 
26  std::map< rs2_option, float > expected_values, expected_defs;
27  build_preset_to_expected_values_map(dev, depth_sens, preset_mode_def, expected_values, expected_defs);
28 
29  for( auto & o : preset_dependent_options )
30  {
31  if( o == RS2_OPTION_DIGITAL_GAIN )
32  continue;
33 
35 
36  auto range = depth_sens.get_option_range( o );
37  depth_sens.set_option( o, range.min );
38 
39  auto expected_curr_values = expected_values;
40  expected_curr_values[o] = range.min;
41 
42  compare_to_actual( depth_sens, expected_curr_values, expected_defs);
43  }
44 }
const std::string MIN_GET_DEFAULT_FW_VERSION("1.5.4.0")
void compare_to_actual(const rs2::sensor &sens, const std::map< rs2_option, float > &expected_values, const std::map< rs2_option, float > &expected_defaults)
Definition: cah-model.h:10
const std::vector< rs2_option > preset_dependent_options
rs2::device_list find_devices_by_product_line_or_exit(int product)
Definition: func-common.h:24
devices
Definition: test-fg.py:9
#define RS2_PRODUCT_LINE_L500
Definition: rs_context.h:96
TEST_CASE("check values after hw control changed","[l500][live]")
GLsizei range
void build_preset_to_expected_values_map(rs2::device &dev, rs2::depth_sensor &depth_sens, preset_mode_pair preset_mode, std::map< rs2_option, float > &expected_values, std::map< rs2_option, float > &expected_defs)
void exit_if_fw_version_is_under(rs2::device &dev, librealsense::firmware_version version)
Definition: func-common.h:38
void reset_camera_preset_mode_to_defaults(const rs2::sensor &sens)
preset_mode_pair get_camera_preset_mode_defaults(const rs2::sensor &sens)


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