Merge branch 'master' of github.com:highfidelity/hifi into 21691-improveNitpickWebPage

This commit is contained in:
NissimHadar 2019-03-21 12:47:34 -07:00
commit 1f0fe7d683
14 changed files with 65 additions and 53 deletions

View file

@ -52,6 +52,8 @@
#include <WebSocketServerClass.h> #include <WebSocketServerClass.h>
#include <EntityScriptingInterface.h> // TODO: consider moving to scriptengine.h #include <EntityScriptingInterface.h> // TODO: consider moving to scriptengine.h
#include <hfm/ModelFormatRegistry.h>
#include "entities/AssignmentParentFinder.h" #include "entities/AssignmentParentFinder.h"
#include "AssignmentDynamicFactory.h" #include "AssignmentDynamicFactory.h"
#include "RecordingScriptingInterface.h" #include "RecordingScriptingInterface.h"
@ -99,6 +101,9 @@ Agent::Agent(ReceivedMessage& message) :
DependencyManager::set<RecordingScriptingInterface>(); DependencyManager::set<RecordingScriptingInterface>();
DependencyManager::set<UsersScriptingInterface>(); DependencyManager::set<UsersScriptingInterface>();
DependencyManager::set<ModelFormatRegistry>();
DependencyManager::set<ModelCache>();
// Needed to ensure the creation of the DebugDraw instance on the main thread // Needed to ensure the creation of the DebugDraw instance on the main thread
DebugDraw::getInstance(); DebugDraw::getInstance();
@ -819,6 +824,9 @@ void Agent::aboutToFinish() {
DependencyManager::get<ResourceManager>()->cleanup(); DependencyManager::get<ResourceManager>()->cleanup();
DependencyManager::destroy<ModelFormatRegistry>();
DependencyManager::destroy<ModelCache>();
DependencyManager::destroy<PluginManager>(); DependencyManager::destroy<PluginManager>();
// cleanup the AudioInjectorManager (and any still running injectors) // cleanup the AudioInjectorManager (and any still running injectors)

View file

@ -1,7 +1,7 @@
macro(TARGET_PYTHON) macro(TARGET_PYTHON)
if (NOT HIFI_PYTHON_EXEC) if (NOT HIFI_PYTHON_EXEC)
# Find the python interpreter # Find the python interpreter
if (CAME_VERSION VERSION_LESS 3.12) if (CMAKE_VERSION VERSION_LESS 3.12)
# this logic is deprecated in CMake after 3.12 # this logic is deprecated in CMake after 3.12
# FIXME eventually we should make 3.12 the min cmake verion and just use the Python3 find_package path # FIXME eventually we should make 3.12 the min cmake verion and just use the Python3 find_package path
set(Python_ADDITIONAL_VERSIONS 3) set(Python_ADDITIONAL_VERSIONS 3)

View file

@ -199,13 +199,3 @@ void TestScriptingInterface::setOtherAvatarsReplicaCount(int count) {
int TestScriptingInterface::getOtherAvatarsReplicaCount() { int TestScriptingInterface::getOtherAvatarsReplicaCount() {
return qApp->getOtherAvatarsReplicaCount(); return qApp->getOtherAvatarsReplicaCount();
} }
QString TestScriptingInterface::getOperatingSystemType() {
#ifdef Q_OS_WIN
return "WINDOWS";
#elif defined Q_OS_MAC
return "MACOS";
#else
return "UNKNOWN";
#endif
}

View file

@ -163,13 +163,6 @@ public slots:
*/ */
Q_INVOKABLE int getOtherAvatarsReplicaCount(); Q_INVOKABLE int getOtherAvatarsReplicaCount();
/**jsdoc
* Returns the Operating Sytem type
* @function Test.getOperatingSystemType
* @returns {string} "WINDOWS", "MACOS" or "UNKNOWN"
*/
QString getOperatingSystemType();
private: private:
bool waitForCondition(qint64 maxWaitMs, std::function<bool()> condition); bool waitForCondition(qint64 maxWaitMs, std::function<bool()> condition);
QString _testResultsLocation; QString _testResultsLocation;

View file

@ -1034,7 +1034,7 @@ void RenderableModelEntityItem::copyAnimationJointDataToModel() {
}); });
if (changed) { if (changed) {
locationChanged(false, true); locationChanged(true, true);
} }
} }

View file

@ -203,7 +203,7 @@
// Notification plane positions // Notification plane positions
noticeY = -sensorScaleFactor * (y * NOTIFICATION_3D_SCALE + 0.5 * noticeHeight); noticeY = -sensorScaleFactor * (y * NOTIFICATION_3D_SCALE + 0.5 * noticeHeight);
notificationPosition = { x: 0, y: noticeY, z: 0 }; notificationPosition = { x: 0, y: noticeY, z: 0 };
buttonPosition = { x: 0.5 * sensorScaleFactor * (noticeWidth - NOTIFICATION_3D_BUTTON_WIDTH), y: noticeY, z: 0.001 }; buttonPosition = { x: sensorScaleFactor * (noticeWidth - NOTIFICATION_3D_BUTTON_WIDTH), y: noticeY, z: 0.001 };
// Rotate plane // Rotate plane
notificationOrientation = Quat.fromPitchYawRollDegrees(NOTIFICATIONS_3D_PITCH, notificationOrientation = Quat.fromPitchYawRollDegrees(NOTIFICATIONS_3D_PITCH,
@ -241,7 +241,7 @@
noticeWidth = notice.width * NOTIFICATION_3D_SCALE + NOTIFICATION_3D_BUTTON_WIDTH; noticeWidth = notice.width * NOTIFICATION_3D_SCALE + NOTIFICATION_3D_BUTTON_WIDTH;
noticeHeight = notice.height * NOTIFICATION_3D_SCALE; noticeHeight = notice.height * NOTIFICATION_3D_SCALE;
notice.size = { x: noticeWidth, y: noticeHeight }; notice.size = { x: noticeWidth * sensorScaleFactor, y: noticeHeight * sensorScaleFactor };
positions = calculate3DOverlayPositions(noticeWidth, noticeHeight, notice.y); positions = calculate3DOverlayPositions(noticeWidth, noticeHeight, notice.y);
@ -249,8 +249,8 @@
notice.parentJointIndex = -2; notice.parentJointIndex = -2;
if (!image) { if (!image) {
notice.topMargin = 0.75 * notice.topMargin * NOTIFICATION_3D_SCALE; notice.topMargin = 0.75 * notice.topMargin * NOTIFICATION_3D_SCALE * sensorScaleFactor;
notice.leftMargin = 2 * notice.leftMargin * NOTIFICATION_3D_SCALE; notice.leftMargin = 2 * notice.leftMargin * NOTIFICATION_3D_SCALE * sensorScaleFactor;
notice.bottomMargin = 0; notice.bottomMargin = 0;
notice.rightMargin = 0; notice.rightMargin = 0;
notice.lineHeight = 10.0 * (fontSize * sensorScaleFactor / 12.0) * NOTIFICATION_3D_SCALE; notice.lineHeight = 10.0 * (fontSize * sensorScaleFactor / 12.0) * NOTIFICATION_3D_SCALE;
@ -267,14 +267,15 @@
button.isFacingAvatar = false; button.isFacingAvatar = false;
button.parentID = MyAvatar.sessionUUID; button.parentID = MyAvatar.sessionUUID;
button.parentJointIndex = -2; button.parentJointIndex = -2;
button.visible = false;
buttons.push((Overlays.addOverlay("image3d", button))); buttons.push((Overlays.addOverlay("image3d", button)));
overlay3DDetails.push({ overlay3DDetails.push({
notificationOrientation: positions.notificationOrientation, notificationOrientation: positions.notificationOrientation,
notificationPosition: positions.notificationPosition, notificationPosition: positions.notificationPosition,
buttonPosition: positions.buttonPosition, buttonPosition: positions.buttonPosition,
width: noticeWidth, width: noticeWidth * sensorScaleFactor,
height: noticeHeight height: noticeHeight * sensorScaleFactor
}); });

View file

@ -43,6 +43,8 @@ void ImageComparer::compareImages(const QImage& resultImage, const QImage& expec
int windowCounter{ 0 }; int windowCounter{ 0 };
double ssim{ 0.0 }; double ssim{ 0.0 };
double worstTileValue{ 1.0 };
double min { 1.0 }; double min { 1.0 };
double max { -1.0 }; double max { -1.0 };
@ -108,6 +110,10 @@ void ImageComparer::compareImages(const QImage& resultImage, const QImage& expec
if (value < min) min = value; if (value < min) min = value;
if (value > max) max = value; if (value > max) max = value;
if (value < worstTileValue) {
worstTileValue = value;
}
++windowCounter; ++windowCounter;
y += WIN_SIZE; y += WIN_SIZE;
@ -122,12 +128,17 @@ void ImageComparer::compareImages(const QImage& resultImage, const QImage& expec
_ssimResults.min = min; _ssimResults.min = min;
_ssimResults.max = max; _ssimResults.max = max;
_ssimResults.ssim = ssim / windowCounter; _ssimResults.ssim = ssim / windowCounter;
_ssimResults.worstTileValue = worstTileValue;
}; };
double ImageComparer::getSSIMValue() { double ImageComparer::getSSIMValue() {
return _ssimResults.ssim; return _ssimResults.ssim;
} }
double ImageComparer::getWorstTileValue() {
return _ssimResults.worstTileValue;
}
SSIMResults ImageComparer::getSSIMResults() { SSIMResults ImageComparer::getSSIMResults() {
return _ssimResults; return _ssimResults;
} }

View file

@ -18,7 +18,9 @@
class ImageComparer { class ImageComparer {
public: public:
void compareImages(const QImage& resultImage, const QImage& expectedImage); void compareImages(const QImage& resultImage, const QImage& expectedImage);
double getSSIMValue(); double getSSIMValue();
double getWorstTileValue();
SSIMResults getSSIMResults(); SSIMResults getSSIMResults();

View file

@ -61,7 +61,7 @@ QPixmap MismatchWindow::computeDiffPixmap(const QImage& expectedImage, const QIm
} }
void MismatchWindow::setTestResult(const TestResult& testResult) { void MismatchWindow::setTestResult(const TestResult& testResult) {
errorLabel->setText("Similarity: " + QString::number(testResult._error)); errorLabel->setText("Similarity: " + QString::number(testResult._errorGlobal) + " (worst tile: " + QString::number(testResult._errorLocal) + ")");
imagePath->setText("Path to test: " + testResult._pathname); imagePath->setText("Path to test: " + testResult._pathname);

View file

@ -83,6 +83,7 @@ int TestCreator::compareImageLists() {
QImage expectedImage(_expectedImagesFullFilenames[i]); QImage expectedImage(_expectedImagesFullFilenames[i]);
double similarityIndex; // in [-1.0 .. 1.0], where 1.0 means images are identical double similarityIndex; // in [-1.0 .. 1.0], where 1.0 means images are identical
double worstTileValue; // in [-1.0 .. 1.0], where 1.0 means images are identical
bool isInteractiveMode = (!_isRunningFromCommandLine && _checkBoxInteractiveMode->isChecked() && !_isRunningInAutomaticTestRun); bool isInteractiveMode = (!_isRunningFromCommandLine && _checkBoxInteractiveMode->isChecked() && !_isRunningInAutomaticTestRun);
@ -90,13 +91,16 @@ int TestCreator::compareImageLists() {
if (isInteractiveMode && (resultImage.width() != expectedImage.width() || resultImage.height() != expectedImage.height())) { if (isInteractiveMode && (resultImage.width() != expectedImage.width() || resultImage.height() != expectedImage.height())) {
QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Images are not the same size"); QMessageBox::critical(0, "Internal error: " + QString(__FILE__) + ":" + QString::number(__LINE__), "Images are not the same size");
similarityIndex = -100.0; similarityIndex = -100.0;
worstTileValue = 0.0;
} else { } else {
_imageComparer.compareImages(resultImage, expectedImage); _imageComparer.compareImages(resultImage, expectedImage);
similarityIndex = _imageComparer.getSSIMValue(); similarityIndex = _imageComparer.getSSIMValue();
worstTileValue = _imageComparer.getWorstTileValue();
} }
TestResult testResult = TestResult{ TestResult testResult = TestResult{
(float)similarityIndex, similarityIndex,
worstTileValue,
_expectedImagesFullFilenames[i].left(_expectedImagesFullFilenames[i].lastIndexOf("/") + 1), // path to the test (including trailing /) _expectedImagesFullFilenames[i].left(_expectedImagesFullFilenames[i].lastIndexOf("/") + 1), // path to the test (including trailing /)
QFileInfo(_expectedImagesFullFilenames[i].toStdString().c_str()).fileName(), // filename of expected image QFileInfo(_expectedImagesFullFilenames[i].toStdString().c_str()).fileName(), // filename of expected image
QFileInfo(_resultImagesFullFilenames[i].toStdString().c_str()).fileName(), // filename of result image QFileInfo(_resultImagesFullFilenames[i].toStdString().c_str()).fileName(), // filename of result image
@ -105,10 +109,9 @@ int TestCreator::compareImageLists() {
_mismatchWindow.setTestResult(testResult); _mismatchWindow.setTestResult(testResult);
if (similarityIndex < THRESHOLD) { if (similarityIndex < THRESHOLD_GLOBAL || worstTileValue < THRESHOLD_LOCAL) {
++numberOfFailures;
if (!isInteractiveMode) { if (!isInteractiveMode) {
++numberOfFailures;
appendTestResultsToFile(testResult, _mismatchWindow.getComparisonImage(), _mismatchWindow.getSSIMResultsImage(testResult._ssimResults), true); appendTestResultsToFile(testResult, _mismatchWindow.getComparisonImage(), _mismatchWindow.getSSIMResultsImage(testResult._ssimResults), true);
} else { } else {
_mismatchWindow.exec(); _mismatchWindow.exec();
@ -117,6 +120,7 @@ int TestCreator::compareImageLists() {
case USER_RESPONSE_PASS: case USER_RESPONSE_PASS:
break; break;
case USE_RESPONSE_FAIL: case USE_RESPONSE_FAIL:
++numberOfFailures;
appendTestResultsToFile(testResult, _mismatchWindow.getComparisonImage(), _mismatchWindow.getSSIMResultsImage(testResult._ssimResults), true); appendTestResultsToFile(testResult, _mismatchWindow.getComparisonImage(), _mismatchWindow.getSSIMResultsImage(testResult._ssimResults), true);
break; break;
case USER_RESPONSE_ABORT: case USER_RESPONSE_ABORT:
@ -198,7 +202,8 @@ void TestCreator::appendTestResultsToFile(const TestResult& testResult, const QP
stream << "TestCreator in folder " << testResult._pathname.left(testResult._pathname.length() - 1) << endl; // remove trailing '/' stream << "TestCreator in folder " << testResult._pathname.left(testResult._pathname.length() - 1) << endl; // remove trailing '/'
stream << "Expected image was " << testResult._expectedImageFilename << endl; stream << "Expected image was " << testResult._expectedImageFilename << endl;
stream << "Actual image was " << testResult._actualImageFilename << endl; stream << "Actual image was " << testResult._actualImageFilename << endl;
stream << "Similarity index was " << testResult._error << endl; stream << "Similarity index was " << testResult._errorGlobal << endl;
stream << "Worst tile was " << testResult._errorLocal << endl;
descriptionFile.close(); descriptionFile.close();
@ -819,6 +824,10 @@ void TestCreator::createRecursiveScript(const QString& directory, bool interacti
// If 'directories' is empty, this means that this recursive script has no tests to call, so it is redundant // If 'directories' is empty, this means that this recursive script has no tests to call, so it is redundant
if (directories.length() == 0) { if (directories.length() == 0) {
QString testRecursivePathname = directory + "/" + TEST_RECURSIVE_FILENAME;
if (QFile::exists(testRecursivePathname)) {
QFile::remove(testRecursivePathname);
}
return; return;
} }

View file

@ -124,7 +124,8 @@ private:
const QString TEST_RESULTS_FOLDER { "TestResults" }; const QString TEST_RESULTS_FOLDER { "TestResults" };
const QString TEST_RESULTS_FILENAME { "TestResults.txt" }; const QString TEST_RESULTS_FILENAME { "TestResults.txt" };
const double THRESHOLD{ 0.9999 }; const double THRESHOLD_GLOBAL{ 0.9995 };
const double THRESHOLD_LOCAL { 0.6 };
QDir _imageDirectory; QDir _imageDirectory;

View file

@ -43,7 +43,7 @@ TestRunnerMobile::TestRunnerMobile(
_installAPKPushbutton = installAPKPushbutton; _installAPKPushbutton = installAPKPushbutton;
_runInterfacePushbutton = runInterfacePushbutton; _runInterfacePushbutton = runInterfacePushbutton;
folderLineEdit->setText("/sdcard/DCIM/TEST"); folderLineEdit->setText("/sdcard/snapshots");
modelNames["SM_G955U1"] = "Samsung S8+ unlocked"; modelNames["SM_G955U1"] = "Samsung S8+ unlocked";
modelNames["SM_N960U1"] = "Samsung Note 9 unlocked"; modelNames["SM_N960U1"] = "Samsung Note 9 unlocked";
@ -60,6 +60,7 @@ void TestRunnerMobile::setWorkingFolderAndEnableControls() {
setWorkingFolder(_workingFolderLabel); setWorkingFolder(_workingFolderLabel);
_connectDeviceButton->setEnabled(true); _connectDeviceButton->setEnabled(true);
_downloadAPKPushbutton->setEnabled(true);
} }
void TestRunnerMobile::connectDevice() { void TestRunnerMobile::connectDevice() {
@ -154,8 +155,6 @@ void TestRunnerMobile::downloadComplete() {
} else { } else {
_statusLabel->setText("Installer download complete"); _statusLabel->setText("Installer download complete");
} }
_installAPKPushbutton->setEnabled(true);
} }
void TestRunnerMobile::installAPK() { void TestRunnerMobile::installAPK() {
@ -164,22 +163,16 @@ void TestRunnerMobile::installAPK() {
_adbInterface = new AdbInterface(); _adbInterface = new AdbInterface();
} }
if (_installerFilename.isNull()) { QString installerPathname = QFileDialog::getOpenFileName(nullptr, "Please select the APK", _workingFolder,
QString installerPathname = QFileDialog::getOpenFileName(nullptr, "Please select the APK", _workingFolder, "Available APKs (*.apk)"
"Available APKs (*.apk)" );
);
if (installerPathname.isNull()) { if (installerPathname.isNull()) {
return; return;
}
// Remove the path
QStringList parts = installerPathname.split('/');
_installerFilename = parts[parts.length() - 1];
} }
_statusLabel->setText("Installing"); _statusLabel->setText("Installing");
QString command = _adbInterface->getAdbCommand() + " install -r -d " + _workingFolder + "/" + _installerFilename + " >" + _workingFolder + "/installOutput.txt"; QString command = _adbInterface->getAdbCommand() + " install -r -d " + installerPathname + " >" + _workingFolder + "/installOutput.txt";
appendLog(command); appendLog(command);
system(command.toStdString().c_str()); system(command.toStdString().c_str());
_statusLabel->setText("Installation complete"); _statusLabel->setText("Installation complete");

View file

@ -18,7 +18,9 @@ public:
int width; int width;
int height; int height;
std::vector<double> results; std::vector<double> results;
double ssim; double ssim;
double worstTileValue;
// Used for scaling // Used for scaling
double min; double min;
@ -27,15 +29,17 @@ public:
class TestResult { class TestResult {
public: public:
TestResult(float error, const QString& pathname, const QString& expectedImageFilename, const QString& actualImageFilename, const SSIMResults& ssimResults) : TestResult(double errorGlobal, double errorLocal, const QString& pathname, const QString& expectedImageFilename, const QString& actualImageFilename, const SSIMResults& ssimResults) :
_error(error), _errorGlobal(errorGlobal),
_errorLocal(errorLocal),
_pathname(pathname), _pathname(pathname),
_expectedImageFilename(expectedImageFilename), _expectedImageFilename(expectedImageFilename),
_actualImageFilename(actualImageFilename), _actualImageFilename(actualImageFilename),
_ssimResults(ssimResults) _ssimResults(ssimResults)
{} {}
double _error; double _errorGlobal;
double _errorLocal;
QString _pathname; QString _pathname;
QString _expectedImageFilename; QString _expectedImageFilename;

View file

@ -45,7 +45,7 @@
<widget class="QLabel" name="diffImage"> <widget class="QLabel" name="diffImage">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>540</x> <x>900</x>
<y>480</y> <y>480</y>
<width>800</width> <width>800</width>
<height>450</height> <height>450</height>
@ -78,7 +78,7 @@
<rect> <rect>
<x>60</x> <x>60</x>
<y>630</y> <y>630</y>
<width>480</width> <width>540</width>
<height>28</height> <height>28</height>
</rect> </rect>
</property> </property>
@ -145,7 +145,7 @@
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Abort current test</string> <string>Abort evaluation</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="errorLabel"> <widget class="QLabel" name="errorLabel">