[libcamera-devel] test: signal: Exercise the signal delivery code paths for Object

Message ID 20190427121608.13331-1-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • [libcamera-devel] test: signal: Exercise the signal delivery code paths for Object
Related show

Commit Message

Laurent Pinchart April 27, 2019, 12:16 p.m. UTC
Member slots for objects deriving from the Object class receive special
handling. Add one test to make sure we exercise the related code paths.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 test/signal.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Kieran Bingham April 27, 2019, 2:33 p.m. UTC | #1
Hi Laurent,

On 27/04/2019 14:16, Laurent Pinchart wrote:
> Member slots for objects deriving from the Object class receive special
> handling. Add one test to make sure we exercise the related code paths.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> ---
>  test/signal.cpp | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/test/signal.cpp b/test/signal.cpp
> index 19a52c603a4a..bc579cca37e4 100644
> --- a/test/signal.cpp
> +++ b/test/signal.cpp
> @@ -176,6 +176,18 @@ protected:
>  		delete signal;
>  		delete slotObject;
>  
> +		/* Exercise the the Object slot code paths. */

'the the' : s/the //

> +		slotObject = new SlotObject();
> +		signalVoid_.connect(slotObject, &SlotObject::slot);
> +		valueStatic_ = 0;
> +		signalVoid_.emit();> +		if (valueStatic_ == 0) {
> +			cout << "Signal delivery for Object test failed" << endl;
> +			return TestFail;
> +		}
> +

Hrm ... I thought this was missing a signalVoid_.disconnect() but given
the test above this addition I guess the delete slotObject handles this.

> +		delete slotObject;
> +
>  		return TestPass;
>  	}
>  
>

Patch

diff --git a/test/signal.cpp b/test/signal.cpp
index 19a52c603a4a..bc579cca37e4 100644
--- a/test/signal.cpp
+++ b/test/signal.cpp
@@ -176,6 +176,18 @@  protected:
 		delete signal;
 		delete slotObject;
 
+		/* Exercise the the Object slot code paths. */
+		slotObject = new SlotObject();
+		signalVoid_.connect(slotObject, &SlotObject::slot);
+		valueStatic_ = 0;
+		signalVoid_.emit();
+		if (valueStatic_ == 0) {
+			cout << "Signal delivery for Object test failed" << endl;
+			return TestFail;
+		}
+
+		delete slotObject;
+
 		return TestPass;
 	}