Fix unit test crashing when loading from GFX.
This commit is contained in:
@@ -42,6 +42,8 @@ All rights reserved.
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
using namespace olc::utils;
|
||||
|
||||
INCLUDE_GFX
|
||||
|
||||
namespace PlayerTests
|
||||
{
|
||||
TEST_CLASS(PlayerTest)
|
||||
@@ -61,6 +63,7 @@ namespace PlayerTests
|
||||
sig::Animation::InitializeAnimations();
|
||||
testGame->InitializeDefaultKeybinds();
|
||||
testGame->InitializePlayer();
|
||||
sig::Animation::SetupPlayerAnimations();
|
||||
Menu::InitializeMenus();
|
||||
Tutorial::Initialize();
|
||||
Stats::InitializeDamageReductionTable();
|
||||
@@ -69,6 +72,8 @@ namespace PlayerTests
|
||||
testKeyboardInput.AddKeybind(Input{InputType::KEY,0});
|
||||
testKey=&testGame->pKeyboardState[0];
|
||||
testGame->olc_UpdateKeyFocus(true); //Force the game to be "focused" for tests. Required if we want keyboard inputs to work.
|
||||
Menu::themes.SetInitialized();
|
||||
GFX.SetInitialized();
|
||||
}
|
||||
|
||||
TEST_METHOD(PlayerAlive){
|
||||
@@ -130,5 +135,13 @@ namespace PlayerTests
|
||||
player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput);
|
||||
Assert::AreEqual(player->GetMaxMana(),player->GetMana());
|
||||
}
|
||||
TEST_METHOD(RangerCastDoesNotConsumeManaImmediately){
|
||||
testGame->ChangePlayerClass(RANGER);
|
||||
player=testGame->GetPlayer(); //The player pointer has been reassigned...
|
||||
//Ability 2 is Charged Shot, which is a cast. Mana should not be consumed for a spell that begins as a cast.
|
||||
testKey->bHeld=true; //Force the key to be held down for testing purposes.
|
||||
player->CheckAndPerformAbility(player->GetAbility2(),testKeyboardInput);
|
||||
Assert::AreEqual(player->GetMaxMana(),player->GetMana());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user