bool NovenaTestEngine::runNextTest(int continueOnErrors)
{
    if (errorCount && !continueOnErrors && !debugMode) {
        QString str;
        str.append(testsToRun.at(currentTestNumber)->testName());
        ui->finishTests(false);
        emit testsFinished();
        return false;
    }

    // Increment the test number, and return if we've run out of tests.
    currentTestNumber++;
    if (currentTestNumber >= testsToRun.count()) {
        ui->setProgressBar(1);
        ui->finishTests(errorCount?false:true);
        emit testsFinished();
        return false;
    }

    currentTest = testsToRun[currentTestNumber];

    currentThread = new NovenaTestEngineThread(currentTest);
    QObject::connect(currentThread, SIGNAL(finished()),
                     this, SLOT(cleanupCurrentTest()));
    currentThread->start();

    ui->setStatusText(currentTest->testName());
    ui->setProgressBar(currentTestNumber*1.0/testsToRun.count());
    QString progressText;
    progressText.sprintf("Progress: %d/%d", currentTestNumber+1, testsToRun.count());
    ui->setProgressText(progressText);
    return true;
}
Exemple #2
0
void tst_QDeclarativeDebug_Thread::run()
{
    bool ok = false;

    QDeclarativeDebugConnection conn;
    conn.connectToHost("127.0.0.1", 3768);
    ok = conn.waitForConnected();
    Q_ASSERT(ok);

    QEventLoop loop;
    connect(m_data, SIGNAL(engineCreated()), &loop, SLOT(quit()));
    loop.exec();

    m_data->conn = &conn;

    Q_ASSERT(m_factory);
    QObject *test = m_factory->createTest(m_data);
    Q_ASSERT(test);
    int code = QTest::qExec(test, QCoreApplication::arguments()); 
    delete test;
    emit testsFinished(code);
}