PDA

View Full Version : create QMetaCallEevnt



cic
21st August 2013, 09:34
since qmetacallevent is private defined, i dont find any documentation so far.
but for the project test purpose i need to create one for testing.

has anyone idea?

In my project, i need to grab the information of each queued signal/slot message for testing.
The messages are for debugging purpose in run time.
Therefore i have modified the notify function.




bool MyApplication::notify(QObject* receiver, QEvent* event)
{
TEST_FLAG(SIGNAL_PROTOCOL)
// test function goes here
END

return QApplication::notify(receiver, event);
}



Since there would be mass of event go through, the performance impact of the function is also of my concern.
That's why i want to test it.

The test function entry is defined with QMetaCallEvent.

In my test environment, I simply setup a loop to see the run time consumption of the test function.



GTEST_XXX()
{
for (int i = 0; i < TEN_MILLION; i++){
// test function
}
}


I used to think by only accessing QMetaObject, QMetaMethod. But it is not able to fulfill my need since the argument value of the signal transmitted is also for me important.

anda_skoa
21st August 2013, 12:24
QMetaCallEvent is used internally by Qt's QMetaMethod::invoke() system, usually used through either signal/slot connection or QMetaObject::invokeMethod().

Can you explain what you are trying to test or why you would have to explicitly create such an event instance yourself?

Cheers,
_

cic
21st August 2013, 14:13
@anda_skoa,

hello, i have modified my post above.

but is there any problem, i ve tried to post 3 times failed always.!

anda_skoa
22nd August 2013, 12:46
I am not sure I understand yet, but if you are looking for a way to test signal emits in a test program then have a look a QSignalSpy

Cheers,
_