Remove code related to test location.
Testlib no longer does anything with the test location, and neither do any of Qt's tests, so the code is no longer needed. Change-Id: I1a464116179f3e26efadad6901f00f3c33e0ce84 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
This commit is contained in:
parent
1b23336a29
commit
45cf303d3a
@ -1499,13 +1499,10 @@ static void qInvokeTestMethodDataEntry(char *slot)
|
|||||||
/* Benchmarking: for each accumulation iteration*/
|
/* Benchmarking: for each accumulation iteration*/
|
||||||
bool invokeOk;
|
bool invokeOk;
|
||||||
do {
|
do {
|
||||||
QTestResult::setCurrentTestLocation(QTestResult::InitFunc);
|
|
||||||
invokeMethod(QTest::currentTestObject, "init()");
|
invokeMethod(QTest::currentTestObject, "init()");
|
||||||
if (QTestResult::skipCurrentTest())
|
if (QTestResult::skipCurrentTest())
|
||||||
break;
|
break;
|
||||||
|
|
||||||
QTestResult::setCurrentTestLocation(QTestResult::Func);
|
|
||||||
|
|
||||||
QBenchmarkTestMethodData::current->result = QBenchmarkResult();
|
QBenchmarkTestMethodData::current->result = QBenchmarkResult();
|
||||||
QBenchmarkTestMethodData::current->resultAccepted = false;
|
QBenchmarkTestMethodData::current->resultAccepted = false;
|
||||||
|
|
||||||
@ -1521,10 +1518,8 @@ static void qInvokeTestMethodDataEntry(char *slot)
|
|||||||
|
|
||||||
QTestResult::finishedCurrentTestData();
|
QTestResult::finishedCurrentTestData();
|
||||||
|
|
||||||
QTestResult::setCurrentTestLocation(QTestResult::CleanupFunc);
|
|
||||||
invokeMethod(QTest::currentTestObject, "cleanup()");
|
invokeMethod(QTest::currentTestObject, "cleanup()");
|
||||||
QTestResult::finishedCurrentTestDataCleanup();
|
QTestResult::finishedCurrentTestDataCleanup();
|
||||||
QTestResult::setCurrentTestLocation(QTestResult::NoWhere);
|
|
||||||
|
|
||||||
// If this test method has a benchmark, repeat until all measurements are
|
// If this test method has a benchmark, repeat until all measurements are
|
||||||
// acceptable.
|
// acceptable.
|
||||||
@ -1593,7 +1588,6 @@ static bool qInvokeTestMethod(const char *slotName, const char *data=0)
|
|||||||
QTestResult::setCurrentGlobalTestData(gTable->testData(curGlobalDataIndex));
|
QTestResult::setCurrentGlobalTestData(gTable->testData(curGlobalDataIndex));
|
||||||
|
|
||||||
if (curGlobalDataIndex == 0) {
|
if (curGlobalDataIndex == 0) {
|
||||||
QTestResult::setCurrentTestLocation(QTestResult::DataFunc);
|
|
||||||
qsnprintf(member, 512, "%s_data()", slot);
|
qsnprintf(member, 512, "%s_data()", slot);
|
||||||
invokeMethod(QTest::currentTestObject, member);
|
invokeMethod(QTest::currentTestObject, member);
|
||||||
}
|
}
|
||||||
@ -1747,12 +1741,10 @@ static void qInvokeTestMethods(QObject *testObject)
|
|||||||
QTEST_ASSERT(metaObject);
|
QTEST_ASSERT(metaObject);
|
||||||
QTestLog::startLogging();
|
QTestLog::startLogging();
|
||||||
QTestResult::setCurrentTestFunction("initTestCase");
|
QTestResult::setCurrentTestFunction("initTestCase");
|
||||||
QTestResult::setCurrentTestLocation(QTestResult::DataFunc);
|
|
||||||
QTestTable::globalTestTable();
|
QTestTable::globalTestTable();
|
||||||
invokeMethod(testObject, "initTestCase_data()");
|
invokeMethod(testObject, "initTestCase_data()");
|
||||||
|
|
||||||
if (!QTestResult::skipCurrentTest() && !QTest::currentTestFailed()) {
|
if (!QTestResult::skipCurrentTest() && !QTest::currentTestFailed()) {
|
||||||
QTestResult::setCurrentTestLocation(QTestResult::InitFunc);
|
|
||||||
invokeMethod(testObject, "initTestCase()");
|
invokeMethod(testObject, "initTestCase()");
|
||||||
|
|
||||||
// finishedCurrentTestDataCleanup() resets QTestResult::currentTestFailed(), so use a local copy.
|
// finishedCurrentTestDataCleanup() resets QTestResult::currentTestFailed(), so use a local copy.
|
||||||
|
@ -59,7 +59,6 @@ namespace QTest
|
|||||||
static const char *currentTestObjectName = 0;
|
static const char *currentTestObjectName = 0;
|
||||||
static bool failed = false;
|
static bool failed = false;
|
||||||
static bool skipCurrentTest = false;
|
static bool skipCurrentTest = false;
|
||||||
static QTestResult::TestLocation location = QTestResult::NoWhere;
|
|
||||||
|
|
||||||
static const char *expectFailComment = 0;
|
static const char *expectFailComment = 0;
|
||||||
static int expectFailMode = 0;
|
static int expectFailMode = 0;
|
||||||
@ -74,7 +73,6 @@ void QTestResult::reset()
|
|||||||
QTest::currentTestFunc = 0;
|
QTest::currentTestFunc = 0;
|
||||||
QTest::currentTestObjectName = 0;
|
QTest::currentTestObjectName = 0;
|
||||||
QTest::failed = false;
|
QTest::failed = false;
|
||||||
QTest::location = QTestResult::NoWhere;
|
|
||||||
|
|
||||||
QTest::expectFailComment = 0;
|
QTest::expectFailComment = 0;
|
||||||
QTest::expectFailMode = 0;
|
QTest::expectFailMode = 0;
|
||||||
@ -112,8 +110,6 @@ void QTestResult::setCurrentTestFunction(const char *func)
|
|||||||
{
|
{
|
||||||
QTest::currentTestFunc = func;
|
QTest::currentTestFunc = func;
|
||||||
QTest::failed = false;
|
QTest::failed = false;
|
||||||
if (!func)
|
|
||||||
QTest::location = NoWhere;
|
|
||||||
if (func)
|
if (func)
|
||||||
QTestLog::enterTestFunction(func);
|
QTestLog::enterTestFunction(func);
|
||||||
}
|
}
|
||||||
@ -152,7 +148,6 @@ void QTestResult::finishedCurrentTestFunction()
|
|||||||
{
|
{
|
||||||
QTest::currentTestFunc = 0;
|
QTest::currentTestFunc = 0;
|
||||||
QTest::failed = false;
|
QTest::failed = false;
|
||||||
QTest::location = NoWhere;
|
|
||||||
|
|
||||||
QTestLog::leaveTestFunction();
|
QTestLog::leaveTestFunction();
|
||||||
}
|
}
|
||||||
@ -289,16 +284,6 @@ void QTestResult::addSkip(const char *message, const char *file, int line)
|
|||||||
QTestLog::addSkip(message, file, line);
|
QTestLog::addSkip(message, file, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
QTestResult::TestLocation QTestResult::currentTestLocation()
|
|
||||||
{
|
|
||||||
return QTest::location;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QTestResult::setCurrentTestLocation(TestLocation loc)
|
|
||||||
{
|
|
||||||
QTest::location = loc;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QTestResult::setCurrentTestObject(const char *name)
|
void QTestResult::setCurrentTestObject(const char *name)
|
||||||
{
|
{
|
||||||
QTest::currentTestObjectName = name;
|
QTest::currentTestObjectName = name;
|
||||||
|
@ -63,14 +63,11 @@ class QTestData;
|
|||||||
class Q_TESTLIB_EXPORT QTestResult
|
class Q_TESTLIB_EXPORT QTestResult
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum TestLocation { NoWhere = 0, DataFunc = 1, InitFunc = 2, Func = 3, CleanupFunc = 4 };
|
|
||||||
|
|
||||||
static const char *currentTestObjectName();
|
static const char *currentTestObjectName();
|
||||||
static bool currentTestFailed();
|
static bool currentTestFailed();
|
||||||
static QTestData *currentTestData();
|
static QTestData *currentTestData();
|
||||||
static QTestData *currentGlobalTestData();
|
static QTestData *currentGlobalTestData();
|
||||||
static const char *currentTestFunction();
|
static const char *currentTestFunction();
|
||||||
static TestLocation currentTestLocation();
|
|
||||||
static const char *currentDataTag();
|
static const char *currentDataTag();
|
||||||
static const char *currentGlobalDataTag();
|
static const char *currentGlobalDataTag();
|
||||||
static void finishedCurrentTestData();
|
static void finishedCurrentTestData();
|
||||||
@ -86,7 +83,6 @@ public:
|
|||||||
static void setCurrentGlobalTestData(QTestData *data);
|
static void setCurrentGlobalTestData(QTestData *data);
|
||||||
static void setCurrentTestData(QTestData *data);
|
static void setCurrentTestData(QTestData *data);
|
||||||
static void setCurrentTestFunction(const char *func);
|
static void setCurrentTestFunction(const char *func);
|
||||||
static void setCurrentTestLocation(TestLocation loc);
|
|
||||||
static void setCurrentTestObject(const char *name);
|
static void setCurrentTestObject(const char *name);
|
||||||
static void addSkip(const char *message, const char *file, int line);
|
static void addSkip(const char *message, const char *file, int line);
|
||||||
static bool expectFail(const char *dataIndex, const char *comment,
|
static bool expectFail(const char *dataIndex, const char *comment,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user