Dedent a block of code in a namespace for consistency with the rest of the block
Change-Id: I98920db658547f5301d31ffdc9efb6fdd6f6fc5a Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
This commit is contained in:
parent
b22e50acda
commit
e089989bac
@ -282,74 +282,74 @@ namespace QTestPrivate
|
|||||||
|
|
||||||
namespace QTest
|
namespace QTest
|
||||||
{
|
{
|
||||||
class WatchDog;
|
class WatchDog;
|
||||||
|
|
||||||
static QObject *currentTestObject = 0;
|
static QObject *currentTestObject = 0;
|
||||||
static QString mainSourcePath;
|
static QString mainSourcePath;
|
||||||
|
|
||||||
#if defined(Q_OS_MACOS)
|
#if defined(Q_OS_MACOS)
|
||||||
bool macNeedsActivate = false;
|
bool macNeedsActivate = false;
|
||||||
IOPMAssertionID powerID;
|
IOPMAssertionID powerID;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class TestMethods {
|
class TestMethods {
|
||||||
Q_DISABLE_COPY(TestMethods)
|
Q_DISABLE_COPY(TestMethods)
|
||||||
public:
|
public:
|
||||||
typedef std::vector<QMetaMethod> MetaMethods;
|
typedef std::vector<QMetaMethod> MetaMethods;
|
||||||
|
|
||||||
explicit TestMethods(const QObject *o, const MetaMethods &m = MetaMethods());
|
explicit TestMethods(const QObject *o, const MetaMethods &m = MetaMethods());
|
||||||
|
|
||||||
void invokeTests(QObject *testObject) const;
|
void invokeTests(QObject *testObject) const;
|
||||||
|
|
||||||
static QMetaMethod findMethod(const QObject *obj, const char *signature);
|
static QMetaMethod findMethod(const QObject *obj, const char *signature);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool invokeTest(int index, const char *data, WatchDog *watchDog) const;
|
bool invokeTest(int index, const char *data, WatchDog *watchDog) const;
|
||||||
void invokeTestOnData(int index) const;
|
void invokeTestOnData(int index) const;
|
||||||
|
|
||||||
QMetaMethod m_initTestCaseMethod; // might not exist, check isValid().
|
QMetaMethod m_initTestCaseMethod; // might not exist, check isValid().
|
||||||
QMetaMethod m_initTestCaseDataMethod;
|
QMetaMethod m_initTestCaseDataMethod;
|
||||||
QMetaMethod m_cleanupTestCaseMethod;
|
QMetaMethod m_cleanupTestCaseMethod;
|
||||||
QMetaMethod m_initMethod;
|
QMetaMethod m_initMethod;
|
||||||
QMetaMethod m_cleanupMethod;
|
QMetaMethod m_cleanupMethod;
|
||||||
|
|
||||||
MetaMethods m_methods;
|
MetaMethods m_methods;
|
||||||
};
|
};
|
||||||
|
|
||||||
TestMethods::TestMethods(const QObject *o, const MetaMethods &m)
|
TestMethods::TestMethods(const QObject *o, const MetaMethods &m)
|
||||||
: m_initTestCaseMethod(TestMethods::findMethod(o, "initTestCase()"))
|
: m_initTestCaseMethod(TestMethods::findMethod(o, "initTestCase()"))
|
||||||
, m_initTestCaseDataMethod(TestMethods::findMethod(o, "initTestCase_data()"))
|
, m_initTestCaseDataMethod(TestMethods::findMethod(o, "initTestCase_data()"))
|
||||||
, m_cleanupTestCaseMethod(TestMethods::findMethod(o, "cleanupTestCase()"))
|
, m_cleanupTestCaseMethod(TestMethods::findMethod(o, "cleanupTestCase()"))
|
||||||
, m_initMethod(TestMethods::findMethod(o, "init()"))
|
, m_initMethod(TestMethods::findMethod(o, "init()"))
|
||||||
, m_cleanupMethod(TestMethods::findMethod(o, "cleanup()"))
|
, m_cleanupMethod(TestMethods::findMethod(o, "cleanup()"))
|
||||||
, m_methods(m)
|
, m_methods(m)
|
||||||
{
|
{
|
||||||
if (m.empty()) {
|
if (m.empty()) {
|
||||||
const QMetaObject *metaObject = o->metaObject();
|
const QMetaObject *metaObject = o->metaObject();
|
||||||
const int count = metaObject->methodCount();
|
const int count = metaObject->methodCount();
|
||||||
m_methods.reserve(count);
|
m_methods.reserve(count);
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
const QMetaMethod me = metaObject->method(i);
|
const QMetaMethod me = metaObject->method(i);
|
||||||
if (isValidSlot(me))
|
if (isValidSlot(me))
|
||||||
m_methods.push_back(me);
|
m_methods.push_back(me);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QMetaMethod TestMethods::findMethod(const QObject *obj, const char *signature)
|
QMetaMethod TestMethods::findMethod(const QObject *obj, const char *signature)
|
||||||
{
|
{
|
||||||
const QMetaObject *metaObject = obj->metaObject();
|
const QMetaObject *metaObject = obj->metaObject();
|
||||||
const int funcIndex = metaObject->indexOfMethod(signature);
|
const int funcIndex = metaObject->indexOfMethod(signature);
|
||||||
return funcIndex >= 0 ? metaObject->method(funcIndex) : QMetaMethod();
|
return funcIndex >= 0 ? metaObject->method(funcIndex) : QMetaMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int keyDelay = -1;
|
static int keyDelay = -1;
|
||||||
static int mouseDelay = -1;
|
static int mouseDelay = -1;
|
||||||
static int eventDelay = -1;
|
static int eventDelay = -1;
|
||||||
#if QT_CONFIG(thread)
|
#if QT_CONFIG(thread)
|
||||||
static int timeout = -1;
|
static int timeout = -1;
|
||||||
#endif
|
#endif
|
||||||
static bool noCrashHandler = false;
|
static bool noCrashHandler = false;
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
Invoke a method of the object without generating warning if the method does not exist
|
Invoke a method of the object without generating warning if the method does not exist
|
||||||
|
Loading…
x
Reference in New Issue
Block a user