AbstractTestSuite::AbstractTestSuite(const QByteArray &className, const QString &defaultTestsPath, const QString &defaultConfigPath) : shouldGenerateExpectedFailures(false), dynamicMetaObject(0), metaBuilder(new QMetaObjectBuilder) { metaBuilder->setSuperClass(&QObject::staticMetaObject); metaBuilder->setClassName(className); metaBuilder->setStaticMetacallFunction(qt_static_metacall); QString testConfigPath = qgetenv("QTSCRIPT_TEST_CONFIG_DIR"); if (testConfigPath.isEmpty()) testConfigPath = defaultConfigPath; QString configSuffix = qgetenv("QTSCRIPT_TEST_CONFIG_SUFFIX"); skipConfigPath = QString::fromLatin1("%0/skip%1.txt") .arg(testConfigPath).arg(configSuffix); expectFailConfigPath = QString::fromLatin1("%0/expect_fail%1.txt") .arg(testConfigPath).arg(configSuffix); QString testsPath = qgetenv("QTSCRIPT_TEST_DIR"); if (testsPath.isEmpty()) testsPath = defaultTestsPath; testsDir = QDir(testsPath); addTestFunction("initTestCase"); addTestFunction("cleanupTestCase"); // Subclass constructors should add their custom test functions to // the meta-object and call finalizeMetaObject(). }
tst_QScriptV8TestSuite::tst_QScriptV8TestSuite() : AbstractTestSuite("tst_QScriptV8TestSuite", ":/tests", ":/") { // One test function per test file. QFileInfoList testFileInfos; testFileInfos = testsDir.entryInfoList(QStringList() << "*.js", QDir::Files); foreach (QFileInfo tfi, testFileInfos) { QString name = tfi.baseName(); addTestFunction(name); testNames.append(name); }