startup/test-preset.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 
14 TEST_CASE( "calc preset from controls on start up", "[l500][live]" )
15 {
16  // This test will create for each preset value new rs2::device and destroy it
17  // in order to simulate the scenario of:
18  // 1. start up librealsense and create an object of L500 device
19  // 2. set specific preset to depth sensor
20  // 3. close librealsense
21  // 4. start up again librealsense
22  // we expect that on the second start up librealsense will calculated preset correctly from the control values
23 
25  auto dev = devices[0];
26 
28 
30  i++ )
31  {
32  // this will create an object of L500 device set it preset and destroy it
33  build_new_device_and_do( [&] (rs2::depth_sensor & depth_sens)
34  {
36  REQUIRE_NOTHROW( depth_sens.set_option( RS2_OPTION_VISUAL_PRESET, (float)i ) );
37  } );
38 
39  // We set the preset on the previous device, and want to check that, for a new device, the
40  // preset was calculated correctly from the control values
41  build_new_device_and_do( [&] (rs2::depth_sensor & depth_sens)
42  {
45  } );
46  }
47 }
const std::string MIN_GET_DEFAULT_FW_VERSION("1.5.4.0")
void check_preset_is_equal_to(rs2::depth_sensor &depth_sens, rs2_l500_visual_preset preset)
Definition: cah-model.h:10
TEST_CASE("calc preset from controls on start up","[l500][live]")
#define CAPTURE(...)
Definition: catch.hpp:17432
rs2::device_list find_devices_by_product_line_or_exit(int product)
Definition: func-common.h:24
devices
Definition: test-fg.py:9
void build_new_device_and_do(std::function< void(rs2::depth_sensor &depth_sens) > action)
#define RS2_PRODUCT_LINE_L500
Definition: rs_context.h:96
REQUIRE_NOTHROW(rs2_log(RS2_LOG_SEVERITY_INFO,"Log message using rs2_log()", nullptr))
void exit_if_fw_version_is_under(rs2::device &dev, librealsense::firmware_version version)
Definition: func-common.h:38
int i
void set_option(rs2_option option, float value) const
Definition: rs_options.hpp:99
rs2_l500_visual_preset
For L500 devices: provides optimized settings (presets) for specific types of usage.
Definition: rs_option.h:151


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