mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-28 19:21:04 +00:00
Tests: add record overwrite test
(cherry picked from commit f91aae2350a1c6ce188b4f53b5714eb7a288306d)
This commit is contained in:
parent
d3ada38f01
commit
0d9ffe8119
@ -196,7 +196,7 @@ TEST_F(ContentFileTest, content_diagnostics_test)
|
|||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
/// Print results of autocalculated NPC spell lists. Also serves as test for attribute/skill autocalculation which the spell autocalculation heavily relies on
|
/// Print results of autocalculated NPC spell lists. Also serves as test for attribute/skill autocalculation which the spell autocalculation heavily relies on
|
||||||
/// - even rounding errors can completely change the resulting spell lists.
|
/// - even incorrect rounding modes can completely change the resulting spell lists.
|
||||||
/*
|
/*
|
||||||
TEST_F(ContentFileTest, autocalc_test)
|
TEST_F(ContentFileTest, autocalc_test)
|
||||||
{
|
{
|
||||||
@ -282,5 +282,38 @@ TEST_F(StoreTest, delete_test)
|
|||||||
/// Tests overwriting of records.
|
/// Tests overwriting of records.
|
||||||
TEST_F(StoreTest, overwrite_test)
|
TEST_F(StoreTest, overwrite_test)
|
||||||
{
|
{
|
||||||
|
const std::string recordId = "foobar";
|
||||||
|
const std::string recordIdUpper = "Foobar";
|
||||||
|
|
||||||
|
typedef ESM::Apparatus RecordType;
|
||||||
|
|
||||||
|
RecordType record;
|
||||||
|
record.blank();
|
||||||
|
record.mId = recordId;
|
||||||
|
|
||||||
|
ESM::ESMReader reader;
|
||||||
|
std::vector<ESM::ESMReader> readerList;
|
||||||
|
readerList.push_back(reader);
|
||||||
|
reader.setGlobalReaderList(&readerList);
|
||||||
|
|
||||||
|
// master file inserts a record
|
||||||
|
Files::IStreamPtr file = getEsmFile(record, false);
|
||||||
|
reader.open(file, "filename");
|
||||||
|
mEsmStore.load(reader, &dummyListener);
|
||||||
|
mEsmStore.setUp();
|
||||||
|
|
||||||
|
// now a plugin overwrites it with changed data
|
||||||
|
record.mId = recordIdUpper; // change id to uppercase, to test case smashing while we're at it
|
||||||
|
record.mModel = "the_new_model";
|
||||||
|
file = getEsmFile(record, false);
|
||||||
|
reader.open(file, "filename");
|
||||||
|
mEsmStore.load(reader, &dummyListener);
|
||||||
|
mEsmStore.setUp();
|
||||||
|
|
||||||
|
// verify that changes were actually applied
|
||||||
|
const RecordType* overwrittenRec = mEsmStore.get<RecordType>().search(recordId);
|
||||||
|
|
||||||
|
ASSERT_TRUE (overwrittenRec != NULL);
|
||||||
|
|
||||||
|
ASSERT_TRUE (overwrittenRec && overwrittenRec->mModel == "the_new_model");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user