From d82b8778ed4fa9cf0f2ccacc95807c1bdaa25bda Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sat, 4 Jan 2020 05:12:05 +0200 Subject: test: object-invoke: Test direct invocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Test the ConnectionTypeDirect type when the object lives in a different thread. This test passes but generates a memory leak. Signed-off-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- test/object-invoke.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/object-invoke.cpp') diff --git a/test/object-invoke.cpp b/test/object-invoke.cpp index f9a8bea9..ed16de99 100644 --- a/test/object-invoke.cpp +++ b/test/object-invoke.cpp @@ -123,6 +123,27 @@ protected: return TestFail; } + /* Test that direct method invocation bypasses threads. */ + object_.reset(); + object_.invokeMethod(&InvokedObject::method, + ConnectionTypeDirect, 42); + + switch (object_.status()) { + case InvokedObject::NoCall: + cout << "Method not invoked for custom thread" << endl; + return TestFail; + case InvokedObject::CallReceived: + cout << "Method invoked in incorrect thread for direct call" << endl; + return TestFail; + default: + break; + } + + if (object_.value() != 42) { + cout << "Method invoked with incorrect value for direct call" << endl; + return TestFail; + } + /* * Test invoking a method that takes reference arguments. This * targets compilation, there's no need to check runtime -- cgit v1.2.1