diff --git a/C++ProjectTemplate b/C++ProjectTemplate index c688213..fc00bff 100755 Binary files a/C++ProjectTemplate and b/C++ProjectTemplate differ diff --git a/test/test.cpp b/test/test.cpp index 022bba5..5050529 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -23,6 +23,9 @@ #include "../SeasonI.h" #include "../map.h" +#define TestWhileMax(testname,condition,maxIterations) _TestWait(testname);while(_TestResolve(condition,maxIterations)) +#define TestWhile(testname,condition) TestWhileMax(testname,condition,1000) + extern int frameCount; extern double CUTSCENE_FADE_VALUE; extern Cutscene*CurrentCutscene; @@ -40,6 +43,8 @@ extern std::map BATTLE_PROPERTIES; extern std::map MAPS; int testCount=0; +int MAX_ITERATIONS=1000; +int iterations=0; void Test(std::string name,bool success) { testCount++; @@ -48,6 +53,24 @@ void Test(std::string name,bool success) { std::cout<<" Passed"<MAX_ITERATIONS) { + std::cout<<" FAILED! (Iterations>"< sprList) { for (int i=0;iprevious_fade_value); Test("There should be no objects in the game", OBJECTS.size()==0); - while (CurrentAction==ActionType::FADE) { + TestWhile("Fade out should finish",CurrentAction==ActionType::FADE) { updateGame(); } Test("When faded out, CUTSCENE_FADE_VALUE should be 255", @@ -310,7 +333,7 @@ bool SeasonI::OnUserCreate(){ updateGame(); Test("Fading in causes CUTSCENE_FADE_VALUE to decrease", CUTSCENE_FADE_VALUE0&&cameraPos.y>0); - while (CurrentAction==ActionType::PAN_CAMERA) { + Test("Temporary cutscene object 1 is at position {136,136}", + CurrentCutscene->GetCutsceneObjects()[1]->GetPos().x==136&&CurrentCutscene->GetCutsceneObjects()[1]->GetPos().y==136); + TestWhile("Panning Camera should finish",CurrentAction==ActionType::PAN_CAMERA) { updateGame(); } Test("Camera position should be {128,128}", cameraPos.x==128&&cameraPos.y==128); + Test("Next cutscene action is the async cutscene object movement", + CurrentAction==ActionType::MOVE_CUTSCENE_OBJ_ASYNC); + vd2d prevCutsceneObjPosition=CurrentCutscene->GetCutsceneObjects()[1]->GetPos(); + updateGame(); + Test("Cutscene object is moving towards {80,64}", + CurrentCutscene->GetCutsceneObjects()[1]->GetPos().xGetCutsceneObjects()[1]->GetPos().ycameraPos.x&&prevCameraPos.y>cameraPos.y); + Test("Due to async actions, next cutscene action should be Dialog Box Async", + CurrentAction==ActionType::DIALOG_ASYNC); return true; }