2018-01-05 19:21:19 +08:00
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-12-01 23:26:02 +08:00
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
2018-03-29 16:19:14 +08:00
|
|
|
using JetBrains.Annotations;
|
2018-03-02 14:34:31 +08:00
|
|
|
using NUnit.Framework;
|
2018-01-11 15:51:46 +08:00
|
|
|
using osu.Framework.Allocation;
|
2018-03-15 17:24:57 +08:00
|
|
|
using osu.Framework.Timing;
|
2017-12-01 23:26:02 +08:00
|
|
|
using OpenTK;
|
2018-01-30 17:22:40 +08:00
|
|
|
using osu.Game.Beatmaps;
|
2018-02-22 13:22:04 +08:00
|
|
|
using osu.Game.Rulesets.Edit;
|
2018-02-20 12:50:55 +08:00
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu;
|
2017-12-01 23:26:02 +08:00
|
|
|
using osu.Game.Rulesets.Osu.Edit;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2018-03-14 14:18:21 +08:00
|
|
|
using osu.Game.Screens.Edit.Screens.Compose.Layers;
|
2018-02-20 12:50:55 +08:00
|
|
|
using osu.Game.Tests.Beatmaps;
|
2017-12-01 23:26:02 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual
|
|
|
|
{
|
2018-03-02 14:34:31 +08:00
|
|
|
[TestFixture]
|
2018-04-06 14:18:01 +08:00
|
|
|
public class TestCaseHitObjectComposer : OsuTestCase
|
2017-12-01 23:26:02 +08:00
|
|
|
{
|
2018-02-12 15:02:42 +08:00
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
|
|
|
{
|
2018-04-04 17:21:27 +08:00
|
|
|
typeof(MaskSelection),
|
2018-04-06 12:16:27 +08:00
|
|
|
typeof(DragLayer),
|
2018-02-20 17:01:45 +08:00
|
|
|
typeof(HitObjectComposer),
|
|
|
|
typeof(OsuHitObjectComposer),
|
2018-03-14 14:18:21 +08:00
|
|
|
typeof(HitObjectMaskLayer),
|
2018-03-29 16:19:14 +08:00
|
|
|
typeof(NotNullAttribute)
|
2018-02-12 15:02:42 +08:00
|
|
|
};
|
2017-12-01 23:26:02 +08:00
|
|
|
|
2018-03-19 15:27:52 +08:00
|
|
|
private DependencyContainer dependencies;
|
|
|
|
|
|
|
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
|
|
|
=> dependencies = new DependencyContainer(parent);
|
|
|
|
|
2018-01-11 15:51:46 +08:00
|
|
|
[BackgroundDependencyLoader]
|
2018-02-20 12:50:55 +08:00
|
|
|
private void load(OsuGameBase osuGame)
|
2017-12-01 23:26:02 +08:00
|
|
|
{
|
2018-02-20 12:50:55 +08:00
|
|
|
osuGame.Beatmap.Value = new TestWorkingBeatmap(new Beatmap
|
2018-01-11 15:51:46 +08:00
|
|
|
{
|
2018-02-20 12:50:55 +08:00
|
|
|
HitObjects = new List<HitObject>
|
2018-01-11 15:51:46 +08:00
|
|
|
{
|
2018-02-20 12:50:55 +08:00
|
|
|
new HitCircle { Position = new Vector2(256, 192), Scale = 0.5f },
|
|
|
|
new HitCircle { Position = new Vector2(344, 148), Scale = 0.5f },
|
|
|
|
new Slider
|
|
|
|
{
|
2018-02-23 20:03:45 +08:00
|
|
|
Position = new Vector2(128, 256),
|
2018-02-20 12:50:55 +08:00
|
|
|
ControlPoints = new List<Vector2>
|
|
|
|
{
|
2018-02-23 20:03:45 +08:00
|
|
|
Vector2.Zero,
|
|
|
|
new Vector2(216, 0),
|
2018-02-20 12:50:55 +08:00
|
|
|
},
|
|
|
|
Distance = 400,
|
|
|
|
Velocity = 1,
|
|
|
|
TickDistance = 100,
|
|
|
|
Scale = 0.5f,
|
|
|
|
}
|
2018-01-11 15:51:46 +08:00
|
|
|
},
|
2018-02-20 12:50:55 +08:00
|
|
|
});
|
2018-01-30 17:22:40 +08:00
|
|
|
|
2018-03-15 17:24:57 +08:00
|
|
|
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
2018-03-19 15:27:52 +08:00
|
|
|
dependencies.CacheAs<IAdjustableClock>(clock);
|
|
|
|
dependencies.CacheAs<IFrameBasedClock>(clock);
|
2018-03-15 17:24:57 +08:00
|
|
|
|
2018-03-19 15:27:52 +08:00
|
|
|
Child = new OsuHitObjectComposer(new OsuRuleset());
|
2017-12-01 23:26:02 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|