~ubuntu-branches/ubuntu/vivid/psi/vivid

« back to all changes in this revision

Viewing changes to qa/guitest/guitestmanager.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-08-28 18:46:52 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080828184652-iiik12dl91nq7cdi
Tags: 0.12-2
Uploading to unstable (Closes: Bug#494352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <QDebug>
 
2
 
 
3
#include "guitestmanager.h"
 
4
 
 
5
GUITestManager::GUITestManager()
 
6
{
 
7
}
 
8
 
 
9
GUITestManager* GUITestManager::instance()
 
10
{
 
11
        if (!instance_) {
 
12
                instance_ = new GUITestManager();
 
13
        }
 
14
        return instance_;
 
15
}
 
16
 
 
17
void GUITestManager::registerTest(GUITest* test) 
 
18
{
 
19
        tests_ += test;
 
20
}
 
21
 
 
22
bool GUITestManager::runTest(const QString& name)
 
23
{
 
24
        foreach(GUITest* test, tests_) {
 
25
                if (test->name() == name) {
 
26
                        return test->run();
 
27
                }
 
28
        }
 
29
        qWarning() << "Test not found: " << name;
 
30
        return false;
 
31
}
 
32
 
 
33
QStringList GUITestManager::getTestNames() const
 
34
{
 
35
        QStringList test_names;
 
36
        foreach(GUITest* test, tests_) {
 
37
                test_names += test->name();
 
38
        }
 
39
        return test_names;
 
40
}
 
41
 
 
42
 
 
43
GUITestManager* GUITestManager::instance_ = NULL;