void cancelExport()
    {
        TestThread cancelThread;
        QLandmarkFileHandlerGpx handler(&(cancelThread.m_cancel));
        QLandmark lm;
        QList<QLandmark> lms;
        for (int i=0; i < 50000; ++i) {
            lm.setName(QString("LM%1").arg(0));
            lms.append(lm);
        }

        handler.setWaypoints(lms);
        cancelThread.start();
        QFile file(m_exportFile);
        QVERIFY(!handler.exportData(&file));
        QCOMPARE(handler.error(), QLandmarkManager::CancelError);
        cancelThread.wait();
    }
Esempio n. 2
0
void GetCurrentProcessThreadCountTest(bool printInfo)
{
    dword before = GetCurrentProcessThreadCount();

    {
        TestThread thread;
        thread.wait();
    }

    dword after = GetCurrentProcessThreadCount();

    if (printInfo)
    {
        using namespace std;

        cout << std::endl
             << "Threads in process : " << before << endl
             << "Create & destroy 2 threads" << endl
             << "Threads in process: " << after << endl;
    }

    TUT_ASSERT(before == after);
    TUT_ASSERT(GInsideThreadCount == (before + 1));
}
Esempio n. 3
0
void test_thread ()
{
	TestThread thread;
	thread.start();
	thread.wait();
}
Esempio n. 4
0
int main(int argc, char *argv[])
{
    Settings settings;
    bool resolutionFromCmdLine = false;

    if (!readSettingsFromCommandLine(argc, argv, settings))
        return 1;

    if (settings.size().width() > 0 && settings.size().height() > 0)
        resolutionFromCmdLine = true;

    // Start measuring here
    QTime t;
    t.start();
    QApplication app(argc, argv);
    app.setApplicationName("GraphicsViewBenchmark");

    MainView mainView(settings.options().testFlag(Settings::UseOpenGL),
                      settings.options().testFlag(Settings::OutputFps));

    if ((settings.angle() % 360) != 0)
        mainView.rotateContent(settings.angle());

    if (resolutionFromCmdLine) {
        mainView.resize(settings.size().width(), settings.size().height());
        mainView.show();
    }
    else {
#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5)
    mainView.showFullScreen();
#else
    mainView.resize(360, 640);
    mainView.show();
#endif
    }

    // Stop measuring here
    int creationTime = t.elapsed();

    qRegisterMetaType<Theme::Themes>("Theme::Themes");
    qRegisterMetaType<Benchmark::ListType>("Benchmark::ListType");
    qRegisterMetaType<TestFunctionResult*>("TestFunctionResult*");
    qRegisterMetaType<Benchmark*>("Benchmark*");
    qRegisterMetaType<ScriptRunner*>("ScriptRunner*");
    qRegisterMetaType<ResultLogger*>("ResultLogger*");

    TestController tc(settings.outputFileName(), &mainView, ResultLogger::ResultFormat(settings.resultFormat()));
    if (settings.options().testFlag(Settings::UseListItemCache))
        tc.setSubtreeCache(true);
    if(settings.options().testFlag(Settings::NoResourceUsage))
        tc.setCpuMemLogging(false);
    TestThread *tt = new ScriptRunner(settings.scriptName(), &tc, &app);

    tt->addTestFunctionBenchmark("Startup", "Creation time of application and main window (ms).", creationTime);

    QTimer::singleShot(500, tt, SLOT(start()));

    int val = app.exec();

    tt->wait();
    delete tt;

    return val;
}