Skip to content

Commit

Permalink
Merge pull request #12 from andrei8l/fog
Browse files Browse the repository at this point in the history
tests: override weather in tests that need clear vision
  • Loading branch information
GuardianDll authored Apr 14, 2023
2 parents 66f5e07 + b2beeac commit de56ff4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tests/bionics_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "item_pocket.h"
#include "map_helpers.h"
#include "npc.h"
#include "options_helpers.h"
#include "pimpl.h"
#include "player_helpers.h"
#include "ret_val.h"
Expand Down Expand Up @@ -537,6 +538,7 @@ TEST_CASE( "fueled bionics", "[bionics] [item]" )
// Midday for solar test
clear_map();
g->reset_light_level();
scoped_weather_override weather_clear( WEATHER_CLEAR );
calendar::turn = calendar::turn_zero + 12_hours;
REQUIRE( g->is_in_sunlight( dummy.pos() ) );

Expand Down
4 changes: 4 additions & 0 deletions tests/char_sight_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "lightmap.h"
#include "map.h"
#include "map_helpers.h"
#include "options_helpers.h"
#include "player_helpers.h"
#include "type_id.h"

Expand Down Expand Up @@ -55,6 +56,7 @@ TEST_CASE( "light and fine_detail_vision_mod", "[character][sight][light][vision
clear_avatar();
clear_map();
g->reset_light_level();
scoped_weather_override weather_clear( WEATHER_CLEAR );

SECTION( "full daylight" ) {
// Set clock to noon
Expand Down Expand Up @@ -117,6 +119,7 @@ TEST_CASE( "character sight limits", "[character][sight][vision]" )
clear_avatar();
clear_map();
g->reset_light_level();
scoped_weather_override weather_clear( WEATHER_CLEAR );

GIVEN( "it is midnight with a new moon" ) {
calendar::turn = calendar::turn_zero;
Expand Down Expand Up @@ -212,6 +215,7 @@ TEST_CASE( "ursine vision", "[character][ursine][vision]" )
clear_avatar();
clear_map();
g->reset_light_level();
scoped_weather_override weather_clear( WEATHER_CLEAR );

float light_here = 0.0f;

Expand Down
2 changes: 2 additions & 0 deletions tests/vision_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "map_test_case.h"
#include "mapdata.h"
#include "mtype.h"
#include "options_helpers.h"
#include "point.h"
#include "type_id.h"
#include "units.h"
Expand Down Expand Up @@ -148,6 +149,7 @@ struct vision_test_case {
const time_point &time ) : setup( setup ), expected_results( expectedResults ), time( time ) {}

void test_all() const {
scoped_weather_override weather_clear( WEATHER_CLEAR );
Character &player_character = get_player_character();
g->place_player( tripoint( 60, 60, 0 ) );
player_character.worn.clear(); // Remove any light-emitting clothing
Expand Down

0 comments on commit de56ff4

Please sign in to comment.