Deal with no High Fidelity folder

This commit is contained in:
NissimHadar 2018-09-06 16:04:15 -07:00
parent e914b3ad66
commit e9a1da832e
2 changed files with 13 additions and 15 deletions

View file

@ -29,7 +29,7 @@ void TestRunner::run() {
// This will be restored at the end of the tests
saveExistingHighFidelityAppDataFolder();
// Download the latest High Fidelity installer
QStringList urls;
urls << INSTALLER_URL;
@ -79,23 +79,22 @@ void TestRunner::saveExistingHighFidelityAppDataFolder() {
_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);
if (_appDataFolder.exists()) {
// The original folder is saved in a unique name
_savedAppDataFolder = dataDirectory + "/" + UNIQUE_FOLDER_NAME;
_appDataFolder.rename(_appDataFolder.path(), _savedAppDataFolder.path());
}
// The original folder is saved in a unique name
_savedAppDataFolder = dataDirectory + "/" + UNIQUE_FOLDER_NAME;
_appDataFolder.rename(_appDataFolder.path(), _savedAppDataFolder.path());
// Copy an "empty" AppData folder (i.e. no entities)
copyFolder(QDir::currentPath() + "/AppDataHighFidelity", _appDataFolder.path());
}
void TestRunner::restoreHighFidelityAppDataFolder() {
_appDataFolder.removeRecursively();
_appDataFolder.rename(_savedAppDataFolder.path(), _appDataFolder.path());
if (_savedAppDataFolder != QDir()) {
_appDataFolder.rename(_savedAppDataFolder.path(), _appDataFolder.path());
}
}
void TestRunner::selectTemporaryFolder() {
@ -176,6 +175,10 @@ void TestRunner::evaluateResults() {
autoTester->startTestsEvaluation(false, true, _snapshotFolder, _branch, _user);
}
void TestRunner::automaticTestRunEvaluationComplete() {
restoreHighFidelityAppDataFolder();
}
// Copies a folder recursively
void TestRunner::copyFolder(const QString& source, const QString& destination) {
try {
@ -207,7 +210,3 @@ void TestRunner::copyFolder(const QString& source, const QString& destination) {
exit(-1);
}
}
void TestRunner::automaticTestRunEvaluationComplete() {
restoreHighFidelityAppDataFolder();
}

View file

@ -105,7 +105,6 @@ private:
HelpWindow _helpWindow;
void* _caller;
};