Update SavingTests.cpp

This commit is contained in:
David Markowitz 2024-06-04 22:02:07 -07:00
parent bd0cafa33f
commit 8685d0dbdc

View File

@ -2,6 +2,7 @@
#include "Character.h" #include "Character.h"
#include "Entity.h" #include "Entity.h"
#include "tinyxml2.h" #include "tinyxml2.h"
#include "BuffComponent.h"
class SavingTest : public GameDependenciesTest { class SavingTest : public GameDependenciesTest {
protected: protected:
@ -23,6 +24,7 @@ protected:
character->_setXmlData(printer.CStr()); character->_setXmlData(printer.CStr());
doc.Clear(); doc.Clear();
character->_doQuickXMLDataParse(); character->_doQuickXMLDataParse();
entity->AddComponent<BuffComponent>()->LoadFromXml(entity->GetCharacter()->GetXMLDoc());
} }
void TearDown() override { void TearDown() override {
@ -41,9 +43,9 @@ TEST_F(SavingTest, EntityLevelTest) {
doc.Print(&printer); doc.Print(&printer);
std::string xmlDataModified(printer.CStr()); std::string xmlDataModified(printer.CStr());
doc.Clear(); doc.Clear();
std::ofstream oldXml("./test_xml_data_original.xml"); // std::ofstream oldXml("./test_xml_data_original.xml");
std::ofstream newXml("./test_xml_data_new.xml"); // std::ofstream newXml("./test_xml_data_new.xml");
oldXml << xmlDataOriginal; // oldXml << xmlDataOriginal;
newXml << xmlDataModified; // newXml << xmlDataModified;
LOG("Component count: %i Same: %i", entity->GetComponents().size(), xmlDataOriginal == xmlDataModified); LOG("Component count: %i Same: %i", entity->GetComponents().size(), xmlDataOriginal == xmlDataModified);
} }