Skip to content

Commit

Permalink
Fix and test OpenEnroth#1454
Browse files Browse the repository at this point in the history
  • Loading branch information
pskelton committed Dec 27, 2023
1 parent 3fe1862 commit 36308eb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/GUI/UI/Books/MapBook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, i
GraphicsImage *ui_book_map_background = nullptr;

GUIWindow_MapBook::GUIWindow_MapBook() {
this->eWindowType = WindowType::WINDOW_MapsBook;
viewparams->sViewCenterX = pParty->pos.x;
viewparams->sViewCenterY = pParty->pos.y;
pChildBooksOverlay = new GUIWindow_BooksButtonOverlay({546, 353}, {0, 0}, pBtn_Maps);
Expand Down
14 changes: 14 additions & 0 deletions test/Bin/GameTest/GameTests_1000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,3 +500,17 @@ GAME_TEST(Prs, Pr1440) {
for (int i = 24; i < 32; i++)
EXPECT_EQ(table.GetFrameTexture(0, Duration::fromTicks(i)), tex1) << i;
}

GAME_TEST(Issues, Issue1454) {
// Map hotkey doesn't close the map
game.startNewGame();
game.tick(1);
game.pressAndReleaseKey(PlatformKey::KEY_M);
game.tick(1);
EXPECT_EQ(current_screen_type, ScreenType::SCREEN_BOOKS);
EXPECT_EQ(pGUIWindow_CurrentMenu->eWindowType, WindowType::WINDOW_MapsBook);
game.pressAndReleaseKey(PlatformKey::KEY_M);
game.tick(1);
EXPECT_EQ(current_screen_type, ScreenType::SCREEN_GAME);
EXPECT_EQ(pGUIWindow_CurrentMenu, nullptr);
}

0 comments on commit 36308eb

Please sign in to comment.