summaryrefslogtreecommitdiff
path: root/test/camera
diff options
context:
space:
mode:
Diffstat (limited to 'test/camera')
-rw-r--r--test/camera/camera_test.cpp25
-rw-r--r--test/camera/camera_test.h3
-rw-r--r--test/camera/capture.cpp2
-rw-r--r--test/camera/configuration_default.cpp2
-rw-r--r--test/camera/configuration_set.cpp2
5 files changed, 12 insertions, 22 deletions
diff --git a/test/camera/camera_test.cpp b/test/camera/camera_test.cpp
index a92f2165..1609c4b0 100644
--- a/test/camera/camera_test.cpp
+++ b/test/camera/camera_test.cpp
@@ -46,27 +46,18 @@ void CameraTest::cleanup()
cm_->stop();
};
-bool CameraTest::configurationValid(const std::set<Stream *> &streams,
- const std::map<Stream *, StreamConfiguration> &conf) const
+bool CameraTest::configurationValid(const std::map<Stream *, StreamConfiguration> &config) const
{
- /* Test that the numbers of streams matches that of configuration. */
- if (streams.size() != conf.size())
+ /* Test that the configuration is not empty. */
+ if (config.empty())
return false;
- /*
- * Test that stream can be found in configuration and that the
- * configuration is valid.
- */
- for (Stream *stream : streams) {
- std::map<Stream *, StreamConfiguration>::const_iterator it =
- conf.find(stream);
+ /* Test that configuration is valid. */
+ for (auto const &it : config) {
+ const StreamConfiguration &conf = it.second;
- if (it == conf.end())
- return false;
-
- const StreamConfiguration *sconf = &it->second;
- if (sconf->width == 0 || sconf->height == 0 ||
- sconf->pixelFormat == 0 || sconf->bufferCount == 0)
+ if (conf.width == 0 || conf.height == 0 ||
+ conf.pixelFormat == 0 || conf.bufferCount == 0)
return false;
}
diff --git a/test/camera/camera_test.h b/test/camera/camera_test.h
index 48fb47a2..5801fad3 100644
--- a/test/camera/camera_test.h
+++ b/test/camera/camera_test.h
@@ -23,8 +23,7 @@ protected:
int init();
void cleanup();
- bool configurationValid(const std::set<Stream *> &streams,
- const std::map<Stream *, StreamConfiguration> &conf) const;
+ bool configurationValid(const std::map<Stream *, StreamConfiguration> &config) const;
std::shared_ptr<Camera> camera_;
diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
index 28eb6140..f6932b75 100644
--- a/test/camera/capture.cpp
+++ b/test/camera/capture.cpp
@@ -48,7 +48,7 @@ protected:
camera_->streamConfiguration(streams);
StreamConfiguration *sconf = &conf.begin()->second;
- if (!configurationValid(streams, conf)) {
+ if (!configurationValid(conf)) {
cout << "Failed to read default configuration" << endl;
return TestFail;
}
diff --git a/test/camera/configuration_default.cpp b/test/camera/configuration_default.cpp
index 71e79844..53ee021d 100644
--- a/test/camera/configuration_default.cpp
+++ b/test/camera/configuration_default.cpp
@@ -32,7 +32,7 @@ protected:
return TestFail;
}
- if (!configurationValid(streams, conf)) {
+ if (!configurationValid(conf)) {
cout << "Default configuration invalid" << endl;
return TestFail;
}
diff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp
index dedb8500..cac1da95 100644
--- a/test/camera/configuration_set.cpp
+++ b/test/camera/configuration_set.cpp
@@ -23,7 +23,7 @@ protected:
camera_->streamConfiguration(streams);
StreamConfiguration *sconf = &conf.begin()->second;
- if (!configurationValid(streams, conf)) {
+ if (!configurationValid(conf)) {
cout << "Failed to read default configuration" << endl;
return TestFail;
}