Skip to content

Commit

Permalink
Tests: range loop refactoring and change raw pointer to smart pointer (
Browse files Browse the repository at this point in the history
  • Loading branch information
Joilnen authored Jan 13, 2025
1 parent a038f65 commit dce85e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 17 deletions.
6 changes: 3 additions & 3 deletions Tests/OgreMain/include/RootWithoutRenderSystemFixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ THE SOFTWARE.

class RootWithoutRenderSystemFixture : public ::testing::Test {
public:
Ogre::Root* mRoot;
Ogre::HardwareBufferManager* mHBM;
Ogre::FileSystemLayer* mFSLayer;
std::unique_ptr<Ogre::HardwareBufferManager> mHBM;
std::unique_ptr<Ogre::FileSystemLayer> mFSLayer;
std::shared_ptr<Ogre::Root> mRoot;
void SetUp() override;
void TearDown() override;
};
Expand Down
24 changes: 10 additions & 14 deletions Tests/OgreMain/src/RootWithoutRenderSystemFixture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ using namespace Ogre;

void RootWithoutRenderSystemFixture::SetUp()
{
mFSLayer = new FileSystemLayer(OGRE_VERSION_NAME);
mRoot = new Root("");
mHBM = new DefaultHardwareBufferManager;
mRoot.reset(new Root(""));
mFSLayer.reset(new FileSystemLayer(OGRE_VERSION_NAME));
mHBM.reset(new DefaultHardwareBufferManager);

MaterialManager::getSingleton().initialise();

Expand All @@ -25,23 +25,19 @@ void RootWithoutRenderSystemFixture::SetUp()
cf.load(resourcesPath);
// Go through all sections & settings in the file
String secName, typeName, archName;
ConfigFile::SettingsBySection_::const_iterator seci;
for(seci = cf.getSettingsBySection().begin(); seci != cf.getSettingsBySection().end(); ++seci) {
secName = seci->first;
const ConfigFile::SettingsMultiMap& settings = seci->second;
ConfigFile::SettingsMultiMap::const_iterator i;
for (i = settings.begin(); i != settings.end(); ++i)
for(const auto& e : cf.getSettingsBySection()) {
secName = e.first;
const ConfigFile::SettingsMultiMap& settings = e.second;
for (const auto& s : settings)
{
typeName = i->first;
archName = i->second;
typeName = s.first;
archName = s.second;
ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
}
}
}

void RootWithoutRenderSystemFixture::TearDown()
{
delete mRoot;
delete mHBM;
delete mFSLayer;

}

0 comments on commit dce85e8

Please sign in to comment.