Skip to content

Commit

Permalink
Add test for reset fonts menu option
Browse files Browse the repository at this point in the history
  • Loading branch information
chreden committed May 8, 2024
1 parent c92a975 commit 845b22b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions trview.app.tests/ApplicationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,12 @@ namespace
this->plugins_window_manager = std::move(plugins_window_manager);
return *this;
}

test_module& with_fonts(std::shared_ptr<IFonts> fonts)
{
this->fonts = fonts;
return *this;
}
};
return test_module{};
}
Expand Down Expand Up @@ -613,6 +619,25 @@ TEST(Application, MapColoursSetOnSettingsChanged)
viewer.on_settings(UserSettings());
}

TEST(Application, ResetFonts)
{
auto fonts = mock_shared<MockFonts>();
EXPECT_CALL(*fonts, add_font(std::string("Console"),
testing::AllOf(testing::Field(&FontSetting::name, testing::Eq("Consolas")),
testing::Field(&FontSetting::filename, testing::Eq("consola.ttf")),
testing::Field(&FontSetting::size, testing::Eq(12)))));
EXPECT_CALL(*fonts, add_font(std::string("Default"),
testing::AllOf(testing::Field(&FontSetting::name, testing::Eq("Arial")),
testing::Field(&FontSetting::filename, testing::Eq("arial.ttf")),
testing::Field(&FontSetting::size, testing::Eq(12)))));

auto application = register_test_module()
.with_fonts(fonts)
.build();

application->process_message(WM_COMMAND, MAKEWPARAM(ID_WINDOWS_RESET_FONTS, 0), 0);
}

TEST(Application, ResetLayout)
{
auto imgui_backend = mock_shared<MockImGuiBackend>();
Expand Down

0 comments on commit 845b22b

Please sign in to comment.