mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-23 16:45:07 +03:00
libcamera: controls: Use ControlValidator to validate ControlList
Replace the manual validation of controls against a Camera with usage of the new ControlValidator interface. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
f671d84ceb
commit
ecf1c2e57b
5 changed files with 43 additions and 26 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <libcamera/control_ids.h>
|
||||
#include <libcamera/controls.h>
|
||||
|
||||
#include "camera_controls.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -40,7 +41,8 @@ protected:
|
|||
|
||||
int run()
|
||||
{
|
||||
ControlList list(camera_.get());
|
||||
CameraControlValidator validator(camera_.get());
|
||||
ControlList list(&validator);
|
||||
|
||||
/* Test that the list is initially empty. */
|
||||
if (!list.empty()) {
|
||||
|
@ -141,6 +143,17 @@ protected:
|
|||
return TestFail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Attempt to set an invalid control and verify that the
|
||||
* operation failed.
|
||||
*/
|
||||
list.set(controls::AwbEnable, true);
|
||||
|
||||
if (list.contains(controls::AwbEnable)) {
|
||||
cout << "List shouldn't contain AwbEnable control" << endl;
|
||||
return TestFail;
|
||||
}
|
||||
|
||||
return TestPass;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue