mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 15:29:45 +03:00
test: object-invoke: Test invoking a non-void method
Test that Object::invokeMethod() can be used to invoke a non-void method. Verify that the return value is correctly propagated to the caller. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
parent
dce6bb0e30
commit
1f898ab114
1 changed files with 14 additions and 0 deletions
|
@ -53,6 +53,11 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
int methodWithReturn()
|
||||
{
|
||||
return 42;
|
||||
}
|
||||
|
||||
private:
|
||||
Status status_;
|
||||
int value_;
|
||||
|
@ -152,6 +157,15 @@ protected:
|
|||
object_.invokeMethod(&InvokedObject::methodWithReference,
|
||||
ConnectionTypeBlocking, 42);
|
||||
|
||||
/* Test invoking a method that returns a value. */
|
||||
int ret = object_.invokeMethod(&InvokedObject::methodWithReturn,
|
||||
ConnectionTypeBlocking);
|
||||
if (ret != 42) {
|
||||
cout << "Method invoked return incorrect value (" << ret
|
||||
<< ")" << endl;
|
||||
return TestFail;
|
||||
}
|
||||
|
||||
return TestPass;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue