Skip to content

Commit

Permalink
Tests: Fix WML tests.
Browse files Browse the repository at this point in the history
Display no longer tries to draw or make buttons when it doesn't have
a screen, and the request for an empty theme name is treated as a
request for the default theme.
  • Loading branch information
mesilliac committed Jun 9, 2022
1 parent 9ffef27 commit d338baa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,10 @@ const std::string& get_direction(std::size_t n)

void display::create_buttons()
{
if(screen_.faked()) {
return;
}

menu_buttons_.clear();
action_buttons_.clear();

Expand Down Expand Up @@ -2054,7 +2058,7 @@ bool display::tile_nearly_on_screen(const map_location& loc) const
void display::scroll_to_xy(int screenxpos, int screenypos, SCROLL_TYPE scroll_type, bool force)
{
if(!force && (view_locked_ || !preferences::scroll_to_action())) return;
if(screen_.update_locked()) {
if(screen_.update_locked() || screen_.faked()) {
return;
}
const SDL_Rect area = map_area();
Expand Down Expand Up @@ -2414,7 +2418,7 @@ void display::draw(bool update, bool force)
{
// log_scope("display::draw");

if(screen_.update_locked()) {
if(screen_.update_locked() || screen_.faked()) {
return;
}

Expand Down
5 changes: 4 additions & 1 deletion src/theme.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,10 @@ const config& theme::get_theme_config(const std::string& id)
return iter->second;
}

ERR_DP << "Theme '" << id << "' not found. Falling back to default theme." << std::endl;
if (!id.empty()) { // (treat empty id as request for default theme)
ERR_DP << "Theme '" << id << "' not found."
<< " Falling back to default theme." << std::endl;
}

iter = known_themes.find("Default");
if(iter != known_themes.end()) {
Expand Down

0 comments on commit d338baa

Please sign in to comment.