yaze 0.2.0
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
overworld_test.cc
Go to the documentation of this file.
2
3#include <gmock/gmock.h>
4#include <gtest/gtest.h>
5
6#include "app/rom.h"
9#include "test/core/testing.h"
10
11namespace yaze {
12namespace test {
13namespace zelda3 {
14
15class OverworldTest : public ::testing::Test, public app::SharedRom {
16 protected:
17 void SetUp() override {
18 // Skip tests on Linux for automated github builds
19#if defined(__linux__)
20 GTEST_SKIP();
21#endif
22 }
23 void TearDown() override {}
24
26};
27
28TEST_F(OverworldTest, OverworldLoadNoRomDataError) {
29 // Arrange
30 app::Rom rom;
31
32 // Act
33 auto status = overworld_.Load(rom);
34
35 // Assert
36 EXPECT_FALSE(status.ok());
37 EXPECT_THAT(status.message(), testing::HasSubstr("ROM file not loaded"));
38}
39
40TEST_F(OverworldTest, OverworldLoadRomDataOk) {
41 // Arrange
42 EXPECT_OK(rom()->LoadFromFile("zelda3.sfc"));
43 EXPECT_OK(rom()->LoadAllGraphicsData(/*defer_render=*/true));
44
45 // Act
46 auto status = overworld_.Load(*rom());
47
48 // Assert
49 EXPECT_TRUE(status.ok());
50 EXPECT_EQ(overworld_.overworld_maps().size(),
52 EXPECT_EQ(overworld_.tiles16().size(),
54}
55
56} // namespace zelda3
57} // namespace test
58} // namespace yaze
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:136
A class to hold a shared pointer to a Rom object.
Definition rom.h:576
Represents the full Overworld data, light and dark world.
Definition overworld.h:461
app::zelda3::overworld::Overworld overworld_
constexpr int kNumTile16Individual
Definition overworld.h:447
constexpr int kNumOverworldMaps
Definition overworld.h:446
TEST_F(DungeonRoomTest, SingleRoomLoadOk)
Definition common.cc:22
#define EXPECT_OK(expr)
Definition testing.h:10