Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
unit-tests
func
presets
regular
startup
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
24
auto
devices
=
find_devices_by_product_line_or_exit
(
RS2_PRODUCT_LINE_L500
);
25
auto
dev
=
devices
[0];
26
27
exit_if_fw_version_is_under
(
dev
,
MIN_GET_DEFAULT_FW_VERSION
);
28
29
for
(
auto
i
= (
int
)
RS2_L500_VISUAL_PRESET_NO_AMBIENT
;
i
< (int)
RS2_L500_VISUAL_PRESET_AUTOMATIC
;
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
{
35
REQUIRE_NOTHROW
( depth_sens.
set_option
(
RS2_OPTION_SENSOR_MODE
,
RS2_SENSOR_MODE_VGA
) );
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
{
43
CAPTURE
(
rs2_l500_visual_preset
(
i
) );
44
check_preset_is_equal_to
( depth_sens,
rs2_l500_visual_preset
(
i
) );
45
} );
46
}
47
}
MIN_GET_DEFAULT_FW_VERSION
const std::string MIN_GET_DEFAULT_FW_VERSION("1.5.4.0")
test-bad-conditions.dev
dev
Definition:
test-bad-conditions.py:16
check_preset_is_equal_to
void check_preset_is_equal_to(rs2::depth_sensor &depth_sens, rs2_l500_visual_preset preset)
Definition:
presets-common.h:457
RS2_L500_VISUAL_PRESET_AUTOMATIC
Definition:
rs_option.h:159
rs2::depth_sensor
Definition:
rs_sensor.hpp:454
RS2_SENSOR_MODE_VGA
Definition:
rs_option.h:167
rs2
Definition:
cah-model.h:10
l500-options.h
TEST_CASE
TEST_CASE("calc preset from controls on start up","[l500][live]")
Definition:
startup/test-preset.cpp:14
CAPTURE
#define CAPTURE(...)
Definition:
catch.hpp:17432
find_devices_by_product_line_or_exit
rs2::device_list find_devices_by_product_line_or_exit(int product)
Definition:
func-common.h:24
test-fg.devices
devices
Definition:
test-fg.py:9
build_new_device_and_do
void build_new_device_and_do(std::function< void(rs2::depth_sensor &depth_sens) > action)
Definition:
presets-common.h:474
RS2_PRODUCT_LINE_L500
#define RS2_PRODUCT_LINE_L500
Definition:
rs_context.h:96
RS2_L500_VISUAL_PRESET_NO_AMBIENT
Definition:
rs_option.h:155
REQUIRE_NOTHROW
REQUIRE_NOTHROW(rs2_log(RS2_LOG_SEVERITY_INFO,"Log message using rs2_log()", nullptr))
exit_if_fw_version_is_under
void exit_if_fw_version_is_under(rs2::device &dev, librealsense::firmware_version version)
Definition:
func-common.h:38
i
int i
Definition:
rs-pcl-color.cpp:54
rs2::options::set_option
void set_option(rs2_option option, float value) const
Definition:
rs_options.hpp:99
RS2_OPTION_VISUAL_PRESET
Definition:
rs_option.h:36
RS2_OPTION_SENSOR_MODE
Definition:
rs_option.h:95
rs2_l500_visual_preset
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