From 5a79f272f3e9ef29ed87977c586b2d7c34edc852 Mon Sep 17 00:00:00 2001 From: NissimHadar Date: Sun, 4 Mar 2018 20:56:57 -0800 Subject: [PATCH] Allow multiple evaluations. --- tools/auto-tester/src/Test.cpp | 18 ++++++++++++------ tools/auto-tester/src/ui/AutoTester.cpp | 3 ++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/tools/auto-tester/src/Test.cpp b/tools/auto-tester/src/Test.cpp index 7b6293dcbc..fbd30e7307 100644 --- a/tools/auto-tester/src/Test.cpp +++ b/tools/auto-tester/src/Test.cpp @@ -216,16 +216,22 @@ void Test::startTestsEvaluation() { resultImagesFullFilenames << fullCurrentFilename; QString expectedImagePartialSourceDirectory = getExpectedImagePartialSourceDirectory(currentFilename); - - // extract the digits at the end of the filename (exluding the file extension) + + // Images are stored on GitHub as ExpectedImage_ddddd.png + // Extract the digits at the end of the filename (exluding the file extension) QString expectedImageFilenameTail = currentFilename.left(currentFilename.length() - 4).right(NUM_DIGITS); - QString expectedImageFilename = EXPECTED_IMAGE_PREFIX + expectedImageFilenameTail + IMAGE_FORMAT; + QString expectedImageStoredFilename = EXPECTED_IMAGE_PREFIX + expectedImageFilenameTail + IMAGE_FORMAT; + + QString imageURLString(URLPrefix + "/" + githubUser + "/" + testsRepo + "/" + branch + "/" + + expectedImagePartialSourceDirectory + "/" + expectedImageStoredFilename); + + expectedImagesURLs << imageURLString; + + // The image retrieved from Github needs a unique name + QString expectedImageFilename = currentFilename.replace("/", "_").replace(".", "_EI."); expectedImagesFilenames << expectedImageFilename; expectedImagesFullFilenames << pathToTestResultsDirectory + "/" + expectedImageFilename; - - QString imageURLString(URLPrefix + "/" + githubUser + "/" + testsRepo + "/" + branch + "/" + expectedImagePartialSourceDirectory + "/" + expectedImageFilename); - expectedImagesURLs << imageURLString; } } diff --git a/tools/auto-tester/src/ui/AutoTester.cpp b/tools/auto-tester/src/ui/AutoTester.cpp index ade6b0514e..5ac7be3dd8 100644 --- a/tools/auto-tester/src/ui/AutoTester.cpp +++ b/tools/auto-tester/src/ui/AutoTester.cpp @@ -81,7 +81,8 @@ void AutoTester::saveImage(int index) { QImage image = pixmap.toImage(); image = image.convertToFormat(QImage::Format_ARGB32); - image.save(_directoryName + "/" + _filenames[index], 0, 100); + QString fullPathname = _directoryName + "/" + _filenames[index]; + image.save(fullPathname, 0, 100); ++_numberOfImagesDownloaded;