Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
unit-tests
types
test-profile-eq.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
#include "../func/func-common.h"
5
#include "../../include/librealsense2/hpp/rs_frame.hpp"
6
#include <iostream>
7
8
using namespace
rs2
;
9
10
TEST_CASE
(
"test video_stream_profile operator=="
,
"[live]"
)
11
{
12
// Test that for 2 video_stream_profile objects, if width and height are different
13
// then, video_stream_profile.operator== returns false.
14
15
auto
devices
=
find_devices_by_product_line_or_exit
(
RS2_PRODUCT_LINE_DEPTH
);
16
if
(
devices
.size() == 0)
return
;
17
auto
dev
=
devices
[0];
18
19
auto
depth_sens =
dev
.first<
rs2::depth_sensor
>();
20
21
stream_profile
profile0, profile1;
22
std::vector< stream_profile >
stream_profiles
;
23
REQUIRE_NOTHROW
(stream_profiles = depth_sens.get_stream_profiles());
24
for
(
auto
profile
: stream_profiles)
25
{
26
if
(
profile
.is<
video_stream_profile
>())
27
{
28
profile0 =
profile
;
29
}
30
}
31
if
(!profile0)
return
;
32
video_stream_profile
vprofile0 = profile0.
as
<
video_stream_profile
>();
33
34
for
(
auto
profile
: stream_profiles)
35
{
36
if
(!
profile
.is<
video_stream_profile
>())
continue
;
37
if
(
profile
== profile0)
38
{
39
video_stream_profile
vprofile =
profile
.as<
video_stream_profile
>();
40
if
(vprofile0.
width
() == vprofile.
width
() &&
41
vprofile0.
height
() == vprofile.
height
())
42
{
43
REQUIRE
(vprofile0 == vprofile);
44
}
45
else
46
{
47
REQUIRE
(!(vprofile0 == vprofile));
48
}
49
}
50
}
51
}
rs2::stream_profile
Definition:
rs_frame.hpp:22
profile
Definition:
unit-tests-common.h:59
rs2::stream_profile::as
T as() const
Definition:
rs_frame.hpp:103
test-bad-conditions.dev
dev
Definition:
test-bad-conditions.py:16
rs2::depth_sensor
Definition:
rs_sensor.hpp:454
rs2
Definition:
cah-model.h:10
REQUIRE
REQUIRE(n_callbacks==1)
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
test-non-realtime.profile
profile
Definition:
test-non-realtime.py:23
librealsense::stream_profiles
std::vector< std::shared_ptr< stream_profile_interface >> stream_profiles
Definition:
streaming.h:165
RS2_PRODUCT_LINE_DEPTH
#define RS2_PRODUCT_LINE_DEPTH
Definition:
rs_context.h:98
TEST_CASE
TEST_CASE("test video_stream_profile operator==","[live]")
Definition:
test-profile-eq.cpp:10
REQUIRE_NOTHROW
REQUIRE_NOTHROW(rs2_log(RS2_LOG_SEVERITY_INFO,"Log message using rs2_log()", nullptr))
rs2::video_stream_profile::width
int width() const
Definition:
rs_frame.hpp:225
rs2::video_stream_profile
Definition:
rs_frame.hpp:201
rs2::video_stream_profile::height
int height() const
Definition:
rs_frame.hpp:230
librealsense2
Author(s): Sergey Dorodnicov
, Doron Hirshberg
, Mark Horn
, Reagan Lopez
, Itay Carpis
autogenerated on Mon May 3 2021 02:50:11