1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 05:27:40 +08:00
osu-lazer/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs

85 lines
2.8 KiB
C#
Raw Normal View History

2018-04-13 17:19:50 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Timing;
using OpenTK;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Edit;
2018-10-25 17:26:28 +08:00
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle;
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle.Components;
2018-04-13 17:19:50 +08:00
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit.Screens.Compose;
2018-04-13 17:19:50 +08:00
using osu.Game.Screens.Edit.Screens.Compose.Layers;
using osu.Game.Tests.Beatmaps;
namespace osu.Game.Tests.Visual
{
[TestFixture]
[Cached(Type = typeof(IPlacementHandler))]
public class TestCaseHitObjectComposer : OsuTestCase, IPlacementHandler
2018-04-13 17:19:50 +08:00
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(MaskSelection),
typeof(DragLayer),
typeof(HitObjectComposer),
typeof(OsuHitObjectComposer),
typeof(HitObjectMaskLayer),
typeof(NotNullAttribute),
2018-10-25 17:28:04 +08:00
typeof(HitCirclePiece),
typeof(HitCircleSelectionMask),
typeof(HitCirclePlacementMask),
2018-04-13 17:19:50 +08:00
};
private HitObjectComposer composer;
2018-04-13 17:19:50 +08:00
[BackgroundDependencyLoader]
private void load()
2018-04-13 17:19:50 +08:00
{
Beatmap.Value = new TestWorkingBeatmap(new Beatmap
2018-04-13 17:19:50 +08:00
{
HitObjects = new List<HitObject>
{
new HitCircle { Position = new Vector2(256, 192), Scale = 0.5f },
new HitCircle { Position = new Vector2(344, 148), Scale = 0.5f },
new Slider
{
Position = new Vector2(128, 256),
ControlPoints = new List<Vector2>
{
Vector2.Zero,
new Vector2(216, 0),
},
2018-10-03 13:35:32 +08:00
Distance = 216,
2018-04-13 17:19:50 +08:00
Velocity = 1,
TickDistance = 100,
Scale = 0.5f,
}
},
});
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
Dependencies.CacheAs<IAdjustableClock>(clock);
Dependencies.CacheAs<IFrameBasedClock>(clock);
2018-04-13 17:19:50 +08:00
Child = composer = new OsuHitObjectComposer(new OsuRuleset());
2018-04-13 17:19:50 +08:00
}
public void BeginPlacement(HitObject hitObject)
{
}
public void EndPlacement(HitObject hitObject) => composer.Add(hitObject);
2018-10-18 15:36:06 +08:00
public void Delete(HitObject hitObject) => composer.Remove(hitObject);
2018-04-13 17:19:50 +08:00
}
}