diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-04-08 20:30:40 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-04-08 20:30:40 +0300 |
commit | fd3223578c0a0789627a92cc63235c24e75f87c3 (patch) | |
tree | 48b90671150a8ea4a7d3b9306d3eabca349d556a /src/resources/resourcemanager | |
parent | 27a2dd4fce2d529cd1d96aa5ddce1e74b4f54a2f (diff) | |
download | ManaVerse-fd3223578c0a0789627a92cc63235c24e75f87c3.tar.gz ManaVerse-fd3223578c0a0789627a92cc63235c24e75f87c3.tar.bz2 ManaVerse-fd3223578c0a0789627a92cc63235c24e75f87c3.tar.xz ManaVerse-fd3223578c0a0789627a92cc63235c24e75f87c3.zip |
Remove most setters and getters from Resource class.
Diffstat (limited to 'src/resources/resourcemanager')
-rw-r--r-- | src/resources/resourcemanager/resourcemanager.cpp | 72 | ||||
-rw-r--r-- | src/resources/resourcemanager/resourcemanager_unittest.cc | 142 |
2 files changed, 107 insertions, 107 deletions
diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index a5e5ebac5..5ddf08c97 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -73,11 +73,11 @@ void deleteResourceManager() { if (iter->second) { - if (iter->second->getRefCount()) + if (iter->second->mRefCount) { logger->log(std::string("ResourceLeak: ").append( - iter->second->getIdPath()).append(" (").append( - toString(iter->second->getRefCount())).append(")")); + iter->second->mIdPath).append(" (").append( + toString(iter->second->mRefCount)).append(")")); #ifdef UNITTESTS status = true; #endif // UNITTESTS @@ -97,7 +97,7 @@ void deleteResourceManager() while (iter != mResources.end()) { #ifdef DEBUG_LEAKS - if (iter->second && iter->second->getRefCount()) + if (iter->second && iter->second->mRefCount) { ++iter; continue; @@ -122,7 +122,7 @@ void deleteResourceManager() while (iter != mResources.end()) { #ifdef DEBUG_LEAKS - if (iter->second && iter->second->getRefCount()) + if (iter->second && iter->second->mRefCount) { ++iter; continue; @@ -147,7 +147,7 @@ void deleteResourceManager() while (iter != mResources.end()) { #ifdef DEBUG_LEAKS - if (iter->second && iter->second->getRefCount()) + if (iter->second && iter->second->mRefCount) { ++iter; continue; @@ -176,14 +176,14 @@ void cleanUp(Resource *const res) if (!res) return; - const unsigned refCount = res->getRefCount(); + const unsigned refCount = res->mRefCount; if (refCount > 0) { logger->log("ResourceManager::~ResourceManager() cleaning up %u " "reference%s to %s", refCount, (refCount == 1) ? "" : "s", - res->getIdPath().c_str()); + res->mIdPath.c_str()); } delete res; @@ -203,9 +203,9 @@ void cleanProtected() ++ iter; continue; } - if (res->isProtected()) + if (res->mProtected) { - res->setProtected(false); + res->mProtected = false; res->decRef(); iter = mResources.begin(); continue; @@ -267,24 +267,24 @@ void logResource(const Resource *const res) const Image *const image = dynamic_cast<const Image *const>(res); if (image) { - std::string src = image->getSource(); - const int count = image->getRefCount(); + std::string src = image->mSource; + const int count = image->mRefCount; if (count) src.append(" ").append(toString(count)); - logger->log("resource(%s, %u) %s", res->getIdPath().c_str(), + logger->log("resource(%s, %u) %s", res->mIdPath.c_str(), image->getGLImage(), src.c_str()); } else { - std::string src = res->getSource(); - const int count = res->getRefCount(); + std::string src = res->mSource; + const int count = res->mRefCount; if (count > 0) src.append(" ").append(toString(count)); - logger->log("resource(%s) %s", res->getIdPath().c_str(), src.c_str()); + logger->log("resource(%s) %s", res->mIdPath.c_str(), src.c_str()); } #else // USE_OPENGL - logger->log("resource(%s)", res->getIdPath().c_str()); + logger->log("resource(%s)", res->mIdPath.c_str()); #endif // USE_OPENGL } @@ -319,7 +319,7 @@ void clearDeleted(const bool full) std::set<Resource*>::iterator resDelIter = mDeletedResources.begin(); while (resDelIter != mDeletedResources.end()) { - if (!(*resDelIter)->getRefCount()) + if (!(*resDelIter)->mRefCount) { status = true; Resource *res = *resDelIter; @@ -354,10 +354,10 @@ bool addResource(const std::string &idPath, if (resource) { resource->incRef(); - resource->setIdPath(idPath); + resource->mIdPath = idPath; #ifdef DEBUG_IMAGES logger->log("set name %p, %s", static_cast<void*>(resource), - resource->getIdPath().c_str()); + resource->mIdPath.c_str()); #endif // DEBUG_IMAGES mResources[idPath] = resource; @@ -429,10 +429,10 @@ Resource *get(const std::string &idPath, if (resource) { resource->incRef(); - resource->setIdPath(idPath); + resource->mIdPath = idPath; #ifdef DEBUG_IMAGES logger->log("set name %p, %s", static_cast<void*>(resource), - resource->getIdPath().c_str()); + resource->mIdPath.c_str()); #endif // DEBUG_IMAGES mResources[idPath] = resource; @@ -448,10 +448,10 @@ Resource *get(const std::string &idPath, if (resource) { resource->incRef(); - resource->setIdPath(idPath); + resource->mIdPath = idPath; #ifdef DEBUG_IMAGES logger->log("set name %p, %s", static_cast<void*>(resource), - resource->getIdPath().c_str()); + resource->mIdPath.c_str()); #endif // DEBUG_IMAGES } else @@ -479,19 +479,19 @@ void release(Resource *const res) return; } - ResourceIterator resIter = mResources.find(res->getIdPath()); + ResourceIterator resIter = mResources.find(res->mIdPath); if (resIter == mResources.end()) { reportAlways("no resource in cache: %s", - res->getIdPath().c_str()); + res->mIdPath.c_str()); delete res; return; } if (resIter->second != res) { reportAlways("in cache other image: %s", - res->getIdPath().c_str()); + res->mIdPath.c_str()); delete res; return; } @@ -518,11 +518,11 @@ void moveToDeleted(Resource *const res) return; bool found(false); - const int count = res->getRefCount(); + const int count = res->mRefCount; if (count == 1) logResource(res); res->decRef(); - ResourceIterator resIter = mResources.find(res->getIdPath()); + ResourceIterator resIter = mResources.find(res->mIdPath); if (resIter != mResources.end() && resIter->second == res) { mResources.erase(resIter); @@ -530,7 +530,7 @@ void moveToDeleted(Resource *const res) } else { - resIter = mOrphanedResources.find(res->getIdPath()); + resIter = mOrphanedResources.find(res->mIdPath); if (resIter != mOrphanedResources.end() && resIter->second == res) { mOrphanedResources.erase(resIter); @@ -551,19 +551,19 @@ void decRefDelete(Resource *const res) if (!res) return; - const int count = res->getRefCount(); + const int count = res->mRefCount; if (count == 1) { logResource(res); - ResourceIterator resIter = mResources.find(res->getIdPath()); + ResourceIterator resIter = mResources.find(res->mIdPath); if (resIter != mResources.end() && resIter->second == res) { mResources.erase(resIter); } else { - resIter = mOrphanedResources.find(res->getIdPath()); + resIter = mOrphanedResources.find(res->mIdPath); if (resIter != mOrphanedResources.end() && resIter->second == res) mOrphanedResources.erase(resIter); } @@ -595,11 +595,11 @@ void deleteInstance() const Resource *const res = iter->second; if (res) { - if (res->getRefCount()) + if (res->mRefCount) { logger->log(std::string("ResourceLeak: ").append( - res->getIdPath()).append(" (").append(toString( - res->getRefCount())).append(")")); + res->mIdPath).append(" (").append(toString( + res->mRefCount)).append(")")); #ifdef UNITTESTS status = true; #endif // UNITTESTS diff --git a/src/resources/resourcemanager/resourcemanager_unittest.cc b/src/resources/resourcemanager/resourcemanager_unittest.cc index 8c8d72868..08d36da9c 100644 --- a/src/resources/resourcemanager/resourcemanager_unittest.cc +++ b/src/resources/resourcemanager/resourcemanager_unittest.cc @@ -149,13 +149,13 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(testResouceCounter == 1); REQUIRE(res != nullptr); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); res->decRef(); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); } SECTION("resourcemanager get 2") @@ -165,9 +165,9 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); - res->setSource("source 1"); - REQUIRE(res->getSource() == "source 1"); + REQUIRE(res->mRefCount == 1); + res->mSource = "source 1"; + REQUIRE(res->mSource == "source 1"); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); @@ -176,17 +176,17 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res2 != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 2); - REQUIRE(res2->getRefCount() == 2); - REQUIRE(res->getIdPath() == res2->getIdPath()); - REQUIRE(res2->getSource() == "source 1"); + REQUIRE(res->mRefCount == 2); + REQUIRE(res2->mRefCount == 2); + REQUIRE(res->mIdPath == res2->mIdPath); + REQUIRE(res2->mSource == "source 1"); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res2); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); res->decRef(); res2->decRef(); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); } SECTION("resourcemanager get 3") @@ -196,17 +196,17 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); - res->setSource("source 1"); + res->mSource = "source 1"; res->decRef(); REQUIRE(ResourceManager::getResources().size() == 0 + resSize); REQUIRE(ResourceManager::getOrphanedResources()["test1"] == res); REQUIRE(ResourceManager::getDeletedResources().empty() == true); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); } SECTION("resourcemanager get 4") @@ -216,14 +216,14 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); - res->setSource("source 1"); + res->mSource = "source 1"; res->decRef(); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); REQUIRE(ResourceManager::getResources().size() == 0 + resSize); REQUIRE(ResourceManager::getOrphanedResources()["test1"] == res); REQUIRE(ResourceManager::getDeletedResources().empty() == true); @@ -232,15 +232,15 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res2 != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res2->getRefCount() == 1); - REQUIRE(res->getIdPath() == res2->getIdPath()); - REQUIRE(res2->getSource() == "source 1"); + REQUIRE(res2->mRefCount == 1); + REQUIRE(res->mIdPath == res2->mIdPath); + REQUIRE(res2->mSource == "source 1"); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res2); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); res2->decRef(); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); } SECTION("resourcemanager get 5") @@ -251,14 +251,14 @@ TEST_CASE("resourcemanager", "resourcemanager") REQUIRE(ResourceManager::isInCache("test1") == true); REQUIRE(res != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); - res->setSource("source 1"); + res->mSource = "source 1"; res->decRef(); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); REQUIRE(ResourceManager::getResources().size() == 0 + resSize); REQUIRE(ResourceManager::getOrphanedResources().size() == 1); REQUIRE(ResourceManager::getOrphanedResources()["test1"] == res); @@ -277,14 +277,14 @@ TEST_CASE("resourcemanager", "resourcemanager") REQUIRE(ResourceManager::isInCache("test1") == true); REQUIRE(res2 != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res2->getRefCount() == 1); - REQUIRE(res2->getSource() == ""); + REQUIRE(res2->mRefCount == 1); + REQUIRE(res2->mSource == ""); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res2); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); res2->decRef(); - REQUIRE(res2->getRefCount() == 0); + REQUIRE(res2->mRefCount == 0); } SECTION("resourcemanager get 6") @@ -294,8 +294,8 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); - res->setSource("source 1"); + REQUIRE(res->mRefCount == 1); + res->mSource = "source 1"; REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); @@ -305,8 +305,8 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res2 != nullptr); REQUIRE(testResouceCounter == 2); - REQUIRE(res2->getRefCount() == 1); - REQUIRE(res2->getSource() == ""); + REQUIRE(res2->mRefCount == 1); + REQUIRE(res2->mSource == ""); REQUIRE(ResourceManager::getResources().size() == 2 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getResources()["test2"] == res2); @@ -314,8 +314,8 @@ TEST_CASE("resourcemanager", "resourcemanager") REQUIRE(ResourceManager::getDeletedResources().empty() == true); res->decRef(); res2->decRef(); - REQUIRE(res->getRefCount() == 0); - REQUIRE(res2->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); + REQUIRE(res2->mRefCount == 0); } SECTION("resourcemanager getFromCache 1") @@ -325,7 +325,7 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); @@ -333,16 +333,16 @@ TEST_CASE("resourcemanager", "resourcemanager") Resource *const res2 = ResourceManager::getFromCache("test1"); REQUIRE(res2 != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res2->getRefCount() == 2); + REQUIRE(res2->mRefCount == 2); REQUIRE(res == res2); - REQUIRE(res2->getSource() == ""); + REQUIRE(res2->mSource == ""); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res2); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); res->decRef(); res->decRef(); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); } SECTION("resourcemanager getFromCache 2") @@ -352,25 +352,25 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); res->decRef(); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); Resource *const res2 = ResourceManager::getFromCache("test1"); REQUIRE(res2 != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res2->getRefCount() == 1); + REQUIRE(res2->mRefCount == 1); REQUIRE(res == res2); - REQUIRE(res2->getSource() == ""); + REQUIRE(res2->mSource == ""); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res2); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); res->decRef(); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); } SECTION("resourcemanager getFromCache 3") @@ -380,8 +380,8 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); - res->setSource("source 1"); + REQUIRE(res->mRefCount == 1); + res->mSource = "source 1"; REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); @@ -391,8 +391,8 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res2 != nullptr); REQUIRE(testResouceCounter == 2); - REQUIRE(res2->getRefCount() == 1); - REQUIRE(res2->getSource() == ""); + REQUIRE(res2->mRefCount == 1); + REQUIRE(res2->mSource == ""); REQUIRE(ResourceManager::getResources().size() == 2 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getResources()["test2"] == res2); @@ -406,8 +406,8 @@ TEST_CASE("resourcemanager", "resourcemanager") REQUIRE(testResouceCounter == 2); REQUIRE(res == resC); REQUIRE(res2 == res2C); - REQUIRE(resC->getRefCount() == 2); - REQUIRE(res2C->getRefCount() == 2); + REQUIRE(resC->mRefCount == 2); + REQUIRE(res2C->mRefCount == 2); REQUIRE(ResourceManager::getResources().size() == 2 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == resC); REQUIRE(ResourceManager::getResources()["test2"] == res2C); @@ -418,8 +418,8 @@ TEST_CASE("resourcemanager", "resourcemanager") res->decRef(); res2->decRef(); res2->decRef(); - REQUIRE(res->getRefCount() == 0); - REQUIRE(res2->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); + REQUIRE(res2->mRefCount == 0); } SECTION("resourcemanager addResource 1") @@ -429,13 +429,13 @@ TEST_CASE("resourcemanager", "resourcemanager") REQUIRE(testResouceCounter == 1); ResourceManager::addResource("test1", res); REQUIRE(res != nullptr); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); res->decRef(); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); } SECTION("resourcemanager isInCache 1") @@ -449,13 +449,13 @@ TEST_CASE("resourcemanager", "resourcemanager") REQUIRE(ResourceManager::isInCache("test2") == false); REQUIRE(testResouceCounter == 1); REQUIRE(res != nullptr); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); res->decRef(); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); } SECTION("resourcemanager getTempResource 1") @@ -466,7 +466,7 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(res != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); @@ -475,15 +475,15 @@ TEST_CASE("resourcemanager", "resourcemanager") REQUIRE(ResourceManager::getTempResource("test2") == nullptr); REQUIRE(res2 != nullptr); REQUIRE(testResouceCounter == 1); - REQUIRE(res2->getRefCount() == 1); + REQUIRE(res2->mRefCount == 1); REQUIRE(res == res2); - REQUIRE(res2->getSource() == ""); + REQUIRE(res2->mSource == ""); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res2); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); res->decRef(); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); } SECTION("resourcemanager moveToDeleted 1") @@ -494,7 +494,7 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(testResouceCounter == 1); REQUIRE(res != nullptr); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); @@ -515,14 +515,14 @@ TEST_CASE("resourcemanager", "resourcemanager") res->incRef(); REQUIRE(testResouceCounter == 1); REQUIRE(res != nullptr); - REQUIRE(res->getRefCount() == 2); + REQUIRE(res->mRefCount == 2); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); ResourceManager::moveToDeleted(res); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 0 + resSize); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().size() == 1); @@ -537,7 +537,7 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(testResouceCounter == 1); REQUIRE(res != nullptr); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); @@ -545,7 +545,7 @@ TEST_CASE("resourcemanager", "resourcemanager") res->decRef(); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 0); + REQUIRE(res->mRefCount == 0); REQUIRE(ResourceManager::getResources().size() == 0 + resSize); REQUIRE(ResourceManager::getOrphanedResources().size() == 1); REQUIRE(ResourceManager::getOrphanedResources()["test1"] == res); @@ -566,7 +566,7 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(testResouceCounter == 1); REQUIRE(res != nullptr); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); @@ -587,7 +587,7 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(testResouceCounter == 1); REQUIRE(res != nullptr); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); @@ -610,12 +610,12 @@ TEST_CASE("resourcemanager", "resourcemanager") TestLoader::load, &rl); REQUIRE(testResouceCounter == 1); REQUIRE(res != nullptr); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); - res->setProtected(true); + res->mProtected = true; ResourceManager::cleanProtected(); REQUIRE(testResouceCounter == 1); @@ -635,21 +635,21 @@ TEST_CASE("resourcemanager", "resourcemanager") res->incRef(); REQUIRE(testResouceCounter == 1); REQUIRE(res != nullptr); - REQUIRE(res->getRefCount() == 2); + REQUIRE(res->mRefCount == 2); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); ResourceManager::moveToDeleted(res); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 0 + resSize); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().size() == 1); ResourceManager::clearDeleted(); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 0 + resSize); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().size() == 1); @@ -665,14 +665,14 @@ TEST_CASE("resourcemanager", "resourcemanager") res->incRef(); REQUIRE(testResouceCounter == 1); REQUIRE(res != nullptr); - REQUIRE(res->getRefCount() == 2); + REQUIRE(res->mRefCount == 2); REQUIRE(ResourceManager::getResources().size() == 1 + resSize); REQUIRE(ResourceManager::getResources()["test1"] == res); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().empty() == true); ResourceManager::moveToDeleted(res); REQUIRE(testResouceCounter == 1); - REQUIRE(res->getRefCount() == 1); + REQUIRE(res->mRefCount == 1); REQUIRE(ResourceManager::getResources().size() == 0 + resSize); REQUIRE(ResourceManager::getOrphanedResources().empty() == true); REQUIRE(ResourceManager::getDeletedResources().size() == 1); |