createTests fixed.

This commit is contained in:
NissimHadar 2018-03-03 18:22:51 -08:00
parent 0a2610a9e0
commit b32ad2f69c
2 changed files with 2 additions and 12 deletions

View file

@ -344,13 +344,7 @@ void Test::createTest() {
const int maxImages = pow(10, NUM_DIGITS);
foreach (QString currentFilename, sortedImageFilenames) {
QString fullCurrentFilename = imageSourceDirectory + "/" + currentFilename;
if (isInExpectedImageFilenameFormat(currentFilename)) {
if (!QFile::remove(fullCurrentFilename)) {
messageBox.critical(0, "Error", "Could not delete existing file: " + currentFilename + "\nTest creation aborted");
exit(-1);
}
} else if (isInSnapshotFilenameFormat(currentFilename)) {
if (isInSnapshotFilenameFormat(currentFilename)) {
if (i >= maxImages) {
messageBox.critical(0, "Error", "More than " + QString::number(maxImages) + " images not supported");
exit(-1);
@ -360,6 +354,7 @@ void Test::createTest() {
QString fullNewFileName = imageDestinationDirectory + "/" + newFilename;
try {
QFile::remove(fullNewFileName);
QFile::copy(fullCurrentFilename, fullNewFileName);
} catch (...) {
messageBox.critical(0, "Error", "Could not delete existing file: " + currentFilename + "\nTest creation aborted");
@ -471,7 +466,3 @@ QString Test::getExpectedImagePartialSourceDirectory(QString filename) {
return result;
}
bool Test::isInExpectedImageFilenameFormat(QString filename) {
return (expectedImageFilenameFormat.match(filename).hasMatch());
}

View file

@ -36,7 +36,6 @@ public:
QStringList createListOfAll_IMAGE_FORMAT_imagesInDirectory(QString pathToImageDirectory);
bool isInSnapshotFilenameFormat(QString filename);
bool isInExpectedImageFilenameFormat(QString filename);
void importTest(QTextStream& textStream, const QString& testPathname);