/* SPDX-License-Identifier: GPL-2.0-or-later */ /* * Copyright (C) 2019, Google Inc. * * control_info.cpp - ControlInfoMap tests */ #include #include #include #include #include #include "libcamera/internal/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("platform/vimc.0 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) 43bba1d6043652'>commitdiff
blob: 598308fceb3d20f55dacdea06393a75a3f559fae (plain)
1
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-power"><path d="M18.36 6.64a9 9 0 1 1-12.73 0"></path><line x1="12" y1="2" x2="12" y2="12"></line></svg>