From 73b7ba9da5fe7b1aec62af091ad36403cd3505c4 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 1 Mar 2020 22:02:37 +0200 Subject: libcamera: controls: Name all ControlInfoMap instance variables infoMap To prepare for the rename of ControlRange to ControlInfo, rename all the ControlInfoMap instance variables currently named info to infoMap. This will help avoiding namespace clashes. Signed-off-by: Laurent Pinchart Reviewed-by: Jacopo Mondi --- test/controls/control_info.cpp | 82 -------------------------------------- test/controls/control_info_map.cpp | 82 ++++++++++++++++++++++++++++++++++++++ test/controls/meson.build | 8 ++-- test/v4l2_videodevice/controls.cpp | 18 ++++----- 4 files changed, 95 insertions(+), 95 deletions(-) delete mode 100644 test/controls/control_info.cpp create mode 100644 test/controls/control_info_map.cpp (limited to 'test') diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp deleted file mode 100644 index fa9d7bae..00000000 --- a/test/controls/control_info.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (C) 2019, Google Inc. - * - * control_info.cpp - ControlInfoMap tests - */ - -#include - -#include -#include -#include -#include - -#include "camera_controls.h" - -#include "camera_test.h" -#include "test.h" - -using namespace std; -using namespace libcamera; - -class ControlInfoMapTest : public CameraTest, public Test -{ -public: - ControlInfoMapTest() - : CameraTest("VIMC Sensor B") - { - } - -protected: - int init() override - { - return status_; - } - - int run() override - { - const ControlInfoMap &info = camera_->controls(); - - /* Test looking up a valid control by ControlId. */ - if (info.count(&controls::Brightness) != 1) { - cerr << "count() on valid control failed" << endl; - return TestFail; - } - - if (info.find(&controls::Brightness) == info.end()) { - cerr << "find() on valid control failed" << endl; - return TestFail; - } - - info.at(&controls::Brightness); - - /* Test looking up a valid control by numerical ID. */ - if (info.count(controls::Brightness.id()) != 1) { - cerr << "count() on valid ID failed" << endl; - return TestFail; - } - - if (info.find(controls::Brightness.id()) == info.end()) { - cerr << "find() on valid ID failed" << endl; - return TestFail; - } - - info.at(controls::Brightness.id()); - - /* Test looking up an invalid control by numerical ID. */ - if (info.count(12345) != 0) { - cerr << "count() on invalid ID failed" << endl; - return TestFail; - } - - if (info.find(12345) != info.end()) { - cerr << "find() on invalid ID failed" << endl; - return TestFail; - } - - return TestPass; - } -}; - -TEST_REGISTER(ControlInfoMapTest) diff --git a/test/controls/control_info_map.cpp b/test/controls/control_info_map.cpp new file mode 100644 index 00000000..eeb702db --- /dev/null +++ b/test/controls/control_info_map.cpp @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * control_info.cpp - ControlInfoMap tests + */ + +#include + +#include +#include +#include +#include + +#include "camera_controls.h" + +#include "camera_test.h" +#include "test.h" + +using namespace std; +using namespace libcamera; + +class ControlInfoMapTest : public CameraTest, public Test +{ +public: + ControlInfoMapTest() + : CameraTest("VIMC Sensor B") + { + } + +protected: + int init() override + { + return status_; + } + + int run() override + { + const ControlInfoMap &infoMap = camera_->controls(); + + /* Test looking up a valid control by ControlId. */ + if (infoMap.count(&controls::Brightness) != 1) { + cerr << "count() on valid control failed" << endl; + return TestFail; + } + + if (infoMap.find(&controls::Brightness) == infoMap.end()) { + cerr << "find() on valid control failed" << endl; + return TestFail; + } + + infoMap.at(&controls::Brightness); + + /* Test looking up a valid control by numerical ID. */ + if (infoMap.count(controls::Brightness.id()) != 1) { + cerr << "count() on valid ID failed" << endl; + return TestFail; + } + + if (infoMap.find(controls::Brightness.id()) == infoMap.end()) { + cerr << "find() on valid ID failed" << endl; + return TestFail; + } + + infoMap.at(controls::Brightness.id()); + + /* Test looking up an invalid control by numerical ID. */ + if (infoMap.count(12345) != 0) { + cerr << "count() on invalid ID failed" << endl; + return TestFail; + } + + if (infoMap.find(12345) != infoMap.end()) { + cerr << "find() on invalid ID failed" << endl; + return TestFail; + } + + return TestPass; + } +}; + +TEST_REGISTER(ControlInfoMapTest) diff --git a/test/controls/meson.build b/test/controls/meson.build index f0850df2..16a7f33f 100644 --- a/test/controls/meson.build +++ b/test/controls/meson.build @@ -1,8 +1,8 @@ control_tests = [ - [ 'control_info', 'control_info.cpp' ], - [ 'control_list', 'control_list.cpp' ], - [ 'control_range', 'control_range.cpp' ], - [ 'control_value', 'control_value.cpp' ], + [ 'control_info_map', 'control_info_map.cpp' ], + [ 'control_list', 'control_list.cpp' ], + [ 'control_range', 'control_range.cpp' ], + [ 'control_value', 'control_value.cpp' ], ] foreach t : control_tests diff --git a/test/v4l2_videodevice/controls.cpp b/test/v4l2_videodevice/controls.cpp index 42c653d4..1b71bf06 100644 --- a/test/v4l2_videodevice/controls.cpp +++ b/test/v4l2_videodevice/controls.cpp @@ -26,27 +26,27 @@ public: protected: int run() { - const ControlInfoMap &info = capture_->controls(); + const ControlInfoMap &infoMap = capture_->controls(); /* Test control enumeration. */ - if (info.empty()) { + if (infoMap.empty()) { cerr << "Failed to enumerate controls" << endl; return TestFail; } - if (info.find(V4L2_CID_BRIGHTNESS) == info.end() || - info.find(V4L2_CID_CONTRAST) == info.end() || - info.find(V4L2_CID_SATURATION) == info.end()) { + if (infoMap.find(V4L2_CID_BRIGHTNESS) == infoMap.end() || + infoMap.find(V4L2_CID_CONTRAST) == infoMap.end() || + infoMap.find(V4L2_CID_SATURATION) == infoMap.end()) { cerr << "Missing controls" << endl; return TestFail; } - const ControlRange &brightness = info.find(V4L2_CID_BRIGHTNESS)->second; - const ControlRange &contrast = info.find(V4L2_CID_CONTRAST)->second; - const ControlRange &saturation = info.find(V4L2_CID_SATURATION)->second; + const ControlRange &brightness = infoMap.find(V4L2_CID_BRIGHTNESS)->second; + const ControlRange &contrast = infoMap.find(V4L2_CID_CONTRAST)->second; + const ControlRange &saturation = infoMap.find(V4L2_CID_SATURATION)->second; /* Test getting controls. */ - ControlList ctrls(info); + ControlList ctrls(infoMap); ctrls.set(V4L2_CID_BRIGHTNESS, -1); ctrls.set(V4L2_CID_CONTRAST, -1); ctrls.set(V4L2_CID_SATURATION, -1); -- cgit v1.2.1