From patchwork Sat Jan 4 05:09:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2508 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id ECFE960623 for ; Sat, 4 Jan 2020 06:10:06 +0100 (CET) Received: from pendragon.bb.dnainternet.fi (81-175-216-236.bb.dnainternet.fi [81.175.216.236]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8D7CEFA0 for ; Sat, 4 Jan 2020 06:10:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1578114606; bh=w7GKfXnNZ4PbZ7dIcabStmNoViqiYYpWD7OMX60WpJc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=d3fNiK/OW65JX4oWgWkBpUGYMdqpVuoaW+aeTLnefwqdUvROm1ibQ7PzVpWRuhoFs gVk56CSms1KPpsS1AlWmh4OgTNvakpLFR3oh6KpWGZNMCb4uF5ISJdN3fVyr7hsMjF 845pYJ+Nrx3vnueZO0P2zC9kBPsY6psyaeU6GYtA= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Jan 2020 07:09:45 +0200 Message-Id: <20200104050947.7673-13-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200104050947.7673-1-laurent.pinchart@ideasonboard.com> References: <20200104050947.7673-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 12/14] test: object-invoke: Test invoking a non-void method X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jan 2020 05:10:08 -0000 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 Reviewed-by: Niklas Söderlund --- 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; }