mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-18 17:55:27 +00:00
fix: the zone keeps its paths after the merge, and the tests follow the merged readers
- Zone::LoadZoneIntoMemory takes the paths the zone file reader read (lost in the merge of the raw terrain loading) - the terrain reader is main's unchanged: files from before version 32 keep their colour and texture maps as the file has them, and the dashboard's terrain tests expect that (bounds by the span between the first and last point too) - the model component test counts the model block only: the item block in front of it is the ItemComponent's - scene file tests: a file from before chunks keeps only its header, editor settings are a count of colours, and the tests that log have a logger - the settings catalog lists export_terrain_to_obj Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -81,11 +81,11 @@ TEST(RawTerrainTests, ReadsEveryLayer) {
|
||||
EXPECT_EQ(chunk.GetSceneIDAtGrid(2, 2), 2);
|
||||
EXPECT_EQ(raw.chunks[1].GetSceneIDAtGrid(2, 0), 3);
|
||||
EXPECT_FLOAT_EQ(raw.minBoundsX, -4.0f);
|
||||
EXPECT_FLOAT_EQ(raw.maxBoundsX, 6.0f);
|
||||
EXPECT_FLOAT_EQ(raw.maxBoundsX, 4.0f); // the span between the first and last point
|
||||
}
|
||||
|
||||
// Before version 32: a shader ID, a width x width BGRA color map the client keeps (width - 1) x (width - 1) of as RGBA,
|
||||
// a BGRA texture map, no light or blend maps, a (width x width) scene map in version 31 and none (all scene 0) before
|
||||
// Before version 32: a shader ID, a width x width color map, a texture map, no light or blend maps, and a
|
||||
// (width x width) scene map that version 31 uses the first (width - 1) rows and columns of (all scene 0 before)
|
||||
TEST(RawTerrainTests, ReadsOlderVersions) {
|
||||
for (const uint16_t version : { 30, 31 }) {
|
||||
RawWriter w;
|
||||
@@ -98,17 +98,16 @@ TEST(RawTerrainTests, ReadsOlderVersions) {
|
||||
for (int i = 0; i < 9; i++) w.Put<uint8_t>(1).Put<uint8_t>(2).Put<uint8_t>(3).Put<uint8_t>(static_cast<uint8_t>(i)); // BGRA
|
||||
w.Put<uint32_t>(1).Put<uint8_t>(1).Put<uint8_t>(2).Put<uint8_t>(3).Put<uint8_t>(4);
|
||||
w.Put<uint32_t>(0); // no flairs
|
||||
if (version == 31) for (int i = 0; i < 9; i++) w.Put<uint8_t>(static_cast<uint8_t>(i));
|
||||
else w.Put<uint8_t>(0);
|
||||
for (int i = 0; i < 9; i++) w.Put<uint8_t>(static_cast<uint8_t>(i)); // read in every version, used in 31
|
||||
|
||||
Raw::Raw raw;
|
||||
ASSERT_TRUE(Read(w.data, raw)) << version;
|
||||
const auto& chunk = raw.chunks.at(0);
|
||||
EXPECT_EQ(chunk.shaderId, 7u);
|
||||
EXPECT_EQ(chunk.colorMapResolution, 2u);
|
||||
// Rows 0-1, columns 0-1 of the 3 x 3, as RGBA
|
||||
EXPECT_EQ(chunk.colorMap, (std::vector<uint8_t>{ 3, 2, 1, 0, 3, 2, 1, 1, 3, 2, 1, 3, 3, 2, 1, 4 }));
|
||||
EXPECT_EQ(chunk.textureMap, (std::vector<uint8_t>{ 3, 2, 1, 4 }));
|
||||
// The 3 x 3 pixels and the texture map as the file has them
|
||||
EXPECT_EQ(chunk.colorMap.size(), 3u * 3u * 4u);
|
||||
EXPECT_EQ(chunk.textureMap, (std::vector<uint8_t>{ 1, 2, 3, 4 }));
|
||||
if (version == 31) EXPECT_EQ(chunk.sceneMap, (std::vector<uint8_t>{ 0, 1, 3, 4 }));
|
||||
else EXPECT_EQ(chunk.sceneMap, (std::vector<uint8_t>(4, 0)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user