summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2024-11-26 00:18:36 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2024-12-18 17:27:22 +0900
commit936a099ecab1f93b9fd77171bd904e0ad30e4f9f (patch)
tree99bc4c64b0dd9fd59f205f70a931e1098cd1a199 /test
parent34d7b4776b00979f28c9176dc9aea30c52d48c42 (diff)
apps: cam: Print control direction information
Now that there is support for retrieving the allowed directions of a control, print this information when listing controls. Sample output: $ cam --list-controls -c 2 Using camera Virtual0 as cam0 Control: [inout] draft::FaceDetectMode: - FaceDetectModeOff (0) Control: [inout] libcamera::FrameDurationLimits: [16666..33333] Size: 2 Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test')
0 files changed, 0 insertions, 0 deletions
l com"> * * Threaded timer failure test */ #include <chrono> #include <iostream> #include <libcamera/base/event_dispatcher.h> #include <libcamera/base/object.h> #include <libcamera/base/thread.h> #include <libcamera/base/timer.h> #include "test.h" using namespace libcamera; using namespace std; using namespace std::chrono_literals; class TimeoutHandler : public Object { public: TimeoutHandler() : timer_(this), timeout_(false) { timer_.timeout.connect(this, &TimeoutHandler::timeoutHandler); } void start() { timer_.start(100ms); } bool timeout() const { return timeout_; } private: void timeoutHandler() { timeout_ = true; } Timer timer_; bool timeout_; }; class TimerFailTest : public Test { protected: int init() { thread_.start(); timeout_ = new TimeoutHandler(); timeout_->moveToThread(&thread_); return TestPass; } int run() { /* * Test that the forbidden operation of starting the timer from * another thread results in a failure. We need to interrupt the * event dispatcher to make sure we don't succeed simply because * the event dispatcher hasn't noticed the timer restart. */ timeout_->start(); thread_.eventDispatcher()->interrupt(); this_thread::sleep_for(chrono::milliseconds(200)); /* * The wrong start() call should result in an assertion in debug * builds, and a timeout in release builds. The test is * therefore marked in meson.build as expected to fail. We need * to return TestPass in the unexpected (usually known as * "fail") case, and TestFail otherwise. */ if (timeout_->timeout()) { cout << "Timer start from wrong thread succeeded unexpectedly" << endl; return TestPass; } return TestFail; } void cleanup() { /* * Object class instances must be destroyed from the thread * they live in. */ timeout_->deleteLater(); thread_.exit(0); thread_.wait(); } private: TimeoutHandler *timeout_; Thread thread_; }; TEST_REGISTER(TimerFailTest)