Message ID | 20200104050947.7673-13-laurent.pinchart@ideasonboard.com |
---|---|
State | Accepted |
Commit | 1f898ab114d7d4ede335bb01cb218a6f5eaf55ff |
Headers | show |
Series |
|
Related | show |
Hi Laurent, Thanks for your test. On 2020-01-04 07:09:45 +0200, Laurent Pinchart wrote: > 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> > --- > test/object-invoke.cpp | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/test/object-invoke.cpp b/test/object-invoke.cpp > index ed16de99ef5e..8e2055ca620f 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; > } > > -- > Regards, > > Laurent Pinchart > > _______________________________________________ > libcamera-devel mailing list > libcamera-devel@lists.libcamera.org > https://lists.libcamera.org/listinfo/libcamera-devel
diff --git a/test/object-invoke.cpp b/test/object-invoke.cpp index ed16de99ef5e..8e2055ca620f 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; }
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> --- test/object-invoke.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+)