1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 16:07:24 +08:00

Add failing test case

This commit is contained in:
Bartłomiej Dach 2021-01-31 15:23:53 +01:00
parent fec3bd898e
commit d7e5a21213
2 changed files with 29 additions and 0 deletions

View File

@ -129,5 +129,25 @@ namespace osu.Game.Tests.Beatmaps.Formats
Assert.AreEqual(3456, ((StoryboardSprite)background.Elements.Single()).InitialPosition.X);
}
}
[Test]
public void TestDecodeOutOfRangeLoopAnimationType()
{
var decoder = new LegacyStoryboardDecoder();
using (var resStream = TestResources.OpenResource("animation-types.osb"))
using (var stream = new LineBufferedReader(resStream))
{
var storyboard = decoder.Decode(stream);
StoryboardLayer foreground = storyboard.Layers.Single(l => l.Depth == 0);
Assert.AreEqual(AnimationLoopType.LoopForever, ((StoryboardAnimation)foreground.Elements[0]).LoopType);
Assert.AreEqual(AnimationLoopType.LoopOnce, ((StoryboardAnimation)foreground.Elements[1]).LoopType);
Assert.AreEqual(AnimationLoopType.LoopForever, ((StoryboardAnimation)foreground.Elements[2]).LoopType);
Assert.AreEqual(AnimationLoopType.LoopOnce, ((StoryboardAnimation)foreground.Elements[3]).LoopType);
Assert.AreEqual(AnimationLoopType.LoopForever, ((StoryboardAnimation)foreground.Elements[4]).LoopType);
Assert.AreEqual(AnimationLoopType.LoopForever, ((StoryboardAnimation)foreground.Elements[5]).LoopType);
}
}
}
}

View File

@ -0,0 +1,9 @@
osu file format v14
[Events]
Animation,Foreground,Centre,"forever-string.png",330,240,10,108,LoopForever
Animation,Foreground,Centre,"once-string.png",330,240,10,108,LoopOnce
Animation,Foreground,Centre,"forever-number.png",330,240,10,108,0
Animation,Foreground,Centre,"once-number.png",330,240,10,108,1
Animation,Foreground,Centre,"undefined-number.png",330,240,10,108,16
Animation,Foreground,Centre,"omitted.png",330,240,10,108