mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Add PluginMetadata::UnsetGroup()
The postcondition is that GetGroup returns nullopt.
This commit is contained in:
@@ -180,6 +180,11 @@ public:
|
||||
*/
|
||||
LOOT_API void SetGroup(const std::string& group);
|
||||
|
||||
/**
|
||||
* Unsets the plugin's group.
|
||||
*/
|
||||
LOOT_API void UnsetGroup();
|
||||
|
||||
/**
|
||||
* Set the files that the plugin must load after.
|
||||
* @param after
|
||||
|
||||
@@ -220,6 +220,10 @@ void PluginMetadata::SetGroup(const std::string& group) {
|
||||
group_ = group;
|
||||
}
|
||||
|
||||
void PluginMetadata::UnsetGroup() {
|
||||
group_ = std::nullopt;
|
||||
}
|
||||
|
||||
void PluginMetadata::SetLoadAfterFiles(const std::set<File>& l) {
|
||||
loadAfter_ = l;
|
||||
}
|
||||
|
||||
@@ -476,6 +476,17 @@ TEST_P(PluginMetadataTest, simpleMessagesShouldReturnMessagesAsSimpleMessages) {
|
||||
EXPECT_EQ("content3", simpleMessages.back().text);
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest, unsetGroupShouldLeaveNoGroupValueSet) {
|
||||
PluginMetadata plugin;
|
||||
EXPECT_FALSE(plugin.GetGroup().has_value());
|
||||
|
||||
plugin.SetGroup("test");
|
||||
EXPECT_EQ("test", plugin.GetGroup().value());
|
||||
|
||||
plugin.UnsetGroup();
|
||||
EXPECT_FALSE(plugin.GetGroup().has_value());
|
||||
}
|
||||
|
||||
TEST_P(PluginMetadataTest,
|
||||
hasNameOnlyShouldBeTrueForADefaultConstructedPluginMetadataObject) {
|
||||
PluginMetadata plugin;
|
||||
|
||||
Reference in New Issue
Block a user