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:
Laurent Pinchart
2019-10-05 20:02:51 +03:00
parent f671d84ceb
commit ecf1c2e57b
5 changed files with 43 additions and 26 deletions
+14 -1
View File
@@ -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;
}