summaryrefslogtreecommitdiff
path: root/test/controls/control_info.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/controls/control_info.cpp')
-rw-r--r--test/controls/control_info.cpp45
1 files changed, 40 insertions, 5 deletions
diff --git a/test/controls/control_info.cpp b/test/controls/control_info.cpp
index 1e05e131..e1bb43f0 100644
--- a/test/controls/control_info.cpp
+++ b/test/controls/control_info.cpp
@@ -2,7 +2,7 @@
/*
* Copyright (C) 2019, Google Inc.
*
- * control_info.cpp - ControlInfo tests
+ * ControlInfo tests
*/
#include <iostream>
@@ -26,24 +26,59 @@ protected:
*/
ControlInfo brightness;
- if (brightness.min().get<int32_t>() != 0 ||
- brightness.max().get<int32_t>() != 0) {
+ if (brightness.min().type() != ControlType::ControlTypeNone ||
+ brightness.max().type() != ControlType::ControlTypeNone ||
+ brightness.def().type() != ControlType::ControlTypeNone) {
cout << "Invalid control range for Brightness" << endl;
return TestFail;
}
/*
* Test information retrieval from a control with a minimum and
- * a maximum value.
+ * a maximum value, and an implicit default value.
*/
ControlInfo contrast(10, 200);
if (contrast.min().get<int32_t>() != 10 ||
- contrast.max().get<int32_t>() != 200) {
+ contrast.max().get<int32_t>() != 200 ||
+ !contrast.def().isNone()) {
cout << "Invalid control range for Contrast" << endl;
return TestFail;
}
+ /*
+ * Test information retrieval from a control with boolean
+ * values.
+ */
+ ControlInfo aeEnable({ false, true }, false);
+
+ if (aeEnable.min().get<bool>() != false ||
+ aeEnable.def().get<bool>() != false ||
+ aeEnable.max().get<bool>() != true) {
+ cout << "Invalid control range for AeEnable" << endl;
+ return TestFail;
+ }
+
+ if (aeEnable.values()[0].get<bool>() != false ||
+ aeEnable.values()[1].get<bool>() != true) {
+ cout << "Invalid control values for AeEnable" << endl;
+ return TestFail;
+ }
+
+ ControlInfo awbEnable(true);
+
+ if (awbEnable.min().get<bool>() != true ||
+ awbEnable.def().get<bool>() != true ||
+ awbEnable.max().get<bool>() != true) {
+ cout << "Invalid control range for AwbEnable" << endl;
+ return TestFail;
+ }
+
+ if (awbEnable.values()[0].get<bool>() != true) {
+ cout << "Invalid control values for AwbEnable" << endl;
+ return TestFail;
+ }
+
return TestPass;
}
};