diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-03 21:10:11 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2020-01-07 22:29:40 +0200 |
commit | 1f898ab114d7d4ede335bb01cb218a6f5eaf55ff (patch) | |
tree | 376de2fb8f90c57caef7905e9ac172c5ee65aa62 | |
parent | dce6bb0e301a7985b302143ff4405b5526ab5dd6 (diff) |
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>
-rw-r--r-- | test/object-invoke.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/object-invoke.cpp b/test/object-invoke.cpp index ed16de99..8e2055ca 100644 --- a/test/object-invoke.cpp +++ b/test/object-invoke.cpp @@ -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; } |