Commit 7fde14f0 authored by Mitch Curtis's avatar Mitch Curtis
Browse files

testwizard: put _data function before test function.



Most Qt tests follow this order.

Change-Id: I261f425a33538ca3f19d9da7ec09061677c2b627
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
parent fd9b2af9
......@@ -108,9 +108,9 @@ static QString generateTestCode(const TestWizardParameters &testParams,
writeVoidMemberDeclaration(str, indent, QLatin1String(cleanupTestCaseC));
}
const QString dataSlot = testParams.testSlot + QLatin1String("_data");
writeVoidMemberDeclaration(str, indent, testParams.testSlot);
if (testParams.useDataSet)
writeVoidMemberDeclaration(str, indent, dataSlot);
writeVoidMemberDeclaration(str, indent, testParams.testSlot);
str << "};\n\n";
// Code: Constructor
str << testParams.className << "::" << testParams.className << "()\n{\n}\n\n";
......@@ -119,6 +119,13 @@ static QString generateTestCode(const TestWizardParameters &testParams,
writeVoidMemberBody(str, testParams.className, QLatin1String(initTestCaseC));
writeVoidMemberBody(str, testParams.className, QLatin1String(cleanupTestCaseC));
}
// test data generation slot
if (testParams.useDataSet) {
writeVoidMemberBody(str, testParams.className, dataSlot, false);
str << indent << "QTest::addColumn<" << testDataTypeC << ">(\"data\");\n"
<< indent << "QTest::newRow(\"0\") << " << testDataTypeC << "();\n"
<< closeFunctionC;
}
// Test slot with data or dummy
writeVoidMemberBody(str, testParams.className, testParams.testSlot, false);
if (testParams.useDataSet)
......@@ -132,13 +139,6 @@ static QString generateTestCode(const TestWizardParameters &testParams,
break;
}
str << closeFunctionC;
// test data generation slot
if (testParams.useDataSet) {
writeVoidMemberBody(str, testParams.className, dataSlot, false);
str << indent << "QTest::addColumn<" << testDataTypeC << ">(\"data\");\n"
<< indent << "QTest::newRow(\"0\") << " << testDataTypeC << "();\n"
<< closeFunctionC;
}
// Main & moc include
str << (testParams.requiresQApplication ? "QTEST_MAIN" : "QTEST_APPLESS_MAIN")
<< '(' << testParams.className << ")\n\n"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment