mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-22 10:16:01 +08:00
[c] Added callback recursion issue to test suite
This commit is contained in:
parent
6fe1e8fa68
commit
873ed16a53
@ -179,4 +179,44 @@ void MemoryTestFixture::reproduceIssue_777()
|
||||
DisposeAll(skeleton, state, stateData, skeletonData, atlas);
|
||||
}
|
||||
|
||||
spSkeleton* skeleton = nullptr;
|
||||
static void spineAnimStateHandler(spAnimationState* state, int type, spTrackEntry* entry, spEvent* event)
|
||||
{
|
||||
if (type == SP_ANIMATION_COMPLETE)
|
||||
{
|
||||
spAnimationState_setAnimationByName(state, 0, "walk", false);
|
||||
spAnimationState_update(state, 0);
|
||||
spAnimationState_apply(state, skeleton);
|
||||
}
|
||||
}
|
||||
|
||||
void MemoryTestFixture::reproduceIssue_Loop()
|
||||
{
|
||||
spAtlas* atlas = nullptr;
|
||||
spSkeletonData* skeletonData = nullptr;
|
||||
spAnimationStateData* stateData = nullptr;
|
||||
spAnimationState* state = nullptr;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Initialize Animations
|
||||
LoadSpineboyExample(atlas, skeletonData, stateData, skeleton, state);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (state)
|
||||
state->listener = (spAnimationStateListener)&spineAnimStateHandler;
|
||||
|
||||
spAnimationState_setAnimationByName(state, 0, "walk", false);
|
||||
|
||||
// run normal update
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
const float timeSlice = 1.0f / 60.0f;
|
||||
spSkeleton_update(skeleton, timeSlice);
|
||||
spAnimationState_update(state, timeSlice);
|
||||
spAnimationState_apply(state, skeleton);
|
||||
}
|
||||
|
||||
DisposeAll(skeleton, state, stateData, skeletonData, atlas);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ public:
|
||||
// Comment out here to disable individual test cases
|
||||
TEST_CASE(reproduceIssue_776);
|
||||
TEST_CASE(reproduceIssue_777);
|
||||
TEST_CASE(reproduceIssue_Loop);
|
||||
|
||||
initialize();
|
||||
}
|
||||
@ -29,6 +30,7 @@ public:
|
||||
public:
|
||||
void reproduceIssue_776();
|
||||
void reproduceIssue_777();
|
||||
void reproduceIssue_Loop(); // http://esotericsoftware.com/forum/spine-c-3-5-animation-jerking-7451
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// test fixture setup
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user