mirror of
https://github.com/overte-org/overte.git
synced 2025-07-16 20:37:29 +02:00
Added new class.
This commit is contained in:
parent
4e677c85f6
commit
fb80e9c395
4 changed files with 87 additions and 29 deletions
|
@ -921,35 +921,7 @@ void Test::createTestRailRun() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test::runNow() {
|
void Test::runNow() {
|
||||||
// Rename the existing data directory, and create an empty one
|
testRunner.run();
|
||||||
QString dataDirectory{ "NOT FOUND" };
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
dataDirectory = qgetenv("USERPROFILE") + "\\AppData\\Roaming";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QDir highfidelityDirectory{ dataDirectory + "\\High Fidelity" };
|
|
||||||
|
|
||||||
if (!highfidelityDirectory.exists()) {
|
|
||||||
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
|
||||||
"The High Fidelity data folder was not found in " + dataDirectory);
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// The original folder is saved in a unique name
|
|
||||||
QDir savedDataFolder{ dataDirectory + "/fgadhcUDHSFaidsfh3478JJJFSDFIUSOEIrf" };
|
|
||||||
highfidelityDirectory.rename(QDir::fromNativeSeparators(highfidelityDirectory.path()),
|
|
||||||
QDir::toNativeSeparators(savedDataFolder.path()));
|
|
||||||
|
|
||||||
QDir().mkdir(highfidelityDirectory.path());
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Finally - restore the data folder
|
|
||||||
QDir().rmdir(highfidelityDirectory.path());
|
|
||||||
|
|
||||||
highfidelityDirectory.rename(QDir::fromNativeSeparators(savedDataFolder.path()),
|
|
||||||
QDir::toNativeSeparators(highfidelityDirectory.path()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Test::updateTestRailRunResult() {
|
void Test::updateTestRailRunResult() {
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "ImageComparer.h"
|
#include "ImageComparer.h"
|
||||||
#include "ui/MismatchWindow.h"
|
#include "ui/MismatchWindow.h"
|
||||||
#include "TestRailInterface.h"
|
#include "TestRailInterface.h"
|
||||||
|
#include "TestRunner.h"
|
||||||
|
|
||||||
class Step {
|
class Step {
|
||||||
public:
|
public:
|
||||||
|
@ -107,6 +108,8 @@ private:
|
||||||
|
|
||||||
ImageComparer _imageComparer;
|
ImageComparer _imageComparer;
|
||||||
|
|
||||||
|
TestRunner testRunner;
|
||||||
|
|
||||||
QString _testResultsFolderPath;
|
QString _testResultsFolderPath;
|
||||||
int _index { 1 };
|
int _index { 1 };
|
||||||
|
|
||||||
|
|
51
tools/auto-tester/src/TestRunner.cpp
Normal file
51
tools/auto-tester/src/TestRunner.cpp
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
//
|
||||||
|
// Downloader.cpp
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on 1 Sep 2018.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
#include "TestRunner.h"
|
||||||
|
|
||||||
|
#include <QtWidgets/QMessageBox>
|
||||||
|
|
||||||
|
TestRunner::TestRunner(QObject *parent) : QObject(parent) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRunner::run() {
|
||||||
|
saveExistingHighFidelityAppDataFolder();
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
restoreHighFidelityAppDataFolder();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRunner::saveExistingHighFidelityAppDataFolder() {
|
||||||
|
QString dataDirectory{ "NOT FOUND" };
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
dataDirectory = qgetenv("USERPROFILE") + "\\AppData\\Roaming";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
appDataFolder = dataDirectory + "\\High Fidelity";
|
||||||
|
|
||||||
|
if (!appDataFolder.exists()) {
|
||||||
|
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__),
|
||||||
|
"The High Fidelity data folder was not found in " + dataDirectory);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The original folder is saved in a unique name
|
||||||
|
savedAppDataFolder = dataDirectory + "/fgadhcUDHSFaidsfh3478JJJFSDFIUSOEIrf";
|
||||||
|
appDataFolder.rename(QDir::fromNativeSeparators(appDataFolder.path()), QDir::toNativeSeparators(savedAppDataFolder.path()));
|
||||||
|
|
||||||
|
QDir().mkdir(appDataFolder.path());
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestRunner::restoreHighFidelityAppDataFolder() {
|
||||||
|
QDir().rmdir(appDataFolder.path());
|
||||||
|
|
||||||
|
appDataFolder.rename(QDir::fromNativeSeparators(savedAppDataFolder.path()), QDir::toNativeSeparators(appDataFolder.path()));
|
||||||
|
}
|
32
tools/auto-tester/src/TestRunner.h
Normal file
32
tools/auto-tester/src/TestRunner.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
//
|
||||||
|
// Downloader.h
|
||||||
|
//
|
||||||
|
// Created by Nissim Hadar on 1 Sep 2018.
|
||||||
|
// Copyright 2013 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef hifi_testRunner_h
|
||||||
|
#define hifi_testRunner_h
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QDirIterator>
|
||||||
|
|
||||||
|
class TestRunner : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit TestRunner(QObject *parent = 0);
|
||||||
|
|
||||||
|
void run();
|
||||||
|
|
||||||
|
void saveExistingHighFidelityAppDataFolder();
|
||||||
|
void restoreHighFidelityAppDataFolder();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QDir appDataFolder;
|
||||||
|
QDir savedAppDataFolder;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // hifi_testRunner_h
|
Loading…
Reference in a new issue