qcpix/tsrc/qttestutil/testregistry.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 10:53:26 +0300
changeset 15 cf5c74390b98
permissions -rw-r--r--
Revision: 201031 Kit: 201033

/*
 * Copyright (C) 2008  Remko Troncon
 * Licensed under the MIT license.
 * See COPYING for license details.
 */

#include "QtTestUtil/TestRegistry.h"

#include <QtTest/QtTest>

namespace QtTestUtil {

TestRegistry* TestRegistry::getInstance() {
    static TestRegistry registry;
    return &registry;
}

void TestRegistry::registerTest(QObject* test) {
    tests_ += test;
}

int TestRegistry::runTests(int argc, char* argv[]) {
    int result = 0;
    foreach(QObject* test, tests_) {
        result |= QTest::qExec(test, argc, argv);
    }
    return result;
}

}