forked from ppy/osu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestSceneOutOfBoundsObjects.cs
72 lines (65 loc) · 2.34 KB
/
TestSceneOutOfBoundsObjects.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawables;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osuTK;
namespace osu.Game.Rulesets.Catch.Tests
{
public partial class TestSceneOutOfBoundsObjects : TestSceneCatchPlayer
{
protected override bool Autoplay => true;
[Test]
public void TestNoOutOfBoundsObjects()
{
bool anyObjectOutOfBounds = false;
AddStep("reset flag", () => anyObjectOutOfBounds = false);
AddUntilStep("check for out-of-bounds objects",
() =>
{
anyObjectOutOfBounds |= Player.ChildrenOfType<DrawableCatchHitObject>().Any(dho => dho.X < 0 || dho.X > CatchPlayfield.WIDTH);
return Player.ScoreProcessor.HasCompleted.Value;
});
AddAssert("no out of bound objects found", () => !anyObjectOutOfBounds);
}
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new Beatmap
{
BeatmapInfo = new BeatmapInfo
{
Ruleset = ruleset,
},
HitObjects = new List<HitObject>
{
new Fruit { StartTime = 1000, X = -50 },
new Fruit { StartTime = 1200, X = CatchPlayfield.WIDTH + 50 },
new JuiceStream
{
StartTime = 1500,
X = 10,
Path = new SliderPath(PathType.LINEAR, new[]
{
Vector2.Zero,
new Vector2(-200, 0)
})
},
new JuiceStream
{
StartTime = 3000,
X = CatchPlayfield.WIDTH - 10,
Path = new SliderPath(PathType.LINEAR, new[]
{
Vector2.Zero,
new Vector2(200, 0)
})
},
}
};
}
}