From 572edab79fbc363c407eaec3da177b041c29277a Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 7 Feb 2018 16:48:31 -0800 Subject: [PATCH 1/5] remove dupe const --- libraries/shared/src/BitVectorHelpers.h | 2 ++ tests/shared/src/BitVectorHelperTests.cpp | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/shared/src/BitVectorHelpers.h b/libraries/shared/src/BitVectorHelpers.h index 9f5af0c380..a619fe3999 100644 --- a/libraries/shared/src/BitVectorHelpers.h +++ b/libraries/shared/src/BitVectorHelpers.h @@ -12,6 +12,8 @@ #ifndef hifi_BitVectorHelpers_h #define hifi_BitVectorHelpers_h +#include "NumericalConstants.h" + int calcBitVectorSize(int numBits) { return ((numBits - 1) >> 3) + 1; } diff --git a/tests/shared/src/BitVectorHelperTests.cpp b/tests/shared/src/BitVectorHelperTests.cpp index 070e90eec7..618a86cad1 100644 --- a/tests/shared/src/BitVectorHelperTests.cpp +++ b/tests/shared/src/BitVectorHelperTests.cpp @@ -20,8 +20,6 @@ QTEST_MAIN(BitVectorHelperTests) -const int BITS_IN_BYTE = 8; - void BitVectorHelperTests::sizeTest() { std::vector sizes = {0, 6, 7, 8, 30, 31, 32, 33, 87, 88, 89, 90, 90, 91, 92, 93}; for (auto& size : sizes) { From f0bb4d3da70baff2897085b0d309970b95c37e77 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 7 Feb 2018 16:48:43 -0800 Subject: [PATCH 2/5] fix API bitrot and remove extra whitespace --- tests/shared/src/FileCacheTests.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/shared/src/FileCacheTests.cpp b/tests/shared/src/FileCacheTests.cpp index 3f1c5e1a01..b7c2103817 100644 --- a/tests/shared/src/FileCacheTests.cpp +++ b/tests/shared/src/FileCacheTests.cpp @@ -33,7 +33,7 @@ size_t FileCacheTests::getCacheDirectorySize() const { return result; } -FileCachePointer makeFileCache(QString& location) { +FileCachePointer makeFileCache(QString location) { auto result = std::make_shared(location.toStdString(), "tmp"); result->initialize(); result->setMaxSize(MAX_UNUSED_SIZE); @@ -53,7 +53,7 @@ void FileCacheTests::testUnusedFiles() { auto file = cache->writeFile(TEST_DATA.data(), FileCache::Metadata(key, TEST_DATA.size())); QVERIFY(file->_locked); inUseFiles.push_back(file); - + QThread::msleep(10); } QCOMPARE(cache->getNumCachedFiles(), (size_t)0); @@ -100,13 +100,13 @@ void FileCacheTests::testUnusedFiles() { inUseFiles.push_back(file); if (i == 94) { - // Each access touches the file, so we need to sleep here to ensure that the the last 5 files + // Each access touches the file, so we need to sleep here to ensure that the the last 5 files // have later times for cache ejection priority, otherwise the test runs too fast to reliably - // differentiate + // differentiate QThread::msleep(1000); } } - + QCOMPARE(cache->getNumCachedFiles(), (size_t)0); QCOMPARE(cache->getNumTotalFiles(), (size_t)10); inUseFiles.clear(); @@ -119,7 +119,7 @@ size_t FileCacheTests::getFreeSpace() const { return QStorageInfo(_testDir.path()).bytesFree(); } -// FIXME if something else is changing the amount of free space on the target drive concurrently with this test +// FIXME if something else is changing the amount of free space on the target drive concurrently with this test // running, then it may fail void FileCacheTests::testFreeSpacePreservation() { QCOMPARE(getCacheDirectorySize(), MAX_UNUSED_SIZE); From b3452f274e7433b7d497fe5f8df28996988185ba Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 7 Feb 2018 16:49:22 -0800 Subject: [PATCH 3/5] use glm::nan() for platform-agnostic code --- tests/shared/src/GeometryUtilTests.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/shared/src/GeometryUtilTests.cpp b/tests/shared/src/GeometryUtilTests.cpp index ccb3dc8a0e..eb9be4987f 100644 --- a/tests/shared/src/GeometryUtilTests.cpp +++ b/tests/shared/src/GeometryUtilTests.cpp @@ -31,20 +31,20 @@ static void testSphereVsCone(const glm::vec3 coneNormal, const glm::vec3 coneBiN glm::vec3 coneCenter = glm::vec3(0.0f, 0.0f, 0.0f); glm::vec3 sphereCenter = coneCenter + coneEdge * sphereDistance; float result = coneSphereAngle(coneCenter, u, sphereCenter, sphereRadius); - QCOMPARE(isnan(result), false); + QCOMPARE(glm::isnan(result), false); QCOMPARE(result < coneAngle, true); // push sphere outward from edge so it is tangent to the cone. glm::vec3 sphereOffset = glm::angleAxis(PI / 2.0f, w) * coneEdge; sphereCenter += sphereOffset * sphereRadius; result = coneSphereAngle(coneCenter, u, sphereCenter, sphereRadius); - QCOMPARE(isnan(result), false); + QCOMPARE(glm::isnan(result), false); QCOMPARE_WITH_ABS_ERROR(result, coneAngle, 0.001f); // push sphere outward from edge a bit further, so it is outside of the cone. sphereCenter += 0.1f * sphereOffset; result = coneSphereAngle(coneCenter, u, sphereCenter, sphereRadius); - QCOMPARE(isnan(result), false); + QCOMPARE(glm::isnan(result), false); QCOMPARE(result > coneAngle, true); } From 64ec4dac7a697771af4782c9e959d1dc3ad14b62 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Wed, 7 Feb 2018 16:49:42 -0800 Subject: [PATCH 4/5] remove broken DEV_BUILD context --- tests/shared/src/PathUtilsTests.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/shared/src/PathUtilsTests.cpp b/tests/shared/src/PathUtilsTests.cpp index 1c445908f7..3aec4fa5f9 100644 --- a/tests/shared/src/PathUtilsTests.cpp +++ b/tests/shared/src/PathUtilsTests.cpp @@ -16,12 +16,8 @@ QTEST_MAIN(PathUtilsTests) void PathUtilsTests::testPathUtils() { - QString result = PathUtils::qmlBasePath(); -#if DEV_BUILD - QVERIFY(result.startsWith("file:///")); -#else + QString result = PathUtils::qmlBaseUrl(); QVERIFY(result.startsWith("qrc:///")); -#endif QVERIFY(result.endsWith("/")); } From beb41495d5428c5d8aba3cc417f54b7481124ac8 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Fri, 9 Feb 2018 09:35:24 -0800 Subject: [PATCH 5/5] save avatarUrl when setting new skeletonModelUrl --- interface/src/avatar/MyAvatar.cpp | 13 +++++++++++++ interface/src/avatar/MyAvatar.h | 1 + 2 files changed, 14 insertions(+) diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index d2a9e798f8..ba4d48fd3f 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -959,6 +959,18 @@ void MyAvatar::restoreRoleAnimation(const QString& role) { _skeletonModel->getRig().restoreRoleAnimation(role); } +void MyAvatar::saveAvatarUrl() { + Settings settings; + settings.beginGroup("Avatar"); + if (qApp->getSaveAvatarOverrideUrl() || !qApp->getAvatarOverrideUrl().isValid() ) { + settings.setValue("fullAvatarURL", + _fullAvatarURLFromPreferences == AvatarData::defaultFullAvatarModelUrl() ? + "" : + _fullAvatarURLFromPreferences.toString()); + } + settings.endGroup(); +} + void MyAvatar::saveData() { Settings settings; settings.beginGroup("Avatar"); @@ -1452,6 +1464,7 @@ void MyAvatar::setSkeletonModelURL(const QUrl& skeletonModelURL) { _skeletonModel->setVisibleInScene(true, qApp->getMain3DScene(), render::ItemKey::TAG_BITS_NONE); _headBoneSet.clear(); _cauterizationNeedsUpdate = true; + saveAvatarUrl(); emit skeletonChanged(); } diff --git a/interface/src/avatar/MyAvatar.h b/interface/src/avatar/MyAvatar.h index 97e82b87f5..124902a1b1 100644 --- a/interface/src/avatar/MyAvatar.h +++ b/interface/src/avatar/MyAvatar.h @@ -646,6 +646,7 @@ private: void simulate(float deltaTime); void updateFromTrackers(float deltaTime); + void saveAvatarUrl(); virtual void render(RenderArgs* renderArgs) override; virtual bool shouldRenderHead(const RenderArgs* renderArgs) const override; void setShouldRenderLocally(bool shouldRender) { _shouldRender = shouldRender; setEnableMeshVisible(shouldRender); }