Skip to content

Commit 56c46e5

Browse files
committed
feat: expose Brick noun in editor
1 parent ace3904 commit 56c46e5

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

Extensions/BabaEditor/LevelEditor.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ const std::vector<ObjectEntry>& ObjectCatalog()
155155
{ ObjectType::ICON_EMPTY, "EMPTY", "Special", ColorU8(18, 22, 32) },
156156
{ ObjectType::ALGAE, "ALGAE", "Text: Nouns", ColorU8(238, 238, 238) },
157157
{ ObjectType::BABA, "BABA", "Text: Nouns", ColorU8(238, 238, 238) },
158+
{ ObjectType::BRICK, "BRICK", "Text: Nouns", ColorU8(238, 238, 238) },
158159
{ ObjectType::CRAB, "CRAB", "Text: Nouns", ColorU8(238, 238, 238) },
159160
{ ObjectType::FLAG, "FLAG", "Text: Nouns", ColorU8(238, 238, 238) },
160161
{ ObjectType::GRASS, "GRASS", "Text: Nouns", ColorU8(238, 238, 238) },

Tests/UnitTests/EditorTests.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,44 @@ TEST_CASE("Editor - Pillar Yard round trip and sprite assets")
221221
}
222222
}
223223

224+
TEST_CASE("Editor - Brick Wall round trip and sprite assets")
225+
{
226+
namespace fs = std::filesystem;
227+
228+
LevelFile brickWall;
229+
REQUIRE(LoadLevelFile(MAPS_DIR "brick_wall.txt", brickWall));
230+
CHECK(brickWall.width == 15);
231+
CHECK(brickWall.height == 8);
232+
CHECK(brickWall.tiles[4 * brickWall.width + 10][0] ==
233+
ObjectType::ICON_BRICK);
234+
CHECK(brickWall.tiles[4 * brickWall.width + 11][0] ==
235+
ObjectType::ICON_FLAG);
236+
CHECK(brickWall.tiles[4 * brickWall.width + 11][1] ==
237+
ObjectType::ICON_EMPTY);
238+
239+
const fs::path path =
240+
fs::current_path() / "baba-is-auto-brick-wall-round-trip.txt";
241+
std::error_code error;
242+
CHECK(SaveLevelFile(path, brickWall));
243+
244+
LevelFile loaded;
245+
REQUIRE(LoadLevelFile(path, loaded));
246+
CHECK(loaded.tiles == brickWall.tiles);
247+
CHECK(loaded.directions == brickWall.directions);
248+
249+
fs::remove(path, error);
250+
251+
const fs::path root = (fs::path(MAPS_DIR) / "../..").lexically_normal();
252+
253+
for (const char* asset : {
254+
"Extensions/BabaGUI/sprites/text/BRICK.gif",
255+
"Extensions/BabaGUI/sprites/icon/BRICK.gif",
256+
})
257+
{
258+
CHECK(fs::is_regular_file(root / asset));
259+
}
260+
}
261+
224262
TEST_CASE("Editor - Layer tile direction updates")
225263
{
226264
LevelFile::LayerTile tiles{ ObjectType::ICON_EMPTY, ObjectType::ICON_EMPTY,

0 commit comments

Comments
 (0)