initial commit
This commit is contained in:
commit
9d20827c46
2469 changed files with 470994 additions and 0 deletions
24
qa/guitest/guitest.cpp
Normal file
24
qa/guitest/guitest.cpp
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "guitestmanager.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
if (argc < 2) {
|
||||
std::cerr << "Usage: " << argv[0] << " <test>" << std::endl << std::endl;
|
||||
std::cerr << "The following tests are available: " << std::endl;
|
||||
foreach(QString test, GUITestManager::instance()->getTestNames()) {
|
||||
std::cerr << " " << (std::string) test << std::endl;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
QApplication a(argc, argv);
|
||||
if (GUITestManager::instance()->runTest(argv[1])) {
|
||||
return a.exec();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
15
qa/guitest/guitest.h
Normal file
15
qa/guitest/guitest.h
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#ifndef GUITEST_H
|
||||
#define GUITEST_H
|
||||
|
||||
#include <QList>
|
||||
#include <QString>
|
||||
|
||||
class GUITest
|
||||
{
|
||||
public:
|
||||
virtual ~GUITest() { }
|
||||
virtual bool run() = 0;
|
||||
virtual QString name() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
19
qa/guitest/guitest.pro
Normal file
19
qa/guitest/guitest.pro
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
CONFIG -= app_bundle
|
||||
|
||||
MOC_DIR = ../../src/.moc
|
||||
OBJECTS_DIR = ../../src/.obj
|
||||
UI_DIR = ../../src/.ui
|
||||
|
||||
CONFIG += pep
|
||||
DEFINES += QT_STATICPLUGIN
|
||||
|
||||
include(../../conf.pri)
|
||||
include(../../src/src.pri)
|
||||
|
||||
SOURCES += \
|
||||
guitest.cpp \
|
||||
guitestmanager.cpp
|
||||
|
||||
include(../../src/privacy/guitest/guitest.pri)
|
||||
|
||||
QMAKE_CLEAN += ${QMAKE_TARGET}
|
||||
43
qa/guitest/guitestmanager.cpp
Normal file
43
qa/guitest/guitestmanager.cpp
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
#include <QDebug>
|
||||
|
||||
#include "guitestmanager.h"
|
||||
|
||||
GUITestManager::GUITestManager()
|
||||
{
|
||||
}
|
||||
|
||||
GUITestManager* GUITestManager::instance()
|
||||
{
|
||||
if (!instance_) {
|
||||
instance_ = new GUITestManager();
|
||||
}
|
||||
return instance_;
|
||||
}
|
||||
|
||||
void GUITestManager::registerTest(GUITest* test)
|
||||
{
|
||||
tests_ += test;
|
||||
}
|
||||
|
||||
bool GUITestManager::runTest(const QString& name)
|
||||
{
|
||||
foreach(GUITest* test, tests_) {
|
||||
if (test->name() == name) {
|
||||
return test->run();
|
||||
}
|
||||
}
|
||||
qWarning() << "Test not found: " << name;
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList GUITestManager::getTestNames() const
|
||||
{
|
||||
QStringList test_names;
|
||||
foreach(GUITest* test, tests_) {
|
||||
test_names += test->name();
|
||||
}
|
||||
return test_names;
|
||||
}
|
||||
|
||||
|
||||
GUITestManager* GUITestManager::instance_ = NULL;
|
||||
24
qa/guitest/guitestmanager.h
Normal file
24
qa/guitest/guitestmanager.h
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#ifndef GUITESTMANAGER_H
|
||||
#define GUITESTMANAGER_H
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
#include "guitest.h"
|
||||
|
||||
class GUITestManager
|
||||
{
|
||||
public:
|
||||
static GUITestManager* instance();
|
||||
|
||||
void registerTest(GUITest* test);
|
||||
bool runTest(const QString& name);
|
||||
QStringList getTestNames() const;
|
||||
|
||||
private:
|
||||
GUITestManager();
|
||||
|
||||
static GUITestManager* instance_;
|
||||
QList<GUITest*> tests_;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in a new issue