Fix tests broken by introduction of ghosted plugin

This commit is contained in:
Oliver Hamlet
2016-03-31 21:12:48 +01:00
parent f08103e5c1
commit 4e3d1b64a6
2 changed files with 14 additions and 12 deletions
+8 -9
View File
@@ -170,21 +170,20 @@ namespace loot {
// First set reverse timestamps to be sure.
time_t time = boost::filesystem::last_write_time(dataPath / masterFile);
for (size_t i = 1; i < loadOrder.size(); ++i) {
if (!boost::filesystem::exists(dataPath / loadOrder[i]))
loadOrder[i] += ".ghost";
boost::filesystem::last_write_time(dataPath / loadOrder[i], time - i * 60);
ASSERT_EQ(time - i * 60, boost::filesystem::last_write_time(dataPath / loadOrder[i]));
}
EXPECT_NO_THROW(game.RedatePlugins());
if (GetParam() == Game::tes5) {
for (size_t i = 0; i < loadOrder.size(); ++i) {
ASSERT_EQ(time + i * 60, boost::filesystem::last_write_time(dataPath / loadOrder[i]));
}
}
else {
for (size_t i = 0; i < loadOrder.size(); ++i) {
ASSERT_EQ(time - i * 60, boost::filesystem::last_write_time(dataPath / loadOrder[i]));
}
time_t interval = 60;
if (GetParam() != Game::tes5)
interval *= -1;
for (size_t i = 0; i < loadOrder.size(); ++i) {
EXPECT_EQ(time + i * interval, boost::filesystem::last_write_time(dataPath / loadOrder[i]));
}
}
+6 -3
View File
@@ -103,9 +103,12 @@ namespace loot {
if (isLoadOrderTimestampBased(GetParam())) {
std::map<time_t, std::string> loadOrder;
for (boost::filesystem::directory_iterator it(dataPath); it != boost::filesystem::directory_iterator(); ++it) {
if (boost::filesystem::is_regular_file(it->status()) &&
(boost::ends_with(it->path().filename().string(), ".esp") || boost::ends_with(it->path().filename().string(), ".esm"))) {
loadOrder.emplace(boost::filesystem::last_write_time(it->path()), it->path().filename().string());
if (boost::filesystem::is_regular_file(it->status())) {
std::string filename = it->path().filename().string();
if (boost::ends_with(filename, ".ghost"))
filename = it->path().stem().string();
if (boost::ends_with(filename, ".esp") || boost::ends_with(filename, ".esm"))
loadOrder.emplace(boost::filesystem::last_write_time(it->path()), filename);
}
}
for (const auto& plugin : loadOrder)