[libcamera-devel,4/5] test: Unify naming of configurations in tests

Message ID 20190430183746.28518-5-laurent.pinchart@ideasonboard.com
State Accepted
Commit 21e501f81005f0ea21bdd8d3d4c8771f1352fc19
Headers show
Series
  • Miscellaneous cleanups and refactoring
Related show

Commit Message

Laurent Pinchart April 30, 2019, 6:37 p.m. UTC
Name all instances of CameraConfiguration "config", and all instances of
StreamConfiguration "cfg" accross all tests.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/camera/capture.cpp               | 14 +++++++-------
 test/camera/configuration_default.cpp | 10 +++++-----
 test/camera/configuration_set.cpp     | 20 ++++++++++----------
 3 files changed, 22 insertions(+), 22 deletions(-)

Comments

Niklas Söderlund April 30, 2019, 6:58 p.m. UTC | #1
Hi Laurent,

Thanks for your patch.

On 2019-04-30 21:37:45 +0300, Laurent Pinchart wrote:
> Name all instances of CameraConfiguration "config", and all instances of
> StreamConfiguration "cfg" accross all tests.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>

> ---
>  test/camera/capture.cpp               | 14 +++++++-------
>  test/camera/configuration_default.cpp | 10 +++++-----
>  test/camera/configuration_set.cpp     | 20 ++++++++++----------
>  3 files changed, 22 insertions(+), 22 deletions(-)
> 
> diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
> index 4e75a75c5b71..0101cc94e665 100644
> --- a/test/camera/capture.cpp
> +++ b/test/camera/capture.cpp
> @@ -42,12 +42,12 @@ protected:
>  
>  	int run()
>  	{
> -		CameraConfiguration conf =
> +		CameraConfiguration config =
>  			camera_->streamConfiguration({ Stream::VideoRecording() });
> -		Stream *stream = conf.front();
> -		StreamConfiguration *sconf = &conf[stream];
> +		Stream *stream = config.front();
> +		StreamConfiguration *cfg = &config[stream];
>  
> -		if (!conf.isValid()) {
> +		if (!config.isValid()) {
>  			cout << "Failed to read default configuration" << endl;
>  			return TestFail;
>  		}
> @@ -57,7 +57,7 @@ protected:
>  			return TestFail;
>  		}
>  
> -		if (camera_->configureStreams(conf)) {
> +		if (camera_->configureStreams(config)) {
>  			cout << "Failed to set default configuration" << endl;
>  			return TestFail;
>  		}
> @@ -110,10 +110,10 @@ protected:
>  		while (timer.isRunning())
>  			dispatcher->processEvents();
>  
> -		if (completeRequestsCount_ <= sconf->bufferCount * 2) {
> +		if (completeRequestsCount_ <= cfg->bufferCount * 2) {
>  			cout << "Failed to capture enough frames (got "
>  			     << completeRequestsCount_ << " expected at least "
> -			     << sconf->bufferCount * 2 << ")" << endl;
> +			     << cfg->bufferCount * 2 << ")" << endl;
>  			return TestFail;
>  		}
>  
> diff --git a/test/camera/configuration_default.cpp b/test/camera/configuration_default.cpp
> index dd5106689f09..2a10ea507a67 100644
> --- a/test/camera/configuration_default.cpp
> +++ b/test/camera/configuration_default.cpp
> @@ -18,11 +18,11 @@ class ConfigurationDefault : public CameraTest
>  protected:
>  	int run()
>  	{
> -		CameraConfiguration conf;
> +		CameraConfiguration config;
>  
>  		/* Test asking for configuration for a video stream. */
> -		conf = camera_->streamConfiguration({ Stream::VideoRecording() });
> -		if (!conf.isValid()) {
> +		config = camera_->streamConfiguration({ Stream::VideoRecording() });
> +		if (!config.isValid()) {
>  			cout << "Default configuration invalid" << endl;
>  			return TestFail;
>  		}
> @@ -31,8 +31,8 @@ protected:
>  		 * Test that asking for configuration for an empty array of
>  		 * stream usages returns an empty list of configurations.
>  		 */
> -		conf = camera_->streamConfiguration({});
> -		if (conf.isValid()) {
> +		config = camera_->streamConfiguration({});
> +		if (config.isValid()) {
>  			cout << "Failed to retrieve configuration for empty usage list"
>  			     << endl;
>  			return TestFail;
> diff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp
> index 0c932bc1de18..ca41ed689511 100644
> --- a/test/camera/configuration_set.cpp
> +++ b/test/camera/configuration_set.cpp
> @@ -18,11 +18,11 @@ class ConfigurationSet : public CameraTest
>  protected:
>  	int run()
>  	{
> -		CameraConfiguration conf =
> +		CameraConfiguration config =
>  			camera_->streamConfiguration({ Stream::VideoRecording() });
> -		StreamConfiguration *sconf = &conf[conf.front()];
> +		StreamConfiguration *cfg = &config[config.front()];
>  
> -		if (!conf.isValid()) {
> +		if (!config.isValid()) {
>  			cout << "Failed to read default configuration" << endl;
>  			return TestFail;
>  		}
> @@ -33,7 +33,7 @@ protected:
>  		}
>  
>  		/* Test that setting the default configuration works. */
> -		if (camera_->configureStreams(conf)) {
> +		if (camera_->configureStreams(config)) {
>  			cout << "Failed to set default configuration" << endl;
>  			return TestFail;
>  		}
> @@ -48,7 +48,7 @@ protected:
>  			return TestFail;
>  		}
>  
> -		if (!camera_->configureStreams(conf)) {
> +		if (!camera_->configureStreams(config)) {
>  			cout << "Setting configuration on a camera not acquired succeeded when it should have failed"
>  			     << endl;
>  			return TestFail;
> @@ -64,9 +64,9 @@ protected:
>  		 * the default configuration of the VIMC camera is known to
>  		 * work.
>  		 */
> -		sconf->size.width *= 2;
> -		sconf->size.height *= 2;
> -		if (camera_->configureStreams(conf)) {
> +		cfg->size.width *= 2;
> +		cfg->size.height *= 2;
> +		if (camera_->configureStreams(config)) {
>  			cout << "Failed to set modified configuration" << endl;
>  			return TestFail;
>  		}
> @@ -74,8 +74,8 @@ protected:
>  		/*
>  		 * Test that setting an invalid configuration fails.
>  		 */
> -		sconf->size = { 0, 0 };
> -		if (!camera_->configureStreams(conf)) {
> +		cfg->size = { 0, 0 };
> +		if (!camera_->configureStreams(config)) {
>  			cout << "Invalid configuration incorrectly accepted" << endl;
>  			return TestFail;
>  		}
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel@lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel

Patch

diff --git a/test/camera/capture.cpp b/test/camera/capture.cpp
index 4e75a75c5b71..0101cc94e665 100644
--- a/test/camera/capture.cpp
+++ b/test/camera/capture.cpp
@@ -42,12 +42,12 @@  protected:
 
 	int run()
 	{
-		CameraConfiguration conf =
+		CameraConfiguration config =
 			camera_->streamConfiguration({ Stream::VideoRecording() });
-		Stream *stream = conf.front();
-		StreamConfiguration *sconf = &conf[stream];
+		Stream *stream = config.front();
+		StreamConfiguration *cfg = &config[stream];
 
-		if (!conf.isValid()) {
+		if (!config.isValid()) {
 			cout << "Failed to read default configuration" << endl;
 			return TestFail;
 		}
@@ -57,7 +57,7 @@  protected:
 			return TestFail;
 		}
 
-		if (camera_->configureStreams(conf)) {
+		if (camera_->configureStreams(config)) {
 			cout << "Failed to set default configuration" << endl;
 			return TestFail;
 		}
@@ -110,10 +110,10 @@  protected:
 		while (timer.isRunning())
 			dispatcher->processEvents();
 
-		if (completeRequestsCount_ <= sconf->bufferCount * 2) {
+		if (completeRequestsCount_ <= cfg->bufferCount * 2) {
 			cout << "Failed to capture enough frames (got "
 			     << completeRequestsCount_ << " expected at least "
-			     << sconf->bufferCount * 2 << ")" << endl;
+			     << cfg->bufferCount * 2 << ")" << endl;
 			return TestFail;
 		}
 
diff --git a/test/camera/configuration_default.cpp b/test/camera/configuration_default.cpp
index dd5106689f09..2a10ea507a67 100644
--- a/test/camera/configuration_default.cpp
+++ b/test/camera/configuration_default.cpp
@@ -18,11 +18,11 @@  class ConfigurationDefault : public CameraTest
 protected:
 	int run()
 	{
-		CameraConfiguration conf;
+		CameraConfiguration config;
 
 		/* Test asking for configuration for a video stream. */
-		conf = camera_->streamConfiguration({ Stream::VideoRecording() });
-		if (!conf.isValid()) {
+		config = camera_->streamConfiguration({ Stream::VideoRecording() });
+		if (!config.isValid()) {
 			cout << "Default configuration invalid" << endl;
 			return TestFail;
 		}
@@ -31,8 +31,8 @@  protected:
 		 * Test that asking for configuration for an empty array of
 		 * stream usages returns an empty list of configurations.
 		 */
-		conf = camera_->streamConfiguration({});
-		if (conf.isValid()) {
+		config = camera_->streamConfiguration({});
+		if (config.isValid()) {
 			cout << "Failed to retrieve configuration for empty usage list"
 			     << endl;
 			return TestFail;
diff --git a/test/camera/configuration_set.cpp b/test/camera/configuration_set.cpp
index 0c932bc1de18..ca41ed689511 100644
--- a/test/camera/configuration_set.cpp
+++ b/test/camera/configuration_set.cpp
@@ -18,11 +18,11 @@  class ConfigurationSet : public CameraTest
 protected:
 	int run()
 	{
-		CameraConfiguration conf =
+		CameraConfiguration config =
 			camera_->streamConfiguration({ Stream::VideoRecording() });
-		StreamConfiguration *sconf = &conf[conf.front()];
+		StreamConfiguration *cfg = &config[config.front()];
 
-		if (!conf.isValid()) {
+		if (!config.isValid()) {
 			cout << "Failed to read default configuration" << endl;
 			return TestFail;
 		}
@@ -33,7 +33,7 @@  protected:
 		}
 
 		/* Test that setting the default configuration works. */
-		if (camera_->configureStreams(conf)) {
+		if (camera_->configureStreams(config)) {
 			cout << "Failed to set default configuration" << endl;
 			return TestFail;
 		}
@@ -48,7 +48,7 @@  protected:
 			return TestFail;
 		}
 
-		if (!camera_->configureStreams(conf)) {
+		if (!camera_->configureStreams(config)) {
 			cout << "Setting configuration on a camera not acquired succeeded when it should have failed"
 			     << endl;
 			return TestFail;
@@ -64,9 +64,9 @@  protected:
 		 * the default configuration of the VIMC camera is known to
 		 * work.
 		 */
-		sconf->size.width *= 2;
-		sconf->size.height *= 2;
-		if (camera_->configureStreams(conf)) {
+		cfg->size.width *= 2;
+		cfg->size.height *= 2;
+		if (camera_->configureStreams(config)) {
 			cout << "Failed to set modified configuration" << endl;
 			return TestFail;
 		}
@@ -74,8 +74,8 @@  protected:
 		/*
 		 * Test that setting an invalid configuration fails.
 		 */
-		sconf->size = { 0, 0 };
-		if (!camera_->configureStreams(conf)) {
+		cfg->size = { 0, 0 };
+		if (!camera_->configureStreams(config)) {
 			cout << "Invalid configuration incorrectly accepted" << endl;
 			return TestFail;
 		}