[libcamera-devel] [PATCH 13/14] test: signal: Test connecting to non-void slots

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Jan 4 06:09:46 CET 2020


Test that a signal can be connected to non-void static and member slots.

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

diff --git a/test/signal.cpp b/test/signal.cpp
index 9d8f985d15e5..0054ed5a380d 100644
--- a/test/signal.cpp
+++ b/test/signal.cpp
@@ -23,6 +23,11 @@ static void slotStatic(int value)
 	valueStatic_ = value;
 }
 
+static int slotStaticReturn()
+{
+	return 0;
+}
+
 class SlotObject : public Object
 {
 public:
@@ -85,6 +90,11 @@ protected:
 		name_ = name;
 	}
 
+	int slotReturn()
+	{
+		return 0;
+	}
+
 	int init()
 	{
 		return 0;
@@ -174,6 +184,13 @@ protected:
 			return TestFail;
 		}
 
+		/*
+		 * Test connecting to slots that return a value. This targets
+		 * compilation, there's no need to check runtime results.
+		 */
+		signalVoid_.connect(slotStaticReturn);
+		signalVoid_.connect(this, &SignalTest::slotReturn);
+
 		/* ----------------- Signal -> Object tests ----------------- */
 
 		/*
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list