mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Rename PluginDirtyInfo class to PluginCleaningData
It'll be used to hold data about clean plugins too.
This commit is contained in:
+3
-3
@@ -161,7 +161,7 @@ set (LOOT_SRC "${CMAKE_SOURCE_DIR}/src/backend/app/loot_paths.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/location.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/message.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/message_content.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/plugin_dirty_info.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/plugin_cleaning_data.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/plugin_metadata.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/tag.cpp"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/game/game.cpp"
|
||||
@@ -187,7 +187,7 @@ set (LOOT_HEADERS "${CMAKE_SOURCE_DIR}/src/backend/app/loot_paths.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/location.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/message.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/message_content.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/plugin_dirty_info.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/plugin_cleaning_data.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/plugin_metadata.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/metadata/tag.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/backend/game/game.h"
|
||||
@@ -254,7 +254,7 @@ set (LOOT_TESTS_HEADERS # Testing this here rather than as part of the API tests
|
||||
"${CMAKE_SOURCE_DIR}/src/tests/backend/metadata/location_test.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/tests/backend/metadata/message_test.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/tests/backend/metadata/message_content_test.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/tests/backend/metadata/plugin_dirty_info_test.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/tests/backend/metadata/plugin_cleaning_data_test.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/tests/backend/metadata/plugin_metadata_test.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/tests/backend/metadata/tag_test.h"
|
||||
"${CMAKE_SOURCE_DIR}/src/tests/backend/plugin/plugin_test.h"
|
||||
|
||||
@@ -8,7 +8,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: LOOT 0.9.2\n"
|
||||
"Report-Msgid-Bugs-To: https://github.com/loot/loot/issues\n"
|
||||
"POT-Creation-Date: 2016-08-04 21:46+0200\n"
|
||||
"POT-Creation-Date: 2016-08-06 16:31+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -784,38 +784,38 @@ msgstr ""
|
||||
msgid "Failed to parse condition \"%1%\"."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/metadata/plugin_dirty_info.cpp:69
|
||||
#: src/backend/metadata/plugin_cleaning_data.cpp:71
|
||||
msgid ""
|
||||
"Contains %1% ITM records, %2% deleted references and %3% deleted navmeshes. "
|
||||
"Clean with %4%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/metadata/plugin_dirty_info.cpp:71
|
||||
#: src/backend/metadata/plugin_cleaning_data.cpp:73
|
||||
msgid "Clean with %1%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/metadata/plugin_dirty_info.cpp:74
|
||||
#: src/backend/metadata/plugin_cleaning_data.cpp:76
|
||||
msgid ""
|
||||
"Contains %1% deleted references and %2% deleted navmeshes. Clean with %3%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/metadata/plugin_dirty_info.cpp:76
|
||||
#: src/backend/metadata/plugin_cleaning_data.cpp:78
|
||||
msgid "Contains %1% deleted navmeshes. Clean with %2%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/metadata/plugin_dirty_info.cpp:78
|
||||
#: src/backend/metadata/plugin_cleaning_data.cpp:80
|
||||
msgid "Contains %1% deleted references. Clean with %2%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/metadata/plugin_dirty_info.cpp:81
|
||||
#: src/backend/metadata/plugin_cleaning_data.cpp:83
|
||||
msgid "Contains %1% ITM records and %2% deleted navmeshes. Clean with %3%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/metadata/plugin_dirty_info.cpp:83
|
||||
#: src/backend/metadata/plugin_cleaning_data.cpp:85
|
||||
msgid "Contains %1% ITM records. Clean with %2%."
|
||||
msgstr ""
|
||||
|
||||
#: src/backend/metadata/plugin_dirty_info.cpp:86
|
||||
#: src/backend/metadata/plugin_cleaning_data.cpp:88
|
||||
msgid "Contains %1% ITM records and %2% deleted references. Clean with %3%."
|
||||
msgstr ""
|
||||
|
||||
|
||||
+40
-38
@@ -22,7 +22,7 @@
|
||||
<https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "backend/metadata/plugin_dirty_info.h"
|
||||
#include "backend/metadata/plugin_cleaning_data.h"
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/locale.hpp>
|
||||
@@ -31,68 +31,70 @@
|
||||
#include "backend/helpers/helpers.h"
|
||||
|
||||
namespace loot {
|
||||
PluginDirtyInfo::PluginDirtyInfo() : _crc(0), _itm(0), _ref(0), _nav(0) {}
|
||||
PluginCleaningData::PluginCleaningData() : crc_(0), itm_(0), ref_(0), nav_(0) {}
|
||||
|
||||
PluginDirtyInfo::PluginDirtyInfo(uint32_t crc, unsigned int itm, unsigned int ref, unsigned int nav, const std::string& utility) : _crc(crc), _itm(itm), _ref(ref), _nav(nav), _utility(utility) {}
|
||||
PluginCleaningData::PluginCleaningData(uint32_t crc, const std::string& utility) : crc_(crc), utility_(utility), itm_(0), ref_(0), nav_(0) {}
|
||||
|
||||
bool PluginDirtyInfo::operator < (const PluginDirtyInfo& rhs) const {
|
||||
return _crc < rhs.CRC();
|
||||
PluginCleaningData::PluginCleaningData(uint32_t crc, unsigned int itm, unsigned int ref, unsigned int nav, const std::string& utility) : crc_(crc), itm_(itm), ref_(ref), nav_(nav), utility_(utility) {}
|
||||
|
||||
bool PluginCleaningData::operator < (const PluginCleaningData& rhs) const {
|
||||
return crc_ < rhs.CRC();
|
||||
}
|
||||
|
||||
bool PluginDirtyInfo::operator == (const PluginDirtyInfo& rhs) const {
|
||||
return _crc == rhs.CRC();
|
||||
bool PluginCleaningData::operator == (const PluginCleaningData& rhs) const {
|
||||
return crc_ == rhs.CRC();
|
||||
}
|
||||
|
||||
uint32_t PluginDirtyInfo::CRC() const {
|
||||
return _crc;
|
||||
uint32_t PluginCleaningData::CRC() const {
|
||||
return crc_;
|
||||
}
|
||||
|
||||
unsigned int PluginDirtyInfo::ITMs() const {
|
||||
return _itm;
|
||||
unsigned int PluginCleaningData::ITMs() const {
|
||||
return itm_;
|
||||
}
|
||||
|
||||
unsigned int PluginDirtyInfo::DeletedRefs() const {
|
||||
return _ref;
|
||||
unsigned int PluginCleaningData::DeletedRefs() const {
|
||||
return ref_;
|
||||
}
|
||||
|
||||
unsigned int PluginDirtyInfo::DeletedNavmeshes() const {
|
||||
return _nav;
|
||||
unsigned int PluginCleaningData::DeletedNavmeshes() const {
|
||||
return nav_;
|
||||
}
|
||||
|
||||
std::string PluginDirtyInfo::CleaningUtility() const {
|
||||
return _utility;
|
||||
std::string PluginCleaningData::CleaningUtility() const {
|
||||
return utility_;
|
||||
}
|
||||
|
||||
Message PluginDirtyInfo::AsMessage() const {
|
||||
Message PluginCleaningData::AsMessage() const {
|
||||
boost::format f;
|
||||
if (this->_itm > 0 && this->_ref > 0 && this->_nav > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records, %2% deleted references and %3% deleted navmeshes. Clean with %4%.")) % this->_itm % this->_ref % this->_nav % this->_utility;
|
||||
else if (this->_itm == 0 && this->_ref == 0 && this->_nav == 0)
|
||||
f = boost::format(boost::locale::translate("Clean with %1%.")) % this->_utility;
|
||||
if (this->itm_ > 0 && this->ref_ > 0 && this->nav_ > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records, %2% deleted references and %3% deleted navmeshes. Clean with %4%.")) % this->itm_ % this->ref_ % this->nav_ % this->utility_;
|
||||
else if (this->itm_ == 0 && this->ref_ == 0 && this->nav_ == 0)
|
||||
f = boost::format(boost::locale::translate("Clean with %1%.")) % this->utility_;
|
||||
|
||||
else if (this->_itm == 0 && this->_ref > 0 && this->_nav > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% deleted references and %2% deleted navmeshes. Clean with %3%.")) % this->_ref % this->_nav % this->_utility;
|
||||
else if (this->_itm == 0 && this->_ref == 0 && this->_nav > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% deleted navmeshes. Clean with %2%.")) % this->_nav % this->_utility;
|
||||
else if (this->_itm == 0 && this->_ref > 0 && this->_nav == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% deleted references. Clean with %2%.")) % this->_ref % this->_utility;
|
||||
else if (this->itm_ == 0 && this->ref_ > 0 && this->nav_ > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% deleted references and %2% deleted navmeshes. Clean with %3%.")) % this->ref_ % this->nav_ % this->utility_;
|
||||
else if (this->itm_ == 0 && this->ref_ == 0 && this->nav_ > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% deleted navmeshes. Clean with %2%.")) % this->nav_ % this->utility_;
|
||||
else if (this->itm_ == 0 && this->ref_ > 0 && this->nav_ == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% deleted references. Clean with %2%.")) % this->ref_ % this->utility_;
|
||||
|
||||
else if (this->_itm > 0 && this->_ref == 0 && this->_nav > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% deleted navmeshes. Clean with %3%.")) % this->_itm % this->_nav % this->_utility;
|
||||
else if (this->_itm > 0 && this->_ref == 0 && this->_nav == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records. Clean with %2%.")) % this->_itm % this->_utility;
|
||||
else if (this->itm_ > 0 && this->ref_ == 0 && this->nav_ > 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% deleted navmeshes. Clean with %3%.")) % this->itm_ % this->nav_ % this->utility_;
|
||||
else if (this->itm_ > 0 && this->ref_ == 0 && this->nav_ == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records. Clean with %2%.")) % this->itm_ % this->utility_;
|
||||
|
||||
else if (this->_itm > 0 && this->_ref > 0 && this->_nav == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% deleted references. Clean with %3%.")) % this->_itm % this->_ref % this->_utility;
|
||||
else if (this->itm_ > 0 && this->ref_ > 0 && this->nav_ == 0)
|
||||
f = boost::format(boost::locale::translate("Contains %1% ITM records and %2% deleted references. Clean with %3%.")) % this->itm_ % this->ref_ % this->utility_;
|
||||
|
||||
return Message(Message::Type::warn, f.str());
|
||||
}
|
||||
|
||||
bool PluginDirtyInfo::EvalCondition(Game& game, const std::string& pluginName) const {
|
||||
bool PluginCleaningData::EvalCondition(Game& game, const std::string& pluginName) const {
|
||||
if (pluginName.empty())
|
||||
return false;
|
||||
|
||||
// First need to get plugin's CRC.
|
||||
// First need to get plugin's CRC.
|
||||
uint32_t crc = 0;
|
||||
|
||||
// Get the CRC from the game plugin cache if possible.
|
||||
@@ -109,12 +111,12 @@ bool PluginDirtyInfo::EvalCondition(Game& game, const std::string& pluginName) c
|
||||
}
|
||||
}
|
||||
|
||||
return _crc == crc;
|
||||
return crc_ == crc;
|
||||
}
|
||||
}
|
||||
|
||||
namespace YAML {
|
||||
Emitter& operator << (Emitter& out, const loot::PluginDirtyInfo& rhs) {
|
||||
Emitter& operator << (Emitter& out, const loot::PluginCleaningData& rhs) {
|
||||
out << BeginMap
|
||||
<< Key << "crc" << Value << Hex << rhs.CRC() << Dec
|
||||
<< Key << "util" << Value << YAML::SingleQuoted << rhs.CleaningUtility();
|
||||
+22
-20
@@ -21,8 +21,9 @@
|
||||
along with LOOT. If not, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef LOOT_BACKEND_METADATA_PLUGIN_DIRTY_INFO
|
||||
#define LOOT_BACKEND_METADATA_PLUGIN_DIRTY_INFO
|
||||
|
||||
#ifndef LOOT_BACKEND_METADATA_PLUGIN_CLEANING_DATA
|
||||
#define LOOT_BACKEND_METADATA_PLUGIN_CLEANING_DATA
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -34,13 +35,14 @@
|
||||
namespace loot {
|
||||
class Game;
|
||||
|
||||
class PluginDirtyInfo {
|
||||
class PluginCleaningData {
|
||||
public:
|
||||
PluginDirtyInfo();
|
||||
PluginDirtyInfo(uint32_t crc, unsigned int itm, unsigned int ref, unsigned int nav, const std::string& utility);
|
||||
PluginCleaningData();
|
||||
PluginCleaningData(uint32_t crc, const std::string& utility);
|
||||
PluginCleaningData(uint32_t crc, unsigned int itm, unsigned int ref, unsigned int nav, const std::string& utility);
|
||||
|
||||
bool operator < (const PluginDirtyInfo& rhs) const;
|
||||
bool operator == (const PluginDirtyInfo& rhs) const;
|
||||
bool operator < (const PluginCleaningData& rhs) const;
|
||||
bool operator == (const PluginCleaningData& rhs) const;
|
||||
|
||||
uint32_t CRC() const;
|
||||
unsigned int ITMs() const;
|
||||
@@ -52,18 +54,18 @@ public:
|
||||
|
||||
bool EvalCondition(Game& game, const std::string& pluginName) const;
|
||||
private:
|
||||
uint32_t _crc;
|
||||
unsigned int _itm;
|
||||
unsigned int _ref;
|
||||
unsigned int _nav;
|
||||
std::string _utility;
|
||||
uint32_t crc_;
|
||||
unsigned int itm_;
|
||||
unsigned int ref_;
|
||||
unsigned int nav_;
|
||||
std::string utility_;
|
||||
};
|
||||
}
|
||||
|
||||
namespace YAML {
|
||||
template<>
|
||||
struct convert<loot::PluginDirtyInfo> {
|
||||
static Node encode(const loot::PluginDirtyInfo& rhs) {
|
||||
struct convert<loot::PluginCleaningData> {
|
||||
static Node encode(const loot::PluginCleaningData& rhs) {
|
||||
Node node;
|
||||
node["crc"] = rhs.CRC();
|
||||
node["util"] = rhs.CleaningUtility();
|
||||
@@ -78,13 +80,13 @@ struct convert<loot::PluginDirtyInfo> {
|
||||
return node;
|
||||
}
|
||||
|
||||
static bool decode(const Node& node, loot::PluginDirtyInfo& rhs) {
|
||||
static bool decode(const Node& node, loot::PluginCleaningData& rhs) {
|
||||
if (!node.IsMap())
|
||||
throw RepresentationException(node.Mark(), "bad conversion: 'dirty info' object must be a map");
|
||||
throw RepresentationException(node.Mark(), "bad conversion: 'cleaning data' object must be a map");
|
||||
if (!node["crc"])
|
||||
throw RepresentationException(node.Mark(), "bad conversion: 'crc' key missing from 'dirty info' object");
|
||||
throw RepresentationException(node.Mark(), "bad conversion: 'crc' key missing from 'cleaning data' object");
|
||||
if (!node["util"])
|
||||
throw RepresentationException(node.Mark(), "bad conversion: 'util' key missing from 'dirty info' object");
|
||||
throw RepresentationException(node.Mark(), "bad conversion: 'util' key missing from 'cleaning data' object");
|
||||
|
||||
uint32_t crc = node["crc"].as<uint32_t>();
|
||||
int itm = 0, ref = 0, nav = 0;
|
||||
@@ -98,13 +100,13 @@ struct convert<loot::PluginDirtyInfo> {
|
||||
|
||||
std::string utility = node["util"].as<std::string>();
|
||||
|
||||
rhs = loot::PluginDirtyInfo(crc, itm, ref, nav, utility);
|
||||
rhs = loot::PluginCleaningData(crc, itm, ref, nav, utility);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Emitter& operator << (Emitter& out, const loot::PluginDirtyInfo& rhs);
|
||||
Emitter& operator << (Emitter& out, const loot::PluginCleaningData& rhs);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -144,7 +144,7 @@ PluginMetadata PluginMetadata::DiffMetadata(const PluginMetadata& plugin) const
|
||||
inserter(tagDiff, begin(tagDiff)));
|
||||
p.Tags(tagDiff);
|
||||
|
||||
set<PluginDirtyInfo> dirtDiff;
|
||||
set<PluginCleaningData> dirtDiff;
|
||||
set_symmetric_difference(begin(dirtyInfo_),
|
||||
end(dirtyInfo_),
|
||||
begin(plugin.dirtyInfo_),
|
||||
@@ -214,7 +214,7 @@ PluginMetadata PluginMetadata::NewMetadata(const PluginMetadata& plugin) const {
|
||||
inserter(tagDiff, begin(tagDiff)));
|
||||
p.Tags(tagDiff);
|
||||
|
||||
set<PluginDirtyInfo> dirtDiff;
|
||||
set<PluginCleaningData> dirtDiff;
|
||||
set_difference(begin(dirtyInfo_),
|
||||
end(dirtyInfo_),
|
||||
begin(plugin.dirtyInfo_),
|
||||
@@ -273,7 +273,7 @@ std::set<Tag> PluginMetadata::Tags() const {
|
||||
return tags_;
|
||||
}
|
||||
|
||||
std::set<PluginDirtyInfo> PluginMetadata::DirtyInfo() const {
|
||||
std::set<PluginCleaningData> PluginMetadata::DirtyInfo() const {
|
||||
return dirtyInfo_;
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ void PluginMetadata::Tags(const std::set<Tag>& t) {
|
||||
tags_ = t;
|
||||
}
|
||||
|
||||
void PluginMetadata::DirtyInfo(const std::set<PluginDirtyInfo>& dirtyInfo) {
|
||||
void PluginMetadata::DirtyInfo(const std::set<PluginCleaningData>& dirtyInfo) {
|
||||
dirtyInfo_ = dirtyInfo;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "backend/metadata/file.h"
|
||||
#include "backend/metadata/location.h"
|
||||
#include "backend/metadata/message.h"
|
||||
#include "backend/metadata/plugin_dirty_info.h"
|
||||
#include "backend/metadata/plugin_cleaning_data.h"
|
||||
#include "backend/metadata/tag.h"
|
||||
|
||||
namespace loot {
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
std::set<File> Incs() const;
|
||||
std::list<Message> Messages() const;
|
||||
std::set<Tag> Tags() const;
|
||||
std::set<PluginDirtyInfo> DirtyInfo() const;
|
||||
std::set<PluginCleaningData> DirtyInfo() const;
|
||||
std::set<Location> Locations() const;
|
||||
|
||||
void Enabled(const bool enabled);
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
void Incs(const std::set<File>& incs);
|
||||
void Messages(const std::list<Message>& messages);
|
||||
void Tags(const std::set<Tag>& tags);
|
||||
void DirtyInfo(const std::set<PluginDirtyInfo>& info);
|
||||
void DirtyInfo(const std::set<PluginCleaningData>& info);
|
||||
void Locations(const std::set<Location>& locations);
|
||||
|
||||
PluginMetadata& EvalAllConditions(Game& game, const Language::Code language);
|
||||
@@ -115,7 +115,7 @@ private:
|
||||
std::set<File> loadAfter_;
|
||||
std::set<File> requirements_;
|
||||
std::set<File> incompatibilities_;
|
||||
std::set<PluginDirtyInfo> dirtyInfo_;
|
||||
std::set<PluginCleaningData> dirtyInfo_;
|
||||
std::set<Location> locations_;
|
||||
};
|
||||
}
|
||||
@@ -201,7 +201,7 @@ struct convert<loot::PluginMetadata> {
|
||||
if (rhs.IsRegexPlugin())
|
||||
throw RepresentationException(node.Mark(), "bad conversion: 'dirty' key must not be present in a regex 'plugin metadata' object");
|
||||
else
|
||||
rhs.DirtyInfo(node["dirty"].as< std::set<loot::PluginDirtyInfo> >());
|
||||
rhs.DirtyInfo(node["dirty"].as< std::set<loot::PluginCleaningData> >());
|
||||
}
|
||||
if (node["url"])
|
||||
rhs.Locations(node["url"].as< std::set<loot::Location> >());
|
||||
|
||||
@@ -464,7 +464,7 @@ std::string QueryHandler::ApplyUserEdits(const YAML::Node& pluginMetadata) {
|
||||
if (pluginMetadata["userlist"]["tag"])
|
||||
newUserlistEntry.Tags(pluginMetadata["userlist"]["tag"].as<set<Tag>>());
|
||||
if (pluginMetadata["userlist"]["dirty"])
|
||||
newUserlistEntry.DirtyInfo(pluginMetadata["userlist"]["dirty"].as<set<PluginDirtyInfo>>());
|
||||
newUserlistEntry.DirtyInfo(pluginMetadata["userlist"]["dirty"].as<set<PluginCleaningData>>());
|
||||
if (pluginMetadata["userlist"]["url"])
|
||||
newUserlistEntry.Locations(pluginMetadata["userlist"]["url"].as<set<Location>>());
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "tests/backend/metadata/location_test.h"
|
||||
#include "tests/backend/metadata/message_test.h"
|
||||
#include "tests/backend/metadata/message_content_test.h"
|
||||
#include "tests/backend/metadata/plugin_dirty_info_test.h"
|
||||
#include "tests/backend/metadata/plugin_cleaning_data_test.h"
|
||||
#include "tests/backend/metadata/plugin_metadata_test.h"
|
||||
#include "tests/backend/metadata/tag_test.h"
|
||||
#include "tests/backend/plugin/plugin_test.h"
|
||||
|
||||
+51
-50
@@ -22,26 +22,27 @@ along with LOOT. If not, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef LOOT_TESTS_BACKEND_METADATA_PLUGIN_DIRTY_INFO_TEST
|
||||
#define LOOT_TESTS_BACKEND_METADATA_PLUGIN_DIRTY_INFO_TEST
|
||||
#ifndef LOOT_TESTS_BACKEND_METADATA_PLUGIN_CLEANING_DATA
|
||||
#define LOOT_TESTS_BACKEND_METADATA_PLUGIN_CLEANING_DATA
|
||||
|
||||
#include "backend/metadata/plugin_dirty_info.h"
|
||||
#include "backend/metadata/plugin_cleaning_data.h"
|
||||
|
||||
#include "backend/game/game.h"
|
||||
#include "tests/backend/base_game_test.h"
|
||||
|
||||
namespace loot {
|
||||
namespace test {
|
||||
class PluginDirtyInfoTest : public BaseGameTest {};
|
||||
class PluginCleaningDataTest : public BaseGameTest {};
|
||||
|
||||
// Pass an empty first argument, as it's a prefix for the test instantation,
|
||||
// but we only have the one so no prefix is necessary.
|
||||
INSTANTIATE_TEST_CASE_P(,
|
||||
PluginDirtyInfoTest,
|
||||
PluginCleaningDataTest,
|
||||
::testing::Values(
|
||||
GameType::tes4));
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, defaultConstructorShouldLeaveAllCountsAtZeroAndTheUtilityStringEmpty) {
|
||||
PluginDirtyInfo info;
|
||||
TEST_P(PluginCleaningDataTest, defaultConstructorShouldLeaveAllCountsAtZeroAndTheUtilityStringEmpty) {
|
||||
PluginCleaningData info;
|
||||
EXPECT_EQ(0, info.CRC());
|
||||
EXPECT_EQ(0, info.ITMs());
|
||||
EXPECT_EQ(0, info.DeletedRefs());
|
||||
@@ -49,8 +50,8 @@ TEST_P(PluginDirtyInfoTest, defaultConstructorShouldLeaveAllCountsAtZeroAndTheUt
|
||||
EXPECT_TRUE(info.CleaningUtility().empty());
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, contentConstructorShouldStoreAllGivenData) {
|
||||
PluginDirtyInfo info(0x12345678, 2, 10, 30, "cleaner");
|
||||
TEST_P(PluginCleaningDataTest, contentConstructorShouldStoreAllGivenData) {
|
||||
PluginCleaningData info(0x12345678, 2, 10, 30, "cleaner");
|
||||
EXPECT_EQ(0x12345678, info.CRC());
|
||||
EXPECT_EQ(2, info.ITMs());
|
||||
EXPECT_EQ(10, info.DeletedRefs());
|
||||
@@ -58,104 +59,104 @@ TEST_P(PluginDirtyInfoTest, contentConstructorShouldStoreAllGivenData) {
|
||||
EXPECT_EQ("cleaner", info.CleaningUtility());
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, asMessageShouldOutputAllNonZeroCounts) {
|
||||
Message message = PluginDirtyInfo(0x12345678, 2, 10, 30, "cleaner").AsMessage();
|
||||
TEST_P(PluginCleaningDataTest, asMessageShouldOutputAllNonZeroCounts) {
|
||||
Message message = PluginCleaningData(0x12345678, 2, 10, 30, "cleaner").AsMessage();
|
||||
EXPECT_EQ(Message::Type::warn, message.GetType());
|
||||
EXPECT_EQ("Contains 2 ITM records, 10 deleted references and 30 deleted navmeshes. Clean with cleaner.", message.ChooseContent(Language::Code::english).GetText());
|
||||
|
||||
message = PluginDirtyInfo(0x12345678, 0, 0, 0, "cleaner").AsMessage();
|
||||
message = PluginCleaningData(0x12345678, 0, 0, 0, "cleaner").AsMessage();
|
||||
EXPECT_EQ(Message::Type::warn, message.GetType());
|
||||
EXPECT_EQ("Clean with cleaner.", message.ChooseContent(Language::Code::english).GetText());
|
||||
|
||||
message = PluginDirtyInfo(0x12345678, 0, 10, 30, "cleaner").AsMessage();
|
||||
message = PluginCleaningData(0x12345678, 0, 10, 30, "cleaner").AsMessage();
|
||||
EXPECT_EQ(Message::Type::warn, message.GetType());
|
||||
EXPECT_EQ("Contains 10 deleted references and 30 deleted navmeshes. Clean with cleaner.", message.ChooseContent(Language::Code::english).GetText());
|
||||
|
||||
message = PluginDirtyInfo(0x12345678, 0, 0, 30, "cleaner").AsMessage();
|
||||
message = PluginCleaningData(0x12345678, 0, 0, 30, "cleaner").AsMessage();
|
||||
EXPECT_EQ(Message::Type::warn, message.GetType());
|
||||
EXPECT_EQ("Contains 30 deleted navmeshes. Clean with cleaner.", message.ChooseContent(Language::Code::english).GetText());
|
||||
|
||||
message = PluginDirtyInfo(0x12345678, 0, 10, 0, "cleaner").AsMessage();
|
||||
message = PluginCleaningData(0x12345678, 0, 10, 0, "cleaner").AsMessage();
|
||||
EXPECT_EQ(Message::Type::warn, message.GetType());
|
||||
EXPECT_EQ("Contains 10 deleted references. Clean with cleaner.", message.ChooseContent(Language::Code::english).GetText());
|
||||
|
||||
message = PluginDirtyInfo(0x12345678, 2, 0, 30, "cleaner").AsMessage();
|
||||
message = PluginCleaningData(0x12345678, 2, 0, 30, "cleaner").AsMessage();
|
||||
EXPECT_EQ(Message::Type::warn, message.GetType());
|
||||
EXPECT_EQ("Contains 2 ITM records and 30 deleted navmeshes. Clean with cleaner.", message.ChooseContent(Language::Code::english).GetText());
|
||||
|
||||
message = PluginDirtyInfo(0x12345678, 2, 0, 0, "cleaner").AsMessage();
|
||||
message = PluginCleaningData(0x12345678, 2, 0, 0, "cleaner").AsMessage();
|
||||
EXPECT_EQ(Message::Type::warn, message.GetType());
|
||||
EXPECT_EQ("Contains 2 ITM records. Clean with cleaner.", message.ChooseContent(Language::Code::english).GetText());
|
||||
|
||||
message = PluginDirtyInfo(0x12345678, 2, 10, 0, "cleaner").AsMessage();
|
||||
message = PluginCleaningData(0x12345678, 2, 10, 0, "cleaner").AsMessage();
|
||||
EXPECT_EQ(Message::Type::warn, message.GetType());
|
||||
EXPECT_EQ("Contains 2 ITM records and 10 deleted references. Clean with cleaner.", message.ChooseContent(Language::Code::english).GetText());
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, dirtyInfoShouldBeEqualIfCrcValuesAreEqual) {
|
||||
PluginDirtyInfo info1(0x12345678, 2, 10, 30, "cleaner1");
|
||||
PluginDirtyInfo info2(0x12345678, 4, 20, 60, "cleaner2");
|
||||
TEST_P(PluginCleaningDataTest, dirtyInfoShouldBeEqualIfCrcValuesAreEqual) {
|
||||
PluginCleaningData info1(0x12345678, 2, 10, 30, "cleaner1");
|
||||
PluginCleaningData info2(0x12345678, 4, 20, 60, "cleaner2");
|
||||
EXPECT_TRUE(info1 == info2);
|
||||
|
||||
info1 = PluginDirtyInfo(0x12345678, 2, 10, 30, "cleaner");
|
||||
info2 = PluginDirtyInfo(0x87654321, 2, 10, 30, "cleaner");
|
||||
info1 = PluginCleaningData(0x12345678, 2, 10, 30, "cleaner");
|
||||
info2 = PluginCleaningData(0x87654321, 2, 10, 30, "cleaner");
|
||||
EXPECT_FALSE(info1 == info2);
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, LessThanOperatorShouldCompareCrcValues) {
|
||||
PluginDirtyInfo info1(0x12345678, 2, 10, 30, "cleaner1");
|
||||
PluginDirtyInfo info2(0x12345678, 4, 20, 60, "cleaner2");
|
||||
TEST_P(PluginCleaningDataTest, LessThanOperatorShouldCompareCrcValues) {
|
||||
PluginCleaningData info1(0x12345678, 2, 10, 30, "cleaner1");
|
||||
PluginCleaningData info2(0x12345678, 4, 20, 60, "cleaner2");
|
||||
EXPECT_FALSE(info1 < info2);
|
||||
EXPECT_FALSE(info2 < info1);
|
||||
|
||||
info1 = PluginDirtyInfo(0x12345678, 2, 10, 30, "cleaner");
|
||||
info2 = PluginDirtyInfo(0x87654321, 2, 10, 30, "cleaner");
|
||||
info1 = PluginCleaningData(0x12345678, 2, 10, 30, "cleaner");
|
||||
info2 = PluginCleaningData(0x87654321, 2, 10, 30, "cleaner");
|
||||
EXPECT_TRUE(info1 < info2);
|
||||
EXPECT_FALSE(info2 < info1);
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, evalConditionShouldBeTrueIfTheCrcGivenMatchesTheRealPluginCrc) {
|
||||
TEST_P(PluginCleaningDataTest, evalConditionShouldBeTrueIfTheCrcGivenMatchesTheRealPluginCrc) {
|
||||
Game game(GetParam());
|
||||
game.SetGamePath(dataPath.parent_path());
|
||||
|
||||
PluginDirtyInfo dirtyInfo(blankEsmCrc, 2, 10, 30, "cleaner");
|
||||
PluginCleaningData dirtyInfo(blankEsmCrc, 2, 10, 30, "cleaner");
|
||||
EXPECT_TRUE(dirtyInfo.EvalCondition(game, blankEsm));
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, evalConditionShouldBeFalseIfTheCrcGivenDoesNotMatchTheRealPluginCrc) {
|
||||
TEST_P(PluginCleaningDataTest, evalConditionShouldBeFalseIfTheCrcGivenDoesNotMatchTheRealPluginCrc) {
|
||||
Game game(GetParam());
|
||||
game.SetGamePath(dataPath.parent_path());
|
||||
|
||||
PluginDirtyInfo dirtyInfo(0xDEADBEEF, 2, 10, 30, "cleaner");
|
||||
PluginCleaningData dirtyInfo(0xDEADBEEF, 2, 10, 30, "cleaner");
|
||||
EXPECT_FALSE(dirtyInfo.EvalCondition(game, blankEsm));
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, evalConditionShouldBeFalseIfAnEmptyPluginFilenameIsGiven) {
|
||||
TEST_P(PluginCleaningDataTest, evalConditionShouldBeFalseIfAnEmptyPluginFilenameIsGiven) {
|
||||
Game game(GetParam());
|
||||
game.SetGamePath(dataPath.parent_path());
|
||||
|
||||
PluginDirtyInfo dirtyInfo;
|
||||
PluginCleaningData dirtyInfo;
|
||||
EXPECT_FALSE(dirtyInfo.EvalCondition(game, ""));
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, emittingAsYamlShouldOutputAllNonZeroCounts) {
|
||||
PluginDirtyInfo info(0x12345678, 2, 10, 30, "cleaner");
|
||||
TEST_P(PluginCleaningDataTest, emittingAsYamlShouldOutputAllNonZeroCounts) {
|
||||
PluginCleaningData info(0x12345678, 2, 10, 30, "cleaner");
|
||||
YAML::Emitter emitter;
|
||||
emitter << info;
|
||||
|
||||
EXPECT_STREQ("crc: 0x12345678\nutil: 'cleaner'\nitm: 2\nudr: 10\nnav: 30", emitter.c_str());
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, emittingAsYamlShouldOmitAllZeroCounts) {
|
||||
PluginDirtyInfo info(0x12345678, 0, 0, 0, "cleaner");
|
||||
TEST_P(PluginCleaningDataTest, emittingAsYamlShouldOmitAllZeroCounts) {
|
||||
PluginCleaningData info(0x12345678, 0, 0, 0, "cleaner");
|
||||
YAML::Emitter emitter;
|
||||
emitter << info;
|
||||
|
||||
EXPECT_STREQ("crc: 0x12345678\nutil: 'cleaner'", emitter.c_str());
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, encodingAsYamlShouldOmitAllZeroCountFields) {
|
||||
PluginDirtyInfo info(0x12345678, 0, 0, 0, "cleaner");
|
||||
TEST_P(PluginCleaningDataTest, encodingAsYamlShouldOmitAllZeroCountFields) {
|
||||
PluginCleaningData info(0x12345678, 0, 0, 0, "cleaner");
|
||||
YAML::Node node;
|
||||
node = info;
|
||||
|
||||
@@ -166,8 +167,8 @@ TEST_P(PluginDirtyInfoTest, encodingAsYamlShouldOmitAllZeroCountFields) {
|
||||
EXPECT_FALSE(node["nav"]);
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, encodingAsYamlShouldOutputAllNonZeroCountFields) {
|
||||
PluginDirtyInfo info(0x12345678, 2, 10, 30, "cleaner");
|
||||
TEST_P(PluginCleaningDataTest, encodingAsYamlShouldOutputAllNonZeroCountFields) {
|
||||
PluginCleaningData info(0x12345678, 2, 10, 30, "cleaner");
|
||||
YAML::Node node;
|
||||
node = info;
|
||||
|
||||
@@ -178,9 +179,9 @@ TEST_P(PluginDirtyInfoTest, encodingAsYamlShouldOutputAllNonZeroCountFields) {
|
||||
EXPECT_EQ(30, node["nav"].as<unsigned int>());
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, decodingFromYamlShouldLeaveMissingFieldsWithZeroValues) {
|
||||
TEST_P(PluginCleaningDataTest, decodingFromYamlShouldLeaveMissingFieldsWithZeroValues) {
|
||||
YAML::Node node = YAML::Load("{crc: 0x12345678, util: cleaner}");
|
||||
PluginDirtyInfo info = node.as<PluginDirtyInfo>();
|
||||
PluginCleaningData info = node.as<PluginCleaningData>();
|
||||
|
||||
EXPECT_EQ(0x12345678, info.CRC());
|
||||
EXPECT_EQ(0, info.ITMs());
|
||||
@@ -189,9 +190,9 @@ TEST_P(PluginDirtyInfoTest, decodingFromYamlShouldLeaveMissingFieldsWithZeroValu
|
||||
EXPECT_EQ("cleaner", info.CleaningUtility());
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, decodingFromYamlShouldStoreAllNonZeroCounts) {
|
||||
TEST_P(PluginCleaningDataTest, decodingFromYamlShouldStoreAllNonZeroCounts) {
|
||||
YAML::Node node = YAML::Load("{crc: 0x12345678, util: cleaner, itm: 2, udr: 10, nav: 30}");
|
||||
PluginDirtyInfo info = node.as<PluginDirtyInfo>();
|
||||
PluginCleaningData info = node.as<PluginCleaningData>();
|
||||
|
||||
EXPECT_EQ(0x12345678, info.CRC());
|
||||
EXPECT_EQ(2, info.ITMs());
|
||||
@@ -200,16 +201,16 @@ TEST_P(PluginDirtyInfoTest, decodingFromYamlShouldStoreAllNonZeroCounts) {
|
||||
EXPECT_EQ("cleaner", info.CleaningUtility());
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, decodingFromYamlScalarShouldThrow) {
|
||||
TEST_P(PluginCleaningDataTest, decodingFromYamlScalarShouldThrow) {
|
||||
YAML::Node node = YAML::Load("scalar");
|
||||
|
||||
EXPECT_ANY_THROW(node.as<PluginDirtyInfo>());
|
||||
EXPECT_ANY_THROW(node.as<PluginCleaningData>());
|
||||
}
|
||||
|
||||
TEST_P(PluginDirtyInfoTest, decodingFromYamlListShouldThrow) {
|
||||
TEST_P(PluginCleaningDataTest, decodingFromYamlListShouldThrow) {
|
||||
YAML::Node node = YAML::Load("[0, 1, 2]");
|
||||
|
||||
EXPECT_ANY_THROW(node.as<PluginDirtyInfo>());
|
||||
EXPECT_ANY_THROW(node.as<PluginCleaningData>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,14 +257,14 @@ TEST_P(PluginMetadataTest, mergeMetadataShouldMergeTags) {
|
||||
TEST_P(PluginMetadataTest, mergeMetadataShouldMergeDirtyInfoData) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
PluginDirtyInfo info1(0x5, 1, 2, 3, "utility");
|
||||
PluginDirtyInfo info2(0xA, 1, 2, 3, "utility");
|
||||
PluginCleaningData info1(0x5, 1, 2, 3, "utility");
|
||||
PluginCleaningData info2(0xA, 1, 2, 3, "utility");
|
||||
|
||||
plugin1.DirtyInfo({info1});
|
||||
plugin2.DirtyInfo({info1, info2});
|
||||
plugin1.MergeMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(std::set<PluginDirtyInfo>({info1, info2}), plugin1.DirtyInfo());
|
||||
EXPECT_EQ(std::set<PluginCleaningData>({info1, info2}), plugin1.DirtyInfo());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, mergeMetadataShouldMergeLocationData) {
|
||||
@@ -412,15 +412,15 @@ TEST_P(PluginMetadataTest, diffMetadataShouldOutputTagsThatAreNotCommonToBothInp
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputDirtyInfoObjectsThatAreNotCommonToBothInputPlugins) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
PluginDirtyInfo info1(0x5, 1, 2, 3, "utility");
|
||||
PluginDirtyInfo info2(0xA, 1, 2, 3, "utility");
|
||||
PluginDirtyInfo info3(0x1, 1, 2, 3, "utility");
|
||||
PluginCleaningData info1(0x5, 1, 2, 3, "utility");
|
||||
PluginCleaningData info2(0xA, 1, 2, 3, "utility");
|
||||
PluginCleaningData info3(0x1, 1, 2, 3, "utility");
|
||||
|
||||
plugin1.DirtyInfo({info1, info2});
|
||||
plugin2.DirtyInfo({info1, info3});
|
||||
PluginMetadata diff = plugin1.DiffMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(std::set<PluginDirtyInfo>({info2, info3}), diff.DirtyInfo());
|
||||
EXPECT_EQ(std::set<PluginCleaningData>({info2, info3}), diff.DirtyInfo());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, diffMetadataShouldOutputLocationsThatAreNotCommonToBothInputPlugins) {
|
||||
@@ -547,15 +547,15 @@ TEST_P(PluginMetadataTest, newMetadataShouldOutputTagsThatAreNotCommonToBothInpu
|
||||
TEST_P(PluginMetadataTest, newMetadataShouldOutputDirtyInfoObjectsThatAreNotCommonToBothInputPlugins) {
|
||||
PluginMetadata plugin1;
|
||||
PluginMetadata plugin2;
|
||||
PluginDirtyInfo info1(0x5, 1, 2, 3, "utility");
|
||||
PluginDirtyInfo info2(0xA, 1, 2, 3, "utility");
|
||||
PluginDirtyInfo info3(0x1, 1, 2, 3, "utility");
|
||||
PluginCleaningData info1(0x5, 1, 2, 3, "utility");
|
||||
PluginCleaningData info2(0xA, 1, 2, 3, "utility");
|
||||
PluginCleaningData info3(0x1, 1, 2, 3, "utility");
|
||||
|
||||
plugin1.DirtyInfo({info1, info2});
|
||||
plugin2.DirtyInfo({info1, info3});
|
||||
PluginMetadata newMetadata = plugin1.NewMetadata(plugin2);
|
||||
|
||||
EXPECT_EQ(std::set<PluginDirtyInfo>({info2}), newMetadata.DirtyInfo());
|
||||
EXPECT_EQ(std::set<PluginCleaningData>({info2}), newMetadata.DirtyInfo());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, newMetadataShouldOutputLocationsThatAreNotCommonToBothInputPlugins) {
|
||||
@@ -634,8 +634,8 @@ TEST_P(PluginMetadataTest, evalAllConditionsShouldEvaluateAllMetadataConditions)
|
||||
Tag tag2("Relev", true, "file(\"" + missingEsp + "\")");
|
||||
plugin.Tags({tag1, tag2});
|
||||
|
||||
PluginDirtyInfo info1(blankEsmCrc, 1, 2, 3, "utility");
|
||||
PluginDirtyInfo info2(0xDEADBEEF, 1, 2, 3, "utility");
|
||||
PluginCleaningData info1(blankEsmCrc, 1, 2, 3, "utility");
|
||||
PluginCleaningData info2(0xDEADBEEF, 1, 2, 3, "utility");
|
||||
plugin.DirtyInfo({info1, info2});
|
||||
|
||||
EXPECT_NO_THROW(plugin.EvalAllConditions(game, Language::Code::english));
|
||||
@@ -646,7 +646,7 @@ TEST_P(PluginMetadataTest, evalAllConditionsShouldEvaluateAllMetadataConditions)
|
||||
EXPECT_EQ(expectedFiles, plugin.Incs());
|
||||
EXPECT_EQ(std::list<Message>({message1}), plugin.Messages());
|
||||
EXPECT_EQ(std::set<Tag>({tag1}), plugin.Tags());
|
||||
EXPECT_EQ(std::set<PluginDirtyInfo>({info1}), plugin.DirtyInfo());
|
||||
EXPECT_EQ(std::set<PluginCleaningData>({info1}), plugin.DirtyInfo());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, hasNameOnlyShouldBeTrueForADefaultConstructedPluginMetadataObject) {
|
||||
@@ -712,7 +712,7 @@ TEST_P(PluginMetadataTest, hasNameOnlyShouldBeFalseIfTagsExist) {
|
||||
|
||||
TEST_P(PluginMetadataTest, hasNameOnlyShouldBeFalseIfDirtyInfoExists) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
plugin.DirtyInfo({PluginDirtyInfo(5, 0, 1, 2, "utility")});
|
||||
plugin.DirtyInfo({PluginCleaningData(5, 0, 1, 2, "utility")});
|
||||
|
||||
EXPECT_FALSE(plugin.HasNameOnly());
|
||||
}
|
||||
@@ -861,7 +861,7 @@ TEST_P(PluginMetadataTest, emittingAsYamlShouldOutputAPluginWithTagsCorrectly) {
|
||||
|
||||
TEST_P(PluginMetadataTest, emittingAsYamlShouldOutputAPluginWithDirtyInfoCorrectly) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
plugin.DirtyInfo({PluginDirtyInfo(5, 0, 1, 2, "utility")});
|
||||
plugin.DirtyInfo({PluginCleaningData(5, 0, 1, 2, "utility")});
|
||||
|
||||
YAML::Emitter emitter;
|
||||
emitter << plugin;
|
||||
@@ -968,11 +968,11 @@ TEST_P(PluginMetadataTest, encodingAsYamlShouldSetTagFieldIfTagsExist) {
|
||||
|
||||
TEST_P(PluginMetadataTest, encodingAsYamlShouldSetDirtyFieldIfDirtyInfoExists) {
|
||||
PluginMetadata plugin(blankEsp);
|
||||
plugin.DirtyInfo({PluginDirtyInfo(5, 0, 1, 2, "utility")});
|
||||
plugin.DirtyInfo({PluginCleaningData(5, 0, 1, 2, "utility")});
|
||||
YAML::Node node;
|
||||
node = plugin;
|
||||
|
||||
EXPECT_EQ(plugin.DirtyInfo(), node["dirty"].as<std::set<PluginDirtyInfo>>());
|
||||
EXPECT_EQ(plugin.DirtyInfo(), node["dirty"].as<std::set<PluginCleaningData>>());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, encodingAsYamlShouldSetUrlFieldIfLocationsExist) {
|
||||
@@ -1038,8 +1038,8 @@ TEST_P(PluginMetadataTest, decodingFromYamlShouldStoreAllGivenData) {
|
||||
EXPECT_EQ(std::set<Tag>({
|
||||
Tag("Relev")
|
||||
}), plugin.Tags());
|
||||
EXPECT_EQ(std::set<PluginDirtyInfo>({
|
||||
PluginDirtyInfo(5, 0, 1, 2, "utility")
|
||||
EXPECT_EQ(std::set<PluginCleaningData>({
|
||||
PluginCleaningData(5, 0, 1, 2, "utility")
|
||||
}), plugin.DirtyInfo());
|
||||
EXPECT_EQ(std::set<Location>({
|
||||
Location("http://www.example.com")
|
||||
|
||||
@@ -302,14 +302,14 @@ TEST_P(PluginTest, checkInstallValidityShouldCheckThatIncompatibilitiesAreAbsent
|
||||
TEST_P(PluginTest, checkInstallValidityShouldGenerateMessagesFromDirtyInfo) {
|
||||
Plugin plugin(game_, blankEsm, false);
|
||||
plugin.DirtyInfo({
|
||||
PluginDirtyInfo(blankEsmCrc, 0, 1, 2, "utility1"),
|
||||
PluginDirtyInfo(0xDEADBEEF, 0, 5, 10, "utility2"),
|
||||
PluginCleaningData(blankEsmCrc, 0, 1, 2, "utility1"),
|
||||
PluginCleaningData(0xDEADBEEF, 0, 5, 10, "utility2"),
|
||||
});
|
||||
|
||||
EXPECT_TRUE(plugin.CheckInstallValidity(game_));
|
||||
EXPECT_EQ(std::list<Message>({
|
||||
PluginDirtyInfo(blankEsmCrc, 0, 1, 2, "utility1").AsMessage(),
|
||||
PluginDirtyInfo(0xDEADBEEF, 0, 5, 10, "utility2").AsMessage(),
|
||||
PluginCleaningData(blankEsmCrc, 0, 1, 2, "utility1").AsMessage(),
|
||||
PluginCleaningData(0xDEADBEEF, 0, 5, 10, "utility2").AsMessage(),
|
||||
}), plugin.Messages());
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ along with LOOT. If not, see
|
||||
#include "backend/metadata/location.h"
|
||||
#include "backend/metadata/message.h"
|
||||
#include "backend/metadata/message_content.h"
|
||||
#include "backend/metadata/plugin_dirty_info.h"
|
||||
#include "backend/metadata/plugin_cleaning_data.h"
|
||||
#include "backend/metadata/plugin_metadata.h"
|
||||
#include "backend/metadata/tag.h"
|
||||
#include "backend/plugin/plugin.h"
|
||||
@@ -74,8 +74,8 @@ void PrintTo(const MessageContent& value, ::std::ostream* os) {
|
||||
<< ")";
|
||||
}
|
||||
|
||||
void PrintTo(const PluginDirtyInfo& value, ::std::ostream* os) {
|
||||
*os << "PluginDirtyInfo(0x"
|
||||
void PrintTo(const PluginCleaningData& value, ::std::ostream* os) {
|
||||
*os << "PluginCleaningData(0x"
|
||||
<< std::hex << std::uppercase
|
||||
<< value.CRC()
|
||||
<< std::nouppercase << std::dec << ", "
|
||||
|
||||
Reference in New Issue
Block a user