Add test for when Steam is uninitialized

This commit is contained in:
Cocktail Frank 2025-04-01 15:14:41 -04:00
parent a7e802c50b
commit 1d24c85310

View File

@ -80,7 +80,7 @@ TEST_CASE("Run a game with command line parameters")
* test of how init runs at the launch of a program. */
sb::init();
INFO("Passing zero and null to init");
UNSCOPED_INFO("Passing zero and null to init");
CHECK_NOTHROW(sb::init(0, nullptr));
SECTION ("Passing a non-existent option")
@ -195,7 +195,7 @@ TEST_CASE("Run a game with command line parameters")
/* Restore original buffer to stop capturing std::cout */
std::cout.rdbuf(prevcoutbuf);
INFO("Running the main loop");
UNSCOPED_INFO("Running the main loop");
std::optional<float> start_seconds;
bool checked = false;
bool started = false;
@ -229,7 +229,7 @@ TEST_CASE("Run a game with command line parameters")
}
});
INFO("Running the main loop using a bound class member function");
UNSCOPED_INFO("Running the main loop using a bound class member function");
CHECK_NOTHROW(luigi_game.run(std::bind(&TestGame::draw, &luigi_game, std::placeholders::_1)));
CHECK(luigi_game.call_count == 10);
@ -238,7 +238,7 @@ TEST_CASE("Run a game with command line parameters")
std::this_thread::sleep_for(std::chrono::seconds(5));
#endif
INFO("Runnning the main loop with separate draw and update functions");
UNSCOPED_INFO("Runnning the main loop with separate draw and update functions");
start_seconds.reset();
int draw_count = 0;
int update_count = 0;
@ -807,7 +807,7 @@ TEST_CASE("Steam API connection")
FAIL("There must be a file named \"steam_appid.txt\" in the working directory to run this test.");
}
INFO("Checking sb::cloud::steam interface was set to initialized");
UNSCOPED_INFO("Checking sb::cloud::steam interface was set to initialized");
REQUIRE(sb::cloud::steam::initialized());
/* Run again for logging now that logging is initialized */
@ -949,6 +949,13 @@ TEST_CASE("Steam API connection")
luigi_game.quit();
sb::quit();
/* Make sure Steam is indicated as unavailable if the framework is initialized with Steam initialization
* force-skipped. */
sb::initialize_steam = false;
sb::init();
CHECK_FALSE(sb::cloud::steam::initialized());
sb::quit();
/* Set the log to stdout, so the next test can start with the default. */
sb::test::reset_log_function();
}