On Mon, Mar 26, 2012 at 2:37 PM, <[email protected]> wrote:
> I've got some test slots which should only trigger when the signal arrived.
> How can I test this? I want to use them like they're normal test cases but
> that they don't get called automatically.
Don't put it on the test at all. Create another QObject subclass for
it, something like this:
class SomeOtherObject : public QObject
{
Q_OBJECT
slots:
void signalReceivedTest()
{
qDebug("Called");
}
};
MFE_Protocol_Unit_Tests::MFE_Protocol_Unit_Tests()
{
SomeOtherObj obj;
QObject::connect(&connection, SIGNAL(click()),
&obj,SLOT(signalReceivedTest()));
// wouldn't work since there is no connection & obj would be
deleted when it goes out of scope, but you get the idea
}
_______________________________________________
Interest mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/interest