1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 13:27:23 +08:00

Fix unit tests.

This commit is contained in:
smoogipooo 2017-03-14 18:46:34 +09:00
parent ad9583a179
commit 4c7f0fcb73
7 changed files with 38 additions and 12 deletions

View File

@ -1,19 +1,19 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Screens.Testing;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using OpenTK; using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Game.Modes.Objects.Drawables; using osu.Framework.Graphics;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.Osu.Objects.Drawables;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using OpenTK.Graphics; using osu.Framework.Screens.Testing;
using osu.Framework.Timing;
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.Osu.Objects.Drawables;
using System.Collections.Generic;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {

View File

@ -7,7 +7,7 @@ using OpenTK;
namespace osu.Game.Modes.Objects.Legacy namespace osu.Game.Modes.Objects.Legacy
{ {
/// <summary> /// <summary>
/// Base Hit-type, used for parsing Beatmaps. /// Legacy Hit-type, used for parsing Beatmaps.
/// </summary> /// </summary>
public sealed class LegacyHit : HitObject, IHasPosition, IHasCombo public sealed class LegacyHit : HitObject, IHasPosition, IHasCombo
{ {

View File

@ -0,0 +1,18 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Game.Modes.Objects.Types;
namespace osu.Game.Modes.Objects.Legacy
{
/// <summary>
/// Legacy Hold-type, used for parsing "specials" in beatmaps.
/// </summary>
public sealed class LegacyHold : HitObject, IHasPosition, IHasCombo
{
public Vector2 Position { get; set; }
public bool NewCombo { get; set; }
}
}

View File

@ -8,7 +8,7 @@ using OpenTK;
namespace osu.Game.Modes.Objects.Legacy namespace osu.Game.Modes.Objects.Legacy
{ {
/// <summary> /// <summary>
/// Base Slider-type, used for parsing Beatmaps. /// Legacy Slider-type, used for parsing Beatmaps.
/// </summary> /// </summary>
public sealed class LegacySlider : HitObject, IHasCurve, IHasPosition, IHasDistance, IHasRepeats, IHasCombo public sealed class LegacySlider : HitObject, IHasCurve, IHasPosition, IHasDistance, IHasRepeats, IHasCombo
{ {

View File

@ -6,7 +6,7 @@ using osu.Game.Modes.Objects.Types;
namespace osu.Game.Modes.Objects.Legacy namespace osu.Game.Modes.Objects.Legacy
{ {
/// <summary> /// <summary>
/// Base Spinner-type, used for parsing Beatmaps. /// Legacy Spinner-type, used for parsing Beatmaps.
/// </summary> /// </summary>
internal class LegacySpinner : HitObject, IHasEndTime internal class LegacySpinner : HitObject, IHasEndTime
{ {

View File

@ -18,7 +18,6 @@ namespace osu.Game.Modes.Objects
string[] split = text.Split(','); string[] split = text.Split(',');
var type = (HitObjectType)int.Parse(split[3]); var type = (HitObjectType)int.Parse(split[3]);
bool combo = type.HasFlag(HitObjectType.NewCombo); bool combo = type.HasFlag(HitObjectType.NewCombo);
type &= (HitObjectType)0xF;
type &= ~HitObjectType.NewCombo; type &= ~HitObjectType.NewCombo;
HitObject result; HitObject result;
@ -91,6 +90,14 @@ namespace osu.Game.Modes.Objects
EndTime = Convert.ToDouble(split[5], CultureInfo.InvariantCulture) EndTime = Convert.ToDouble(split[5], CultureInfo.InvariantCulture)
}; };
break; break;
case HitObjectType.Hold:
// Note: Hold is generated by BMS converts
result = new LegacyHold
{
Position = new Vector2(int.Parse(split[0]), int.Parse(split[1])),
NewCombo = combo
};
break;
default: default:
throw new InvalidOperationException($@"Unknown hit object type {type}"); throw new InvalidOperationException($@"Unknown hit object type {type}");
} }

View File

@ -96,6 +96,7 @@
<Compile Include="Modes\Mods\ModType.cs" /> <Compile Include="Modes\Mods\ModType.cs" />
<Compile Include="Modes\Objects\Legacy\LegacyHit.cs" /> <Compile Include="Modes\Objects\Legacy\LegacyHit.cs" />
<Compile Include="Modes\Objects\LegacyHitObjectParser.cs" /> <Compile Include="Modes\Objects\LegacyHitObjectParser.cs" />
<Compile Include="Modes\Objects\Legacy\LegacyHold.cs" />
<Compile Include="Modes\Objects\Legacy\LegacySlider.cs" /> <Compile Include="Modes\Objects\Legacy\LegacySlider.cs" />
<Compile Include="Modes\Objects\Legacy\LegacySpinner.cs" /> <Compile Include="Modes\Objects\Legacy\LegacySpinner.cs" />
<Compile Include="Modes\Objects\Types\CurveType.cs" /> <Compile Include="Modes\Objects\Types\CurveType.cs" />