Add a test for three way merges

revert-6246b479
Evil Eye 1 year ago
parent 4eac137109
commit 974b4739fa

@ -833,4 +833,30 @@ namespace
EXPECT_THAT(dialogue->mInfo, ElementsAre(HasIdEqualTo("info0"), HasIdEqualTo("info2"), HasIdEqualTo("info1")));
EXPECT_EQ(std::next(dialogue->mInfo.begin())->mActor, "newActor");
}
TEST(MWWorldStoreTest, shouldPreservePositionWhenPrevIsTheSame)
{
const DialogueData data = generateDialogueWithInfos(3);
MWWorld::ESMStore esmStore;
loadEsmStore(0, saveDialogueWithInfos(data.mDialogue, data.mInfos), esmStore);
ESM::DialInfo newInfo = data.mInfos[0];
newInfo.mPrev = data.mInfos[2].mId;
newInfo.mNext = {};
loadEsmStore(1, saveDialogueWithInfos(data.mDialogue, std::array{ newInfo }), esmStore);
newInfo = data.mInfos[1];
newInfo.mResponse = "test";
loadEsmStore(2, saveDialogueWithInfos(data.mDialogue, std::array{ newInfo }), esmStore);
esmStore.setUp();
const ESM::Dialogue* dialogue = esmStore.get<ESM::Dialogue>().search(ESM::RefId::stringRefId("dialogue"));
ASSERT_NE(dialogue, nullptr);
EXPECT_THAT(dialogue->mInfo, ElementsAre(HasIdEqualTo("info1"), HasIdEqualTo("info2"), HasIdEqualTo("info0")));
EXPECT_EQ(dialogue->mInfo.begin()->mResponse, "test");
}
}

Loading…
Cancel
Save