diff --git a/tests/reloading_test.cpp b/tests/reloading_test.cpp index 6dd22f8d0e846..b01e759d4a113 100644 --- a/tests/reloading_test.cpp +++ b/tests/reloading_test.cpp @@ -28,6 +28,7 @@ static const flag_id json_flag_SPEEDLOADER( "SPEEDLOADER" ); static const itype_id itype_glock_19( "glock_19" ); static const itype_id itype_glockbigmag( "glockbigmag" ); static const itype_id itype_glockmag( "glockmag" ); +static const itype_id itype_water_clean( "water_clean" ); static void test_reloading( item &target, item &ammo, bool expect_success = true ) { @@ -338,26 +339,26 @@ TEST_CASE( "liquid_reloading", "[reload]" ) SECTION( "with water" ) { item liquid_container( "bottle_plastic" ); - liquid_container.put_in( item( "water_clean" ), pocket_type::CONTAINER ); + liquid_container.put_in( item( itype_water_clean ), pocket_type::CONTAINER ); test_reloading( container, liquid_container ); } SECTION( "with lots of water" ) { item liquid_container( "bottle_twoliter" ); - liquid_container.put_in( item( "water_clean", calendar::turn, 8 ), + liquid_container.put_in( item( itype_water_clean, calendar::turn, 8 ), pocket_type::CONTAINER ); test_reloading( container, liquid_container ); } SECTION( "with frozen water" ) { - item liquid( "water_clean" ); + item liquid( itype_water_clean ); liquid.set_item_temperature( units::from_kelvin( 200 ) ); REQUIRE( liquid.is_frozen_liquid() ); test_reloading( container, liquid, false ); } SECTION( "with frozen water from container" ) { - item liquid( "water_clean" ); + item liquid( itype_water_clean ); liquid.set_item_temperature( units::from_kelvin( 200 ) ); REQUIRE( liquid.is_frozen_liquid() ); @@ -383,32 +384,32 @@ TEST_CASE( "liquid_reloading", "[reload]" ) SECTION( "partially empty bottle" ) { item container( "bottle_twoliter" ); - container.put_in( item( "water_clean", calendar::turn, 1 ), pocket_type::CONTAINER ); + container.put_in( item( itype_water_clean, calendar::turn, 1 ), pocket_type::CONTAINER ); REQUIRE( !container.is_container_empty() ); REQUIRE( !container.is_container_full() ); SECTION( "with one water" ) { item liquid_container( "bottle_plastic" ); - liquid_container.put_in( item( "water_clean" ), pocket_type::CONTAINER ); + liquid_container.put_in( item( itype_water_clean ), pocket_type::CONTAINER ); test_reloading( container, liquid_container ); } SECTION( "with lots of water" ) { item liquid_container( "bottle_twoliter" ); - liquid_container.put_in( item( "water_clean", calendar::turn, 8 ), + liquid_container.put_in( item( itype_water_clean, calendar::turn, 8 ), pocket_type::CONTAINER ); test_reloading( container, liquid_container ); } SECTION( "with frozen water" ) { - item liquid( "water_clean" ); + item liquid( itype_water_clean ); liquid.set_item_temperature( units::from_kelvin( 200 ) ); REQUIRE( liquid.is_frozen_liquid() ); test_reloading( container, liquid, false ); } SECTION( "with frozen water from container" ) { - item liquid( "water_clean" ); + item liquid( itype_water_clean ); liquid.set_item_temperature( units::from_kelvin( 200 ) ); REQUIRE( liquid.is_frozen_liquid() ); @@ -432,31 +433,31 @@ TEST_CASE( "liquid_reloading", "[reload]" ) SECTION( "full bottle" ) { item container( "bottle_plastic" ); - container.put_in( item( "water_clean", calendar::turn, 2 ), pocket_type::CONTAINER ); + container.put_in( item( itype_water_clean, calendar::turn, 2 ), pocket_type::CONTAINER ); REQUIRE( container.is_container_full() ); SECTION( "with one water" ) { item liquid_container( "bottle_plastic_small" ); - liquid_container.put_in( item( "water_clean" ), pocket_type::CONTAINER ); + liquid_container.put_in( item( itype_water_clean ), pocket_type::CONTAINER ); test_reloading( container, liquid_container, false ); } SECTION( "with lots of water" ) { item liquid_container( "bottle_twoliter" ); - liquid_container.put_in( item( "water_clean", calendar::turn, 8 ), + liquid_container.put_in( item( itype_water_clean, calendar::turn, 8 ), pocket_type::CONTAINER ); test_reloading( container, liquid_container, false ); } SECTION( "with frozen water" ) { - item liquid( "water_clean" ); + item liquid( itype_water_clean ); liquid.set_item_temperature( units::from_kelvin( 200 ) ); REQUIRE( liquid.is_frozen_liquid() ); test_reloading( container, liquid, false ); } SECTION( "with frozen water from container" ) { - item liquid( "water_clean" ); + item liquid( itype_water_clean ); liquid.set_item_temperature( units::from_kelvin( 200 ) ); REQUIRE( liquid.is_frozen_liquid() ); @@ -1064,7 +1065,7 @@ TEST_CASE( "reload_liquid_container", "[reload],[liquid]" ) REQUIRE( dummy.wield( canteen ) ) ; item_location ammo_jug = dummy.i_add( item( "jug_plastic" ) ); - ammo_jug->put_in( item( "water_clean", calendar::turn_zero, 2 ), + ammo_jug->put_in( item( itype_water_clean, calendar::turn_zero, 2 ), pocket_type::CONTAINER ); units::volume ammo_volume = ammo_jug->total_contained_volume(); @@ -1077,7 +1078,7 @@ TEST_CASE( "reload_liquid_container", "[reload],[liquid]" ) } SECTION( "reload liquid into partially filled container with same type liquid" ) { - item water_one( "water_clean", calendar::turn_zero, 1 ); + item water_one( itype_water_clean, calendar::turn_zero, 1 ); units::volume initial_volume = water_one.volume(); dummy.get_wielded_item()->put_in( water_one, pocket_type::CONTAINER ); g->reload_wielded(); @@ -1112,7 +1113,7 @@ TEST_CASE( "reload_liquid_container", "[reload],[liquid]" ) } SECTION( "reload liquid container with more liquid than it can hold" ) { - ammo_jug->fill_with( item( "water_clean", calendar::turn_zero, 1 ) ); + ammo_jug->fill_with( item( itype_water_clean, calendar::turn_zero, 1 ) ); ammo_volume = ammo_jug->total_contained_volume(); g->reload_wielded(); REQUIRE( dummy.activity ); @@ -1133,7 +1134,7 @@ TEST_CASE( "reload_liquid_container", "[reload],[liquid]" ) ammo_jug.remove_item(); ammo_jug = item_location( map_cursor( near_point ), &here.add_item( near_point, item( "bottle_plastic" ) ) ); - ammo_jug->fill_with( item( "water_clean" ) ); + ammo_jug->fill_with( item( itype_water_clean ) ); ammo_volume = ammo_jug->total_contained_volume(); g->reload_wielded(); REQUIRE( dummy.activity ); @@ -1143,12 +1144,14 @@ TEST_CASE( "reload_liquid_container", "[reload],[liquid]" ) } SECTION( "liquid spill on floor" ) { + REQUIRE_FALSE( here.has_flag_ter_or_furn( "LIQUIDCONT", near_point ) ); REQUIRE( ammo_jug->spill_contents( near_point ) ); + REQUIRE( ammo_jug->total_contained_volume() == units::volume() ); + REQUIRE_FALSE( dummy.has_charges( itype_water_clean, 1 ) ); g->reload_wielded(); if( !!dummy.activity ) { process_activity( dummy ); } - CHECK( ammo_jug->total_contained_volume() == units::volume() ); CHECK( dummy.get_wielded_item()->total_contained_volume() == units::volume() ); } }