KUnitTest
Go to the documentation of this file.
31 #include <QtCore/QMetaEnum>
32 #include <QtCore/QRect>
33 #include <QtCore/QVector>
45 qDeleteAll( m_resultsList );
49 void SlotTester::invokeMember(
const QString &str)
51 QString slotname = QString::number(QSLOT_CODE) + str;
52 connect(
this, SIGNAL(
invoke()),
this, slotname.toLatin1().constData());
54 disconnect(
this, SIGNAL(
invoke()),
this, slotname.toLatin1().constData());
59 QVector<QByteArray> allSlots;
60 const int methodCount = metaObject()->methodCount();
61 const int methodOffset = metaObject()->methodOffset();
62 allSlots.reserve( methodCount );
63 for (
int i=0 ; i < methodCount; ++i )
65 QMetaMethod method = metaObject()->method( methodOffset + i );
66 if ( method.methodType() == QMetaMethod::Slot )
67 allSlots.append( method.signature() );
70 if ( allSlots.contains(
"setUp()") )
71 invokeMember(
"setUp()");
73 foreach (
const QByteArray &sl, allSlots )
75 if ( sl.startsWith(
"test") )
81 cout <<
"KUnitTest_Debug_BeginSlot[" << sl.data() <<
"]" << endl;
83 cout <<
"KUnitTest_Debug_EndSlot[" << sl.data() <<
"]" << endl;
87 if ( allSlots.contains(
"tearDown()") )
88 invokeMember(
"tearDown()");
95 if ( !m_resultsList.contains(sl) )
98 return m_resultsList[sl];
103 str <<
"[" << r.x() <<
"," << r.y() <<
" - " << r.width() <<
"x" << r.height() <<
"]";
108 str <<
"(" << r.x() <<
"," << r.y() <<
")";
113 str <<
"[" << r.width() <<
"x" << r.height() <<
"]";
117 #include "tester.moc"
virtual TestResults * results() const
QTextStream & operator<<(QTextStream &str, const QRect &r)
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:52:07 by
doxygen 1.8.7 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.