mirror of https://github.com/OpenMW/openmw.git
Merge branch openmw:master into handtohand-tooltip
commit
3d2dd9201d
@ -1,11 +1,28 @@
|
|||||||
#include <components/debug/debugging.hpp>
|
#include <components/debug/debugging.hpp>
|
||||||
|
#include <components/misc/strings/conversion.hpp>
|
||||||
|
#include <components/settings/parser.hpp>
|
||||||
|
#include <components/settings/values.hpp>
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
Log::sMinDebugLevel = Debug::getDebugLevel();
|
Log::sMinDebugLevel = Debug::getDebugLevel();
|
||||||
|
|
||||||
|
const std::filesystem::path settingsDefaultPath = std::filesystem::path{ OPENMW_PROJECT_SOURCE_DIR } / "files"
|
||||||
|
/ Misc::StringUtils::stringToU8String("settings-default.cfg");
|
||||||
|
|
||||||
|
Settings::SettingsFileParser parser;
|
||||||
|
parser.loadSettingsFile(settingsDefaultPath, Settings::Manager::mDefaultSettings);
|
||||||
|
|
||||||
|
Settings::StaticValues::initDefaults();
|
||||||
|
|
||||||
|
Settings::Manager::mUserSettings = Settings::Manager::mDefaultSettings;
|
||||||
|
|
||||||
|
Settings::StaticValues::init();
|
||||||
|
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,82 @@
|
|||||||
|
#include "apps/openmw/mwclass/npc.hpp"
|
||||||
|
#include "apps/openmw/mwworld/esmstore.hpp"
|
||||||
|
#include "apps/openmw/mwworld/livecellref.hpp"
|
||||||
|
#include "apps/openmw/mwworld/ptr.hpp"
|
||||||
|
#include "apps/openmw/mwworld/worldmodel.hpp"
|
||||||
|
|
||||||
|
#include <components/esm3/loadnpc.hpp>
|
||||||
|
#include <components/esm3/readerscache.hpp>
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
namespace MWWorld
|
||||||
|
{
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
using namespace testing;
|
||||||
|
|
||||||
|
TEST(MWWorldPtrTest, toStringShouldReturnHumanReadableTextRepresentationOfPtrWithNullRef)
|
||||||
|
{
|
||||||
|
Ptr ptr;
|
||||||
|
EXPECT_EQ(ptr.toString(), "null object");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(MWWorldPtrTest, toStringShouldReturnHumanReadableTextRepresentationOfPtrWithDeletedRef)
|
||||||
|
{
|
||||||
|
MWClass::Npc::registerSelf();
|
||||||
|
ESM::NPC npc;
|
||||||
|
npc.blank();
|
||||||
|
npc.mId = ESM::RefId::stringRefId("Player");
|
||||||
|
ESMStore store;
|
||||||
|
store.insert(npc);
|
||||||
|
ESM::CellRef cellRef;
|
||||||
|
cellRef.blank();
|
||||||
|
cellRef.mRefID = npc.mId;
|
||||||
|
cellRef.mRefNum = ESM::RefNum{ .mIndex = 0x2a, .mContentFile = 0xd };
|
||||||
|
LiveCellRef<ESM::NPC> liveCellRef(cellRef, &npc);
|
||||||
|
liveCellRef.mData.setDeletedByContentFile(true);
|
||||||
|
Ptr ptr(&liveCellRef);
|
||||||
|
EXPECT_EQ(ptr.toString(), "deleted object0xd00002a (NPC, \"player\")");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(MWWorldPtrTest, toStringShouldReturnHumanReadableTextRepresentationOfPtr)
|
||||||
|
{
|
||||||
|
MWClass::Npc::registerSelf();
|
||||||
|
ESM::NPC npc;
|
||||||
|
npc.blank();
|
||||||
|
npc.mId = ESM::RefId::stringRefId("Player");
|
||||||
|
ESMStore store;
|
||||||
|
store.insert(npc);
|
||||||
|
ESM::CellRef cellRef;
|
||||||
|
cellRef.blank();
|
||||||
|
cellRef.mRefID = npc.mId;
|
||||||
|
cellRef.mRefNum = ESM::RefNum{ .mIndex = 0x2a, .mContentFile = 0xd };
|
||||||
|
LiveCellRef<ESM::NPC> liveCellRef(cellRef, &npc);
|
||||||
|
Ptr ptr(&liveCellRef);
|
||||||
|
EXPECT_EQ(ptr.toString(), "object0xd00002a (NPC, \"player\")");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(MWWorldPtrTest, underlyingLiveCellRefShouldBeDeregisteredOnDestruction)
|
||||||
|
{
|
||||||
|
MWClass::Npc::registerSelf();
|
||||||
|
ESM::NPC npc;
|
||||||
|
npc.blank();
|
||||||
|
npc.mId = ESM::RefId::stringRefId("Player");
|
||||||
|
ESMStore store;
|
||||||
|
store.insert(npc);
|
||||||
|
ESM::ReadersCache readersCache;
|
||||||
|
WorldModel worldModel(store, readersCache);
|
||||||
|
ESM::CellRef cellRef;
|
||||||
|
cellRef.blank();
|
||||||
|
cellRef.mRefID = npc.mId;
|
||||||
|
cellRef.mRefNum = ESM::FormId{ .mIndex = 0x2a, .mContentFile = 0xd };
|
||||||
|
{
|
||||||
|
LiveCellRef<ESM::NPC> liveCellRef(cellRef, &npc);
|
||||||
|
Ptr ptr(&liveCellRef);
|
||||||
|
worldModel.registerPtr(ptr);
|
||||||
|
ASSERT_EQ(worldModel.getPtr(cellRef.mRefNum), ptr);
|
||||||
|
}
|
||||||
|
EXPECT_EQ(worldModel.getPtr(cellRef.mRefNum), Ptr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
#Music: "OpenMW Music"
|
Music: "OpenMW : Musique"
|
||||||
#settingsPageDescription: "OpenMW Music settings"
|
settingsPageDescription: "Paramètre de la musique d'OpenMW"
|
||||||
|
|
||||||
#musicSettings: "Music configuration"
|
musicSettings: "Configuration de la musique"
|
||||||
|
|
||||||
#CombatMusicEnabled: "Play combat music"
|
CombatMusicEnabled: "Jouer la musique de combat"
|
||||||
#CombatMusicEnabledDescription: "Whether to switch to combat music when there are actors in combat."
|
CombatMusicEnabledDescription: "Si activé, le jeu bascule vers la musique de combat dès qu'un personnage est en combat."
|
||||||
|
Loading…
Reference in New Issue