Fix unit test crashing when loading from GFX.
This commit is contained in:
parent
afff03e201
commit
6cb67ccaa6
@ -42,6 +42,8 @@ All rights reserved.
|
|||||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||||
using namespace olc::utils;
|
using namespace olc::utils;
|
||||||
|
|
||||||
|
INCLUDE_GFX
|
||||||
|
|
||||||
namespace PlayerTests
|
namespace PlayerTests
|
||||||
{
|
{
|
||||||
TEST_CLASS(PlayerTest)
|
TEST_CLASS(PlayerTest)
|
||||||
@ -61,6 +63,7 @@ namespace PlayerTests
|
|||||||
sig::Animation::InitializeAnimations();
|
sig::Animation::InitializeAnimations();
|
||||||
testGame->InitializeDefaultKeybinds();
|
testGame->InitializeDefaultKeybinds();
|
||||||
testGame->InitializePlayer();
|
testGame->InitializePlayer();
|
||||||
|
sig::Animation::SetupPlayerAnimations();
|
||||||
Menu::InitializeMenus();
|
Menu::InitializeMenus();
|
||||||
Tutorial::Initialize();
|
Tutorial::Initialize();
|
||||||
Stats::InitializeDamageReductionTable();
|
Stats::InitializeDamageReductionTable();
|
||||||
@ -69,6 +72,8 @@ namespace PlayerTests
|
|||||||
testKeyboardInput.AddKeybind(Input{InputType::KEY,0});
|
testKeyboardInput.AddKeybind(Input{InputType::KEY,0});
|
||||||
testKey=&testGame->pKeyboardState[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.
|
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){
|
TEST_METHOD(PlayerAlive){
|
||||||
@ -130,5 +135,13 @@ namespace PlayerTests
|
|||||||
player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput);
|
player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput);
|
||||||
Assert::AreEqual(player->GetMaxMana(),player->GetMana());
|
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());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -45,12 +45,12 @@ INCLUDE_game
|
|||||||
|
|
||||||
Effect::Effect(vf2d pos,float lifetime,std::string imgFile,bool upperLevel,float size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
|
Effect::Effect(vf2d pos,float lifetime,std::string imgFile,bool upperLevel,float size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
|
||||||
:Effect::Effect(pos,lifetime,imgFile,upperLevel,vf2d{size,size},fadeout,spd,col,rotation,rotationSpd,additiveBlending){
|
:Effect::Effect(pos,lifetime,imgFile,upperLevel,vf2d{size,size},fadeout,spd,col,rotation,rotationSpd,additiveBlending){
|
||||||
this->animation.AddState(imgFile,ANIMATION_DATA[imgFile]);
|
this->animation.AddState(imgFile,ANIMATION_DATA.at(imgFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
Effect::Effect(vf2d pos,float lifetime,std::string imgFile,bool upperLevel,vf2d size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
|
Effect::Effect(vf2d pos,float lifetime,std::string imgFile,bool upperLevel,vf2d size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
|
||||||
:pos(pos),lifetime(lifetime),upperLevel(upperLevel),size(size),fadeout(fadeout),original_fadeoutTime(fadeout),spd(spd),col(col),rotation(rotation),rotationSpd(rotationSpd),additiveBlending(additiveBlending){
|
:pos(pos),lifetime(lifetime),upperLevel(upperLevel),size(size),fadeout(fadeout),original_fadeoutTime(fadeout),spd(spd),col(col),rotation(rotation),rotationSpd(rotationSpd),additiveBlending(additiveBlending){
|
||||||
this->animation.AddState(imgFile,ANIMATION_DATA[imgFile]);
|
this->animation.AddState(imgFile,ANIMATION_DATA.at(imgFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Effect::Update(float fElapsedTime){
|
bool Effect::Update(float fElapsedTime){
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 3
|
#define VERSION_PATCH 3
|
||||||
#define VERSION_BUILD 9837
|
#define VERSION_BUILD 9840
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user