mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08:00
Merge branch 'master' into kps
This commit is contained in:
commit
d4afc3629c
@ -51,8 +51,8 @@
|
||||
<Reference Include="Java.Interop" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.819.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.825.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.831.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.908.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
||||
|
@ -76,7 +76,7 @@ namespace osu.Desktop.Security
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Icon = FontAwesome.Solid.ShieldAlt;
|
||||
IconBackground.Colour = colours.YellowDark;
|
||||
IconContent.Colour = colours.YellowDark;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ using System.Runtime.Versioning;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game;
|
||||
@ -15,7 +13,6 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using Squirrel;
|
||||
using Squirrel.SimpleSplat;
|
||||
|
||||
@ -177,17 +174,11 @@ namespace osu.Desktop.Updater
|
||||
{
|
||||
IconContent.AddRange(new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientVertical(colours.YellowDark, colours.Yellow)
|
||||
},
|
||||
new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = FontAwesome.Solid.Upload,
|
||||
Colour = Color4.White,
|
||||
Size = new Vector2(20),
|
||||
}
|
||||
});
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
|
||||
public void UpdateFrom(ScrollingHitObjectContainer hitObjectContainer, JuiceStream hitObject)
|
||||
{
|
||||
while (path.Vertices.Count < InternalChildren.Count)
|
||||
RemoveInternal(InternalChildren[^1]);
|
||||
RemoveInternal(InternalChildren[^1], true);
|
||||
|
||||
while (InternalChildren.Count < path.Vertices.Count)
|
||||
AddInternal(new VertexPiece());
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints.Components
|
||||
.Where(h => !(h is TinyDroplet)));
|
||||
|
||||
while (nestedHitObjects.Count < InternalChildren.Count)
|
||||
RemoveInternal(InternalChildren[^1]);
|
||||
RemoveInternal(InternalChildren[^1], true);
|
||||
|
||||
while (InternalChildren.Count < nestedHitObjects.Count)
|
||||
AddInternal(new FruitOutline());
|
||||
|
@ -271,8 +271,8 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
SetHyperDashState();
|
||||
}
|
||||
|
||||
caughtObjectContainer.RemoveAll(d => d.HitObject == drawableObject.HitObject);
|
||||
droppedObjectTarget.RemoveAll(d => d.HitObject == drawableObject.HitObject);
|
||||
caughtObjectContainer.RemoveAll(d => d.HitObject == drawableObject.HitObject, false);
|
||||
droppedObjectTarget.RemoveAll(d => d.HitObject == drawableObject.HitObject, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -430,7 +430,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
var droppedObject = getDroppedObject(caughtObject);
|
||||
|
||||
caughtObjectContainer.Remove(caughtObject);
|
||||
caughtObjectContainer.Remove(caughtObject, false);
|
||||
|
||||
droppedObjectTarget.Add(droppedObject);
|
||||
|
||||
|
@ -93,15 +93,15 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
switch (entry.Animation)
|
||||
{
|
||||
case CatcherTrailAnimation.Dashing:
|
||||
dashTrails.Remove(drawable);
|
||||
dashTrails.Remove(drawable, false);
|
||||
break;
|
||||
|
||||
case CatcherTrailAnimation.HyperDashing:
|
||||
hyperDashTrails.Remove(drawable);
|
||||
hyperDashTrails.Remove(drawable, false);
|
||||
break;
|
||||
|
||||
case CatcherTrailAnimation.HyperDashAfterImage:
|
||||
hyperDashAfterImages.Remove(drawable);
|
||||
hyperDashAfterImages.Remove(drawable, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
@ -34,10 +35,14 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||
{
|
||||
AddStep("setup compose screen", () =>
|
||||
{
|
||||
var editorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 })
|
||||
var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 4 })
|
||||
{
|
||||
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
|
||||
});
|
||||
};
|
||||
|
||||
beatmap.ControlPointInfo.Add(0, new TimingControlPoint());
|
||||
|
||||
var editorBeatmap = new EditorBeatmap(beatmap, new LegacyBeatmapSkin(beatmap.BeatmapInfo, null));
|
||||
|
||||
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
|
||||
|
||||
@ -50,7 +55,11 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||
(typeof(IBeatSnapProvider), editorBeatmap),
|
||||
(typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Green)),
|
||||
},
|
||||
Child = new ComposeScreen { State = { Value = Visibility.Visible } },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
editorBeatmap,
|
||||
new ComposeScreen { State = { Value = Visibility.Visible } },
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Configuration.Tracking;
|
||||
using osu.Game.Configuration;
|
||||
@ -33,7 +31,7 @@ namespace osu.Game.Rulesets.Mania.Configuration
|
||||
scrollTime => new SettingDescription(
|
||||
rawValue: scrollTime,
|
||||
name: "Scroll Speed",
|
||||
value: $"{(int)Math.Round(DrawableManiaRuleset.MAX_TIME_RANGE / scrollTime)} ({scrollTime}ms)"
|
||||
value: $"{scrollTime}ms (speed {(int)Math.Round(DrawableManiaRuleset.MAX_TIME_RANGE / scrollTime)})"
|
||||
)
|
||||
)
|
||||
};
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
||||
private readonly bool isForCurrentRuleset;
|
||||
private readonly double originalOverallDifficulty;
|
||||
|
||||
public override int Version => 20220701;
|
||||
public override int Version => 20220902;
|
||||
|
||||
public ManiaDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
|
||||
: base(ruleset, beatmap)
|
||||
|
@ -1,8 +1,7 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
@ -34,7 +33,7 @@ namespace osu.Game.Rulesets.Mania
|
||||
LabelText = "Scrolling direction",
|
||||
Current = config.GetBindable<ManiaScrollingDirection>(ManiaRulesetSetting.ScrollDirection)
|
||||
},
|
||||
new SettingsSlider<double, TimeSlider>
|
||||
new SettingsSlider<double, ManiaScrollSlider>
|
||||
{
|
||||
LabelText = "Scroll speed",
|
||||
Current = config.GetBindable<double>(ManiaRulesetSetting.ScrollTime),
|
||||
@ -47,5 +46,10 @@ namespace osu.Game.Rulesets.Mania
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private class ManiaScrollSlider : OsuSliderBar<double>
|
||||
{
|
||||
public override LocalisableString TooltipText => $"{Current.Value}ms (speed {(int)Math.Round(DrawableManiaRuleset.MAX_TIME_RANGE / Current.Value)})";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
HitObjectContainer hoc = column.HitObjectArea.HitObjectContainer;
|
||||
Container hocParent = (Container)hoc.Parent;
|
||||
|
||||
hocParent.Remove(hoc);
|
||||
hocParent.Remove(hoc, false);
|
||||
hocParent.Add(new PlayfieldCoveringWrapper(hoc).With(c =>
|
||||
{
|
||||
c.RelativeSizeAxes = Axes.Both;
|
||||
|
@ -155,7 +155,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
||||
else
|
||||
{
|
||||
lightContainer.FadeOut(120)
|
||||
.OnComplete(d => Column.TopLevelContainer.Remove(d));
|
||||
.OnComplete(d => Column.TopLevelContainer.Remove(d, false));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||
AddStep("add two circles on the same position", () =>
|
||||
{
|
||||
circle1 = new HitCircle();
|
||||
circle2 = new HitCircle { Position = circle1.Position + Vector2.UnitX, StartTime = 1 };
|
||||
circle2 = new HitCircle { Position = circle1.Position + Vector2.UnitX };
|
||||
EditorClock.Seek(0);
|
||||
EditorBeatmap.Add(circle1);
|
||||
EditorBeatmap.Add(circle2);
|
||||
@ -205,6 +205,33 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||
&& EditorBeatmap.HitObjects.Contains(circle1) && EditorBeatmap.HitObjects.Contains(circle2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSameStartTimeMerge()
|
||||
{
|
||||
HitCircle? circle1 = null;
|
||||
HitCircle? circle2 = null;
|
||||
|
||||
AddStep("add two circles at the same time", () =>
|
||||
{
|
||||
circle1 = new HitCircle();
|
||||
circle2 = new HitCircle { Position = circle1.Position + 100 * Vector2.UnitX };
|
||||
EditorClock.Seek(0);
|
||||
EditorBeatmap.Add(circle1);
|
||||
EditorBeatmap.Add(circle2);
|
||||
EditorBeatmap.SelectedHitObjects.Add(circle1);
|
||||
EditorBeatmap.SelectedHitObjects.Add(circle2);
|
||||
});
|
||||
|
||||
moveMouseToHitObject(1);
|
||||
AddAssert("merge option available", () => selectionHandler.ContextMenuItems.Any(o => o.Text.Value == "Merge selection"));
|
||||
|
||||
mergeSelection();
|
||||
|
||||
AddAssert("slider created", () => circle1 is not null && circle2 is not null && sliderCreatedFor(
|
||||
(pos: circle1.Position, pathType: PathType.Linear),
|
||||
(pos: circle2.Position, pathType: null)));
|
||||
}
|
||||
|
||||
private void mergeSelection()
|
||||
{
|
||||
AddStep("merge selection", () =>
|
||||
|
@ -195,7 +195,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
var drawableObject = getFunc.Invoke();
|
||||
|
||||
hitObjectContainer.Remove(drawableObject);
|
||||
hitObjectContainer.Remove(drawableObject, false);
|
||||
followPointRenderer.RemoveFollowPoints(drawableObject.HitObject);
|
||||
});
|
||||
}
|
||||
@ -212,7 +212,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
else
|
||||
targetTime = getObject(hitObjectContainer.Count - 1).HitObject.StartTime + 1;
|
||||
|
||||
hitObjectContainer.Remove(toReorder);
|
||||
hitObjectContainer.Remove(toReorder, false);
|
||||
toReorder.HitObject.StartTime = targetTime;
|
||||
hitObjectContainer.Add(toReorder);
|
||||
});
|
||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
private const double difficulty_multiplier = 0.0675;
|
||||
private double hitWindowGreat;
|
||||
|
||||
public override int Version => 20220701;
|
||||
public override int Version => 20220902;
|
||||
|
||||
public OsuDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
|
||||
: base(ruleset, beatmap)
|
||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
if (maxStrain == 0)
|
||||
return 0;
|
||||
|
||||
return objectStrains.Aggregate((total, next) => total + (1.0 / (1.0 + Math.Exp(-(next / maxStrain * 12.0 - 6.0)))));
|
||||
return objectStrains.Sum(strain => 1.0 / (1.0 + Math.Exp(-(strain / maxStrain * 12.0 - 6.0))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +89,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
|
||||
HitObject.DifficultyControlPoint = nearestDifficultyPoint ?? new DifficultyControlPoint();
|
||||
HitObject.Position = ToLocalSpace(result.ScreenSpacePosition);
|
||||
|
||||
// Replacing the DifficultyControlPoint above doesn't trigger any kind of invalidation.
|
||||
// Without re-applying defaults, velocity won't be updated.
|
||||
ApplyDefaultsToHitObject();
|
||||
break;
|
||||
|
||||
case SliderPlacementState.Body:
|
||||
|
@ -361,7 +361,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
if (!canMerge(mergeableObjects))
|
||||
return;
|
||||
|
||||
ChangeHandler?.BeginChange();
|
||||
EditorBeatmap.BeginChange();
|
||||
|
||||
// Have an initial slider object.
|
||||
var firstHitObject = mergeableObjects[0];
|
||||
@ -437,7 +437,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
SelectedItems.Clear();
|
||||
SelectedItems.Add(mergedHitObject);
|
||||
|
||||
ChangeHandler?.EndChange();
|
||||
EditorBeatmap.EndChange();
|
||||
}
|
||||
|
||||
protected override IEnumerable<MenuItem> GetContextMenuItemsForSelection(IEnumerable<SelectionBlueprint<HitObject>> selection)
|
||||
|
@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
};
|
||||
|
||||
[SettingSource("Metronome ticks", "Whether a metronome beat should play in the background")]
|
||||
public BindableBool Metronome { get; } = new BindableBool(true);
|
||||
public Bindable<bool> Metronome { get; } = new BindableBool(true);
|
||||
|
||||
#region Constants
|
||||
|
||||
@ -362,10 +362,12 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
return breaks.Any(breakPeriod =>
|
||||
{
|
||||
var firstObjAfterBreak = originalHitObjects.First(obj => almostBigger(obj.StartTime, breakPeriod.EndTime));
|
||||
OsuHitObject? firstObjAfterBreak = originalHitObjects.FirstOrDefault(obj => almostBigger(obj.StartTime, breakPeriod.EndTime));
|
||||
|
||||
return almostBigger(time, breakPeriod.StartTime)
|
||||
&& definitelyBigger(firstObjAfterBreak.StartTime, time);
|
||||
// There should never really be a break section with no objects after it, but we've seen crashes from users with malformed beatmaps,
|
||||
// so it's best to guard against this.
|
||||
&& (firstObjAfterBreak == null || definitelyBigger(firstObjAfterBreak.StartTime, time));
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
// This is a bit ugly but we don't have the concept of InternalContent so it'll have to do for now. (https://github.com/ppy/osu-framework/issues/1690)
|
||||
protected override void AddInternal(Drawable drawable) => shakeContainer.Add(drawable);
|
||||
protected override void ClearInternal(bool disposeChildren = true) => shakeContainer.Clear(disposeChildren);
|
||||
protected override bool RemoveInternal(Drawable drawable) => shakeContainer.Remove(drawable);
|
||||
protected override bool RemoveInternal(Drawable drawable, bool disposeImmediately) => shakeContainer.Remove(drawable, disposeImmediately);
|
||||
|
||||
protected sealed override double InitialLifetimeOffset => HitObject.TimePreempt;
|
||||
|
||||
|
@ -14,6 +14,7 @@ using osu.Framework.Caching;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
@ -165,11 +166,15 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||
|
||||
TimingControlPoint timingPoint = controlPointInfo.TimingPointAt(StartTime);
|
||||
#pragma warning disable 618
|
||||
var legacyDifficultyPoint = DifficultyControlPoint as LegacyBeatmapDecoder.LegacyDifficultyControlPoint;
|
||||
#pragma warning restore 618
|
||||
|
||||
double scoringDistance = BASE_SCORING_DISTANCE * difficulty.SliderMultiplier * DifficultyControlPoint.SliderVelocity;
|
||||
bool generateTicks = legacyDifficultyPoint?.GenerateTicks ?? true;
|
||||
|
||||
Velocity = scoringDistance / timingPoint.BeatLength;
|
||||
TickDistance = scoringDistance / difficulty.SliderTickRate * TickDistanceMultiplier;
|
||||
TickDistance = generateTicks ? (scoringDistance / difficulty.SliderTickRate * TickDistanceMultiplier) : double.PositiveInfinity;
|
||||
}
|
||||
|
||||
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||
|
@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
currentRotation += angle;
|
||||
// rate has to be applied each frame, because it's not guaranteed to be constant throughout playback
|
||||
// (see: ModTimeRamp)
|
||||
drawableSpinner.Result.RateAdjustedRotation += (float)(Math.Abs(angle) * (gameplayClock?.TrueGameplayRate ?? Clock.Rate));
|
||||
drawableSpinner.Result.RateAdjustedRotation += (float)(Math.Abs(angle) * (gameplayClock?.GetTrueGameplayRate() ?? Clock.Rate));
|
||||
}
|
||||
|
||||
private void resetState(DrawableHitObject obj)
|
||||
|
96
osu.Game.Rulesets.Taiko.Tests/Judgements/JudgementTest.cs
Normal file
96
osu.Game.Rulesets.Taiko.Tests/Judgements/JudgementTest.cs
Normal file
@ -0,0 +1,96 @@
|
||||
// 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.Extensions.TypeExtensions;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Replays;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests.Judgements
|
||||
{
|
||||
public class JudgementTest : RateAdjustedBeatmapTestScene
|
||||
{
|
||||
private ScoreAccessibleReplayPlayer currentPlayer = null!;
|
||||
protected List<JudgementResult> JudgementResults { get; private set; } = null!;
|
||||
|
||||
protected void AssertJudgementCount(int count)
|
||||
{
|
||||
AddAssert($"{count} judgement{(count > 0 ? "s" : "")}", () => JudgementResults, () => Has.Count.EqualTo(count));
|
||||
}
|
||||
|
||||
protected void AssertResult<T>(int index, HitResult expectedResult)
|
||||
{
|
||||
AddAssert($"{typeof(T).ReadableName()} ({index}) judged as {expectedResult}",
|
||||
() => JudgementResults.Where(j => j.HitObject is T).OrderBy(j => j.HitObject.StartTime).ElementAt(index).Type,
|
||||
() => Is.EqualTo(expectedResult));
|
||||
}
|
||||
|
||||
protected void PerformTest(List<ReplayFrame> frames, Beatmap<TaikoHitObject>? beatmap = null)
|
||||
{
|
||||
AddStep("load player", () =>
|
||||
{
|
||||
Beatmap.Value = CreateWorkingBeatmap(beatmap);
|
||||
|
||||
var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } });
|
||||
|
||||
p.OnLoadComplete += _ =>
|
||||
{
|
||||
p.ScoreProcessor.NewJudgement += result =>
|
||||
{
|
||||
if (currentPlayer == p) JudgementResults.Add(result);
|
||||
};
|
||||
};
|
||||
|
||||
LoadScreen(currentPlayer = p);
|
||||
JudgementResults = new List<JudgementResult>();
|
||||
});
|
||||
|
||||
AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0);
|
||||
AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen());
|
||||
AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor.HasCompleted.Value);
|
||||
}
|
||||
|
||||
protected Beatmap<TaikoHitObject> CreateBeatmap(params TaikoHitObject[] hitObjects)
|
||||
{
|
||||
var beatmap = new Beatmap<TaikoHitObject>
|
||||
{
|
||||
HitObjects = hitObjects.ToList(),
|
||||
BeatmapInfo =
|
||||
{
|
||||
Difficulty = new BeatmapDifficulty { SliderTickRate = 4 },
|
||||
Ruleset = new TaikoRuleset().RulesetInfo
|
||||
},
|
||||
};
|
||||
|
||||
beatmap.ControlPointInfo.Add(0, new EffectControlPoint { ScrollSpeed = 0.1f });
|
||||
return beatmap;
|
||||
}
|
||||
|
||||
private class ScoreAccessibleReplayPlayer : ReplayPlayer
|
||||
{
|
||||
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
||||
|
||||
protected override bool PauseOnFocusLost => false;
|
||||
|
||||
public ScoreAccessibleReplayPlayer(Score score)
|
||||
: base(score, new PlayerConfiguration
|
||||
{
|
||||
AllowPause = false,
|
||||
ShowResults = false,
|
||||
})
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,201 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.Taiko.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests.Judgements
|
||||
{
|
||||
public class TestSceneDrumRollJudgements : JudgementTest
|
||||
{
|
||||
[Test]
|
||||
public void TestHitAllDrumRoll()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(1000, TaikoAction.LeftCentre),
|
||||
new TaikoReplayFrame(1001),
|
||||
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
|
||||
new TaikoReplayFrame(2001),
|
||||
}, CreateBeatmap(new DrumRoll
|
||||
{
|
||||
StartTime = hit_time,
|
||||
Duration = 1000
|
||||
}));
|
||||
|
||||
AssertJudgementCount(3);
|
||||
AssertResult<DrumRollTick>(0, HitResult.SmallBonus);
|
||||
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitSomeDrumRoll()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
|
||||
new TaikoReplayFrame(2001),
|
||||
}, CreateBeatmap(new DrumRoll
|
||||
{
|
||||
StartTime = hit_time,
|
||||
Duration = 1000
|
||||
}));
|
||||
|
||||
AssertJudgementCount(3);
|
||||
AssertResult<DrumRollTick>(0, HitResult.IgnoreMiss);
|
||||
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitNoneDrumRoll()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
}, CreateBeatmap(new DrumRoll
|
||||
{
|
||||
StartTime = hit_time,
|
||||
Duration = 1000
|
||||
}));
|
||||
|
||||
AssertJudgementCount(3);
|
||||
AssertResult<DrumRollTick>(0, HitResult.IgnoreMiss);
|
||||
AssertResult<DrumRollTick>(1, HitResult.IgnoreMiss);
|
||||
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitAllStrongDrumRollWithOneKey()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(1000, TaikoAction.LeftCentre),
|
||||
new TaikoReplayFrame(1001),
|
||||
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
|
||||
new TaikoReplayFrame(2001),
|
||||
}, CreateBeatmap(new DrumRoll
|
||||
{
|
||||
StartTime = hit_time,
|
||||
Duration = 1000,
|
||||
IsStrong = true
|
||||
}));
|
||||
|
||||
AssertJudgementCount(6);
|
||||
|
||||
AssertResult<DrumRollTick>(0, HitResult.SmallBonus);
|
||||
AssertResult<StrongNestedHitObject>(0, HitResult.LargeBonus);
|
||||
|
||||
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||
AssertResult<StrongNestedHitObject>(1, HitResult.LargeBonus);
|
||||
|
||||
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||
AssertResult<StrongNestedHitObject>(2, HitResult.IgnoreHit);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitSomeStrongDrumRollWithOneKey()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(2000, TaikoAction.LeftCentre),
|
||||
new TaikoReplayFrame(2001),
|
||||
}, CreateBeatmap(new DrumRoll
|
||||
{
|
||||
StartTime = hit_time,
|
||||
Duration = 1000,
|
||||
IsStrong = true
|
||||
}));
|
||||
|
||||
AssertJudgementCount(6);
|
||||
|
||||
AssertResult<DrumRollTick>(0, HitResult.IgnoreMiss);
|
||||
AssertResult<StrongNestedHitObject>(0, HitResult.IgnoreMiss);
|
||||
|
||||
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||
AssertResult<StrongNestedHitObject>(1, HitResult.LargeBonus);
|
||||
|
||||
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||
AssertResult<StrongNestedHitObject>(2, HitResult.IgnoreHit);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitAllStrongDrumRollWithBothKeys()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(1000, TaikoAction.LeftCentre, TaikoAction.RightCentre),
|
||||
new TaikoReplayFrame(1001),
|
||||
new TaikoReplayFrame(2000, TaikoAction.LeftCentre, TaikoAction.RightCentre),
|
||||
new TaikoReplayFrame(2001),
|
||||
}, CreateBeatmap(new DrumRoll
|
||||
{
|
||||
StartTime = hit_time,
|
||||
Duration = 1000,
|
||||
IsStrong = true
|
||||
}));
|
||||
|
||||
AssertJudgementCount(6);
|
||||
|
||||
AssertResult<DrumRollTick>(0, HitResult.SmallBonus);
|
||||
AssertResult<StrongNestedHitObject>(0, HitResult.LargeBonus);
|
||||
|
||||
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||
AssertResult<StrongNestedHitObject>(1, HitResult.LargeBonus);
|
||||
|
||||
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||
AssertResult<StrongNestedHitObject>(2, HitResult.IgnoreHit);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitSomeStrongDrumRollWithBothKeys()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(2000, TaikoAction.LeftCentre, TaikoAction.RightCentre),
|
||||
new TaikoReplayFrame(2001),
|
||||
}, CreateBeatmap(new DrumRoll
|
||||
{
|
||||
StartTime = hit_time,
|
||||
Duration = 1000,
|
||||
IsStrong = true
|
||||
}));
|
||||
|
||||
AssertJudgementCount(6);
|
||||
|
||||
AssertResult<DrumRollTick>(0, HitResult.IgnoreMiss);
|
||||
AssertResult<StrongNestedHitObject>(0, HitResult.IgnoreMiss);
|
||||
|
||||
AssertResult<DrumRollTick>(1, HitResult.SmallBonus);
|
||||
AssertResult<StrongNestedHitObject>(1, HitResult.LargeBonus);
|
||||
|
||||
AssertResult<DrumRoll>(0, HitResult.IgnoreHit);
|
||||
AssertResult<StrongNestedHitObject>(2, HitResult.IgnoreHit);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Game.Rulesets.Replays;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.Taiko.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests.Judgements
|
||||
{
|
||||
public class TestSceneHitJudgements : JudgementTest
|
||||
{
|
||||
[Test]
|
||||
public void TestHitCentreHit()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(hit_time, TaikoAction.LeftCentre),
|
||||
}, CreateBeatmap(new Hit
|
||||
{
|
||||
Type = HitType.Centre,
|
||||
StartTime = hit_time
|
||||
}));
|
||||
|
||||
AssertJudgementCount(1);
|
||||
AssertResult<Hit>(0, HitResult.Great);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitRimHit()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(hit_time, TaikoAction.LeftRim),
|
||||
}, CreateBeatmap(new Hit
|
||||
{
|
||||
Type = HitType.Rim,
|
||||
StartTime = hit_time
|
||||
}));
|
||||
|
||||
AssertJudgementCount(1);
|
||||
AssertResult<Hit>(0, HitResult.Great);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMissHit()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0)
|
||||
}, CreateBeatmap(new Hit
|
||||
{
|
||||
Type = HitType.Centre,
|
||||
StartTime = hit_time
|
||||
}));
|
||||
|
||||
AssertJudgementCount(1);
|
||||
AssertResult<Hit>(0, HitResult.Miss);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitStrongHitWithOneKey()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(hit_time, TaikoAction.LeftCentre),
|
||||
}, CreateBeatmap(new Hit
|
||||
{
|
||||
Type = HitType.Centre,
|
||||
StartTime = hit_time,
|
||||
IsStrong = true
|
||||
}));
|
||||
|
||||
AssertJudgementCount(2);
|
||||
AssertResult<Hit>(0, HitResult.Great);
|
||||
AssertResult<StrongNestedHitObject>(0, HitResult.IgnoreMiss);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitStrongHitWithBothKeys()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(hit_time, TaikoAction.LeftCentre, TaikoAction.RightCentre),
|
||||
}, CreateBeatmap(new Hit
|
||||
{
|
||||
Type = HitType.Centre,
|
||||
StartTime = hit_time,
|
||||
IsStrong = true
|
||||
}));
|
||||
|
||||
AssertJudgementCount(2);
|
||||
AssertResult<Hit>(0, HitResult.Great);
|
||||
AssertResult<StrongNestedHitObject>(0, HitResult.LargeBonus);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMissStrongHit()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
PerformTest(new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
}, CreateBeatmap(new Hit
|
||||
{
|
||||
Type = HitType.Centre,
|
||||
StartTime = hit_time,
|
||||
IsStrong = true
|
||||
}));
|
||||
|
||||
AssertJudgementCount(2);
|
||||
AssertResult<Hit>(0, HitResult.Miss);
|
||||
AssertResult<StrongNestedHitObject>(0, HitResult.IgnoreMiss);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
// 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.Game.Rulesets.Replays;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.Taiko.Replays;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests.Judgements
|
||||
{
|
||||
public class TestSceneSwellJudgements : JudgementTest
|
||||
{
|
||||
[Test]
|
||||
public void TestHitAllSwell()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
Swell swell = new Swell
|
||||
{
|
||||
StartTime = hit_time,
|
||||
Duration = 1000,
|
||||
RequiredHits = 10
|
||||
};
|
||||
|
||||
List<ReplayFrame> frames = new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(2001),
|
||||
};
|
||||
|
||||
for (int i = 0; i < swell.RequiredHits; i++)
|
||||
{
|
||||
double frameTime = 1000 + i * 50;
|
||||
frames.Add(new TaikoReplayFrame(frameTime, i % 2 == 0 ? TaikoAction.LeftCentre : TaikoAction.LeftRim));
|
||||
frames.Add(new TaikoReplayFrame(frameTime + 10));
|
||||
}
|
||||
|
||||
PerformTest(frames, CreateBeatmap(swell));
|
||||
|
||||
AssertJudgementCount(11);
|
||||
|
||||
for (int i = 0; i < swell.RequiredHits; i++)
|
||||
AssertResult<SwellTick>(i, HitResult.IgnoreHit);
|
||||
|
||||
AssertResult<Swell>(0, HitResult.LargeBonus);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitSomeSwell()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
Swell swell = new Swell
|
||||
{
|
||||
StartTime = hit_time,
|
||||
Duration = 1000,
|
||||
RequiredHits = 10
|
||||
};
|
||||
|
||||
List<ReplayFrame> frames = new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(2001),
|
||||
};
|
||||
|
||||
for (int i = 0; i < swell.RequiredHits / 2; i++)
|
||||
{
|
||||
double frameTime = 1000 + i * 50;
|
||||
frames.Add(new TaikoReplayFrame(frameTime, i % 2 == 0 ? TaikoAction.LeftCentre : TaikoAction.LeftRim));
|
||||
frames.Add(new TaikoReplayFrame(frameTime + 10));
|
||||
}
|
||||
|
||||
PerformTest(frames, CreateBeatmap(swell));
|
||||
|
||||
AssertJudgementCount(11);
|
||||
|
||||
for (int i = 0; i < swell.RequiredHits / 2; i++)
|
||||
AssertResult<SwellTick>(i, HitResult.IgnoreHit);
|
||||
for (int i = swell.RequiredHits / 2; i < swell.RequiredHits; i++)
|
||||
AssertResult<SwellTick>(i, HitResult.IgnoreMiss);
|
||||
|
||||
AssertResult<Swell>(0, HitResult.IgnoreMiss);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHitNoneSwell()
|
||||
{
|
||||
const double hit_time = 1000;
|
||||
|
||||
Swell swell = new Swell
|
||||
{
|
||||
StartTime = hit_time,
|
||||
Duration = 1000,
|
||||
RequiredHits = 10
|
||||
};
|
||||
|
||||
List<ReplayFrame> frames = new List<ReplayFrame>
|
||||
{
|
||||
new TaikoReplayFrame(0),
|
||||
new TaikoReplayFrame(2001),
|
||||
};
|
||||
|
||||
PerformTest(frames, CreateBeatmap(swell));
|
||||
|
||||
AssertJudgementCount(11);
|
||||
|
||||
for (int i = 0; i < swell.RequiredHits; i++)
|
||||
AssertResult<SwellTick>(i, HitResult.IgnoreMiss);
|
||||
|
||||
AssertResult<Swell>(0, HitResult.IgnoreMiss);
|
||||
|
||||
AddAssert("all tick offsets are 0", () => JudgementResults.Where(r => r.HitObject is SwellTick).All(r => r.TimeOffset == 0));
|
||||
}
|
||||
}
|
||||
}
|
@ -25,11 +25,11 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
|
||||
|
||||
[TestCase(false)]
|
||||
[TestCase(true)]
|
||||
public void TestDrumRoll(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new DrumRoll { StartTime = 1000, EndTime = 3000 }), shouldMiss);
|
||||
public void TestDrumRoll(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new DrumRoll { StartTime = 1000, EndTime = 3000 }, false), shouldMiss);
|
||||
|
||||
[TestCase(false)]
|
||||
[TestCase(true)]
|
||||
public void TestSwell(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new Swell { StartTime = 1000, EndTime = 3000 }), shouldMiss);
|
||||
public void TestSwell(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new Swell { StartTime = 1000, EndTime = 3000 }, false), shouldMiss);
|
||||
|
||||
private class TestTaikoRuleset : TaikoRuleset
|
||||
{
|
||||
|
@ -112,7 +112,6 @@ namespace osu.Game.Rulesets.Taiko.Tests.Skinning
|
||||
|
||||
assertStateAfterResult(new JudgementResult(new Hit(), new TaikoJudgement()) { Type = HitResult.Great }, TaikoMascotAnimationState.Idle);
|
||||
assertStateAfterResult(new JudgementResult(new Hit(), new TaikoJudgement()) { Type = HitResult.Miss }, TaikoMascotAnimationState.Fail);
|
||||
assertStateAfterResult(new JudgementResult(new DrumRoll(), new TaikoDrumRollJudgement()) { Type = HitResult.Great }, TaikoMascotAnimationState.Idle);
|
||||
assertStateAfterResult(new JudgementResult(new Hit(), new TaikoJudgement()) { Type = HitResult.Ok }, TaikoMascotAnimationState.Idle);
|
||||
}
|
||||
|
||||
|
@ -1,38 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
public class TestSceneDrumRollJudgements : TestSceneTaikoPlayer
|
||||
{
|
||||
[Test]
|
||||
public void TestStrongDrumRollFullyJudgedOnKilled()
|
||||
{
|
||||
AddUntilStep("gameplay finished", () => Player.ScoreProcessor.HasCompleted.Value);
|
||||
AddAssert("all judgements are misses", () => Player.Results.All(r => r.Type == r.Judgement.MinResult));
|
||||
}
|
||||
|
||||
protected override bool Autoplay => false;
|
||||
|
||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new Beatmap<TaikoHitObject>
|
||||
{
|
||||
BeatmapInfo = { Ruleset = new TaikoRuleset().RulesetInfo },
|
||||
HitObjects =
|
||||
{
|
||||
new DrumRoll
|
||||
{
|
||||
StartTime = 1000,
|
||||
Duration = 1000,
|
||||
IsStrong = true
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
public class TestSceneSwellJudgements : TestSceneTaikoPlayer
|
||||
{
|
||||
[Test]
|
||||
public void TestZeroTickTimeOffsets()
|
||||
{
|
||||
AddUntilStep("gameplay finished", () => Player.ScoreProcessor.HasCompleted.Value);
|
||||
AddAssert("all tick offsets are 0", () => Player.Results.Where(r => r.HitObject is SwellTick).All(r => r.TimeOffset == 0));
|
||||
}
|
||||
|
||||
protected override bool Autoplay => true;
|
||||
|
||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
||||
{
|
||||
var beatmap = new Beatmap<TaikoHitObject>
|
||||
{
|
||||
BeatmapInfo = { Ruleset = new TaikoRuleset().RulesetInfo },
|
||||
HitObjects =
|
||||
{
|
||||
new Swell
|
||||
{
|
||||
StartTime = 1000,
|
||||
Duration = 1000,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return beatmap;
|
||||
}
|
||||
}
|
||||
}
|
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
};
|
||||
|
||||
[Test]
|
||||
public void TestSpinnerDoesFail()
|
||||
public void TestSwellDoesNotFail()
|
||||
{
|
||||
bool judged = false;
|
||||
AddStep("Setup judgements", () =>
|
||||
@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
Player.ScoreProcessor.NewJudgement += _ => judged = true;
|
||||
});
|
||||
AddUntilStep("swell judged", () => judged);
|
||||
AddAssert("failed", () => Player.GameplayState.HasFailed);
|
||||
AddAssert("not failed", () => !Player.GameplayState.HasFailed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
{
|
||||
private const double difficulty_multiplier = 1.35;
|
||||
|
||||
public override int Version => 20220701;
|
||||
public override int Version => 20220902;
|
||||
|
||||
public TaikoDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
|
||||
: base(ruleset, beatmap)
|
||||
|
@ -1,25 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Judgements
|
||||
{
|
||||
public class TaikoDrumRollJudgement : TaikoJudgement
|
||||
{
|
||||
protected override double HealthIncreaseFor(HitResult result)
|
||||
{
|
||||
// Drum rolls can be ignored with no health penalty
|
||||
switch (result)
|
||||
{
|
||||
case HitResult.Miss:
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return base.HealthIncreaseFor(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -9,18 +9,8 @@ namespace osu.Game.Rulesets.Taiko.Judgements
|
||||
{
|
||||
public class TaikoDrumRollTickJudgement : TaikoJudgement
|
||||
{
|
||||
public override HitResult MaxResult => HitResult.SmallTickHit;
|
||||
public override HitResult MaxResult => HitResult.SmallBonus;
|
||||
|
||||
protected override double HealthIncreaseFor(HitResult result)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case HitResult.SmallTickHit:
|
||||
return 0.15;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
protected override double HealthIncreaseFor(HitResult result) => 0;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Rulesets.Taiko.Judgements
|
||||
{
|
||||
public class TaikoStrongJudgement : TaikoJudgement
|
||||
{
|
||||
public override HitResult MaxResult => HitResult.SmallBonus;
|
||||
public override HitResult MaxResult => HitResult.LargeBonus;
|
||||
|
||||
// MainObject already changes the HP
|
||||
protected override double HealthIncreaseFor(HitResult result) => 0;
|
||||
|
@ -9,11 +9,13 @@ namespace osu.Game.Rulesets.Taiko.Judgements
|
||||
{
|
||||
public class TaikoSwellJudgement : TaikoJudgement
|
||||
{
|
||||
public override HitResult MaxResult => HitResult.LargeBonus;
|
||||
|
||||
protected override double HealthIncreaseFor(HitResult result)
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case HitResult.Miss:
|
||||
case HitResult.IgnoreMiss:
|
||||
return -0.65;
|
||||
|
||||
default:
|
||||
|
@ -4,7 +4,6 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Utils;
|
||||
@ -17,7 +16,6 @@ using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Skinning.Default;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
@ -43,6 +41,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
private Color4 colourIdle;
|
||||
private Color4 colourEngaged;
|
||||
|
||||
public override bool DisplayResult => false;
|
||||
|
||||
public DrawableDrumRoll()
|
||||
: this(null)
|
||||
{
|
||||
@ -143,14 +143,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
if (timeOffset < 0)
|
||||
return;
|
||||
|
||||
int countHit = NestedHitObjects.Count(o => o.IsHit);
|
||||
|
||||
if (countHit >= HitObject.RequiredGoodHits)
|
||||
{
|
||||
ApplyResult(r => r.Type = countHit >= HitObject.RequiredGreatHits ? HitResult.Great : HitResult.Ok);
|
||||
}
|
||||
else
|
||||
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
||||
ApplyResult(r => r.Type = r.Judgement.MaxResult);
|
||||
}
|
||||
|
||||
protected override void UpdateHitStateTransforms(ArmedState state)
|
||||
|
@ -16,7 +16,6 @@ using osuTK.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Skinning.Default;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
@ -39,6 +38,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
private readonly CircularContainer targetRing;
|
||||
private readonly CircularContainer expandingRing;
|
||||
|
||||
public override bool DisplayResult => false;
|
||||
|
||||
public DrawableSwell()
|
||||
: this(null)
|
||||
{
|
||||
@ -201,7 +202,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
expandingRing.ScaleTo(1f + Math.Min(target_ring_scale - 1f, (target_ring_scale - 1f) * completion * 1.3f), 260, Easing.OutQuint);
|
||||
|
||||
if (numHits == HitObject.RequiredHits)
|
||||
ApplyResult(r => r.Type = HitResult.Great);
|
||||
ApplyResult(r => r.Type = r.Judgement.MaxResult);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -222,7 +223,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
tick.TriggerResult(false);
|
||||
}
|
||||
|
||||
ApplyResult(r => r.Type = numHits > HitObject.RequiredHits / 2 ? HitResult.Ok : r.Judgement.MinResult);
|
||||
ApplyResult(r => r.Type = numHits == HitObject.RequiredHits ? r.Judgement.MaxResult : r.Judgement.MinResult);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
isProxied = true;
|
||||
|
||||
nonProxiedContent.Remove(Content);
|
||||
nonProxiedContent.Remove(Content, false);
|
||||
proxiedContent.Add(Content);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
isProxied = false;
|
||||
|
||||
proxiedContent.Remove(Content);
|
||||
proxiedContent.Remove(Content, false);
|
||||
nonProxiedContent.Add(Content);
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
Size = BaseSize = new Vector2(TaikoHitObject.DEFAULT_SIZE);
|
||||
|
||||
if (MainPiece != null)
|
||||
Content.Remove(MainPiece);
|
||||
Content.Remove(MainPiece, true);
|
||||
|
||||
Content.Add(MainPiece = CreateMainPiece());
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
#nullable disable
|
||||
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
@ -12,7 +11,6 @@ using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects
|
||||
@ -42,24 +40,12 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
/// </summary>
|
||||
public int TickRate = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Number of drum roll ticks required for a "Good" hit.
|
||||
/// </summary>
|
||||
public double RequiredGoodHits { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of drum roll ticks required for a "Great" hit.
|
||||
/// </summary>
|
||||
public double RequiredGreatHits { get; protected set; }
|
||||
|
||||
/// <summary>
|
||||
/// The length (in milliseconds) between ticks of this drumroll.
|
||||
/// <para>Half of this value is the hit window of the ticks.</para>
|
||||
/// </summary>
|
||||
private double tickSpacing = 100;
|
||||
|
||||
private float overallDifficulty = BeatmapDifficulty.DEFAULT_DIFFICULTY;
|
||||
|
||||
protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
|
||||
{
|
||||
base.ApplyDefaultsToSelf(controlPointInfo, difficulty);
|
||||
@ -70,16 +56,12 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
Velocity = scoringDistance / timingPoint.BeatLength;
|
||||
|
||||
tickSpacing = timingPoint.BeatLength / TickRate;
|
||||
overallDifficulty = difficulty.OverallDifficulty;
|
||||
}
|
||||
|
||||
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||
{
|
||||
createTicks(cancellationToken);
|
||||
|
||||
RequiredGoodHits = NestedHitObjects.Count * Math.Min(0.15, 0.05 + 0.10 / 6 * overallDifficulty);
|
||||
RequiredGreatHits = NestedHitObjects.Count * Math.Min(0.30, 0.10 + 0.20 / 6 * overallDifficulty);
|
||||
|
||||
base.CreateNestedHitObjects(cancellationToken);
|
||||
}
|
||||
|
||||
@ -106,7 +88,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
}
|
||||
}
|
||||
|
||||
public override Judgement CreateJudgement() => new TaikoDrumRollJudgement();
|
||||
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||
|
||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||
|
||||
@ -114,6 +96,8 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
|
||||
public class StrongNestedHit : StrongNestedHitObject
|
||||
{
|
||||
// The strong hit of the drum roll doesn't actually provide any score.
|
||||
public override Judgement CreateJudgement() => new IgnoreJudgement();
|
||||
}
|
||||
|
||||
#region LegacyBeatmapEncoder
|
||||
|
@ -199,11 +199,8 @@ namespace osu.Game.Rulesets.Taiko
|
||||
{
|
||||
switch (result)
|
||||
{
|
||||
case HitResult.SmallTickHit:
|
||||
return "drum tick";
|
||||
|
||||
case HitResult.SmallBonus:
|
||||
return "strong bonus";
|
||||
return "bonus";
|
||||
}
|
||||
|
||||
return base.GetDisplayNameForHitResult(result);
|
||||
|
@ -317,6 +317,9 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!result.Type.IsScorable())
|
||||
break;
|
||||
|
||||
judgementContainer.Add(judgementPools[result.Type].Get(j =>
|
||||
{
|
||||
j.Apply(result, judgedObject);
|
||||
|
@ -919,5 +919,30 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.That(controlPoints[1].Position, Is.Not.EqualTo(Vector2.Zero));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNaNControlPoints()
|
||||
{
|
||||
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
|
||||
|
||||
using (var resStream = TestResources.OpenResource("nan-control-points.osu"))
|
||||
using (var stream = new LineBufferedReader(resStream))
|
||||
{
|
||||
var controlPoints = (LegacyControlPointInfo)decoder.Decode(stream).ControlPointInfo;
|
||||
|
||||
Assert.That(controlPoints.TimingPoints.Count, Is.EqualTo(1));
|
||||
Assert.That(controlPoints.DifficultyPoints.Count, Is.EqualTo(2));
|
||||
|
||||
Assert.That(controlPoints.TimingPointAt(1000).BeatLength, Is.EqualTo(500));
|
||||
|
||||
Assert.That(controlPoints.DifficultyPointAt(2000).SliderVelocity, Is.EqualTo(1));
|
||||
Assert.That(controlPoints.DifficultyPointAt(3000).SliderVelocity, Is.EqualTo(1));
|
||||
|
||||
#pragma warning disable 618
|
||||
Assert.That(((LegacyBeatmapDecoder.LegacyDifficultyControlPoint)controlPoints.DifficultyPointAt(2000)).GenerateTicks, Is.False);
|
||||
Assert.That(((LegacyBeatmapDecoder.LegacyDifficultyControlPoint)controlPoints.DifficultyPointAt(3000)).GenerateTicks, Is.True);
|
||||
#pragma warning restore 618
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +67,24 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDecodeTaikoReplay()
|
||||
{
|
||||
var decoder = new TestLegacyScoreDecoder();
|
||||
|
||||
using (var resourceStream = TestResources.OpenResource("Replays/taiko-replay.osr"))
|
||||
{
|
||||
var score = decoder.Parse(resourceStream);
|
||||
|
||||
Assert.AreEqual(1, score.ScoreInfo.Ruleset.OnlineID);
|
||||
Assert.AreEqual(4, score.ScoreInfo.Statistics[HitResult.Great]);
|
||||
Assert.AreEqual(2, score.ScoreInfo.Statistics[HitResult.LargeBonus]);
|
||||
Assert.AreEqual(4, score.ScoreInfo.MaxCombo);
|
||||
|
||||
Assert.That(score.Replay.Frames, Is.Not.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(3, true)]
|
||||
[TestCase(6, false)]
|
||||
[TestCase(LegacyBeatmapDecoder.LATEST_VERSION, false)]
|
||||
|
@ -117,6 +117,26 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEarliestStartTimeWithLoopAlphas()
|
||||
{
|
||||
var decoder = new LegacyStoryboardDecoder();
|
||||
|
||||
using (var resStream = TestResources.OpenResource("loop-containing-earlier-non-zero-fade.osb"))
|
||||
using (var stream = new LineBufferedReader(resStream))
|
||||
{
|
||||
var storyboard = decoder.Decode(stream);
|
||||
|
||||
StoryboardLayer background = storyboard.Layers.Single(l => l.Depth == 3);
|
||||
Assert.AreEqual(2, background.Elements.Count);
|
||||
|
||||
Assert.AreEqual(1000, background.Elements[0].StartTime);
|
||||
Assert.AreEqual(1000, background.Elements[1].StartTime);
|
||||
|
||||
Assert.AreEqual(1000, storyboard.EarliestEventTime);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDecodeVariableWithSuffix()
|
||||
{
|
||||
|
@ -14,7 +14,12 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
public class ParsingTest
|
||||
{
|
||||
[Test]
|
||||
public void TestNaNHandling() => allThrow<FormatException>("NaN");
|
||||
public void TestNaNHandling()
|
||||
{
|
||||
allThrow<FormatException>("NaN");
|
||||
Assert.That(Parsing.ParseFloat("NaN", allowNaN: true), Is.NaN);
|
||||
Assert.That(Parsing.ParseDouble("NaN", allowNaN: true), Is.NaN);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBadStringHandling() => allThrow<FormatException>("Random string 123");
|
||||
|
@ -7,10 +7,12 @@ using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Edit.Checks;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Tests.Editing.Checks
|
||||
{
|
||||
@ -109,7 +111,7 @@ namespace osu.Game.Tests.Editing.Checks
|
||||
/// <param name="audioBitrate">The bitrate of the audio file the beatmap uses.</param>
|
||||
private Mock<IWorkingBeatmap> getMockWorkingBeatmap(int? audioBitrate)
|
||||
{
|
||||
var mockTrack = new Mock<Track>();
|
||||
var mockTrack = new Mock<OsuTestScene.ClockBackedTestWorkingBeatmap.TrackVirtualManual>(new FramedClock(), "virtual");
|
||||
mockTrack.SetupGet(t => t.Bitrate).Returns(audioBitrate);
|
||||
|
||||
var mockWorkingBeatmap = new Mock<IWorkingBeatmap>();
|
||||
|
@ -1,8 +1,9 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
@ -13,21 +14,20 @@ namespace osu.Game.Tests.NonVisual
|
||||
{
|
||||
[TestCase(0)]
|
||||
[TestCase(1)]
|
||||
public void TestTrueGameplayRateWithZeroAdjustment(double underlyingClockRate)
|
||||
public void TestTrueGameplayRateWithGameplayAdjustment(double underlyingClockRate)
|
||||
{
|
||||
var framedClock = new FramedClock(new ManualClock { Rate = underlyingClockRate });
|
||||
var gameplayClock = new TestGameplayClockContainer(framedClock);
|
||||
|
||||
Assert.That(gameplayClock.TrueGameplayRate, Is.EqualTo(0));
|
||||
Assert.That(gameplayClock.GetTrueGameplayRate(), Is.EqualTo(2));
|
||||
}
|
||||
|
||||
private class TestGameplayClockContainer : GameplayClockContainer
|
||||
{
|
||||
public override IEnumerable<double> NonGameplayAdjustments => new[] { 0.0 };
|
||||
|
||||
public TestGameplayClockContainer(IFrameBasedClock underlyingClock)
|
||||
: base(underlyingClock)
|
||||
{
|
||||
AdjustmentsFromMods.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(2.0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
osu.Game.Tests/Resources/Replays/taiko-replay.osr
Normal file
BIN
osu.Game.Tests/Resources/Replays/taiko-replay.osr
Normal file
Binary file not shown.
@ -0,0 +1,14 @@
|
||||
osu file format v14
|
||||
|
||||
[Events]
|
||||
//Storyboard Layer 0 (Background)
|
||||
Sprite,Background,TopCentre,"img.jpg",320,240
|
||||
L,1000,1
|
||||
F,0,0,,1 // fade inside a loop with non-zero alpha and an earlier start time should be the true start time..
|
||||
F,0,2000,,0 // ..not a zero alpha fade with a later start time
|
||||
|
||||
Sprite,Background,TopCentre,"img.jpg",320,240
|
||||
L,2000,1
|
||||
F,0,0,24,0 // fade inside a loop with zero alpha but later start time than the top-level zero alpha start time.
|
||||
F,0,24,48,1
|
||||
F,0,1000,,1 // ..so this should be the true start time
|
15
osu.Game.Tests/Resources/nan-control-points.osu
Normal file
15
osu.Game.Tests/Resources/nan-control-points.osu
Normal file
@ -0,0 +1,15 @@
|
||||
osu file format v14
|
||||
|
||||
[TimingPoints]
|
||||
|
||||
// NaN bpm (should be rejected)
|
||||
0,NaN,4,2,0,100,1,0
|
||||
|
||||
// 120 bpm
|
||||
1000,500,4,2,0,100,1,0
|
||||
|
||||
// NaN slider velocity
|
||||
2000,NaN,4,3,0,100,0,1
|
||||
|
||||
// 1.0x slider velocity
|
||||
3000,-100,4,3,0,100,0,1
|
@ -171,7 +171,7 @@ namespace osu.Game.Tests.Visual.Background
|
||||
=> AddStep("create loader", () =>
|
||||
{
|
||||
if (backgroundLoader != null)
|
||||
Remove(backgroundLoader);
|
||||
Remove(backgroundLoader, true);
|
||||
|
||||
Add(backgroundLoader = new SeasonalBackgroundLoader());
|
||||
});
|
||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables.Cards.Buttons;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Online;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
@ -58,6 +59,7 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
State = { Value = DownloadState.NotDownloaded },
|
||||
Scale = new Vector2(2)
|
||||
};
|
||||
});
|
||||
|
@ -9,6 +9,7 @@ using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
@ -34,9 +35,11 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
var beatmap = new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo }
|
||||
BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo },
|
||||
};
|
||||
|
||||
beatmap.ControlPointInfo.Add(0, new TimingControlPoint());
|
||||
|
||||
editorBeatmap = new EditorBeatmap(beatmap, new LegacyBeatmapSkin(beatmap.BeatmapInfo, null));
|
||||
|
||||
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
|
||||
@ -50,7 +53,11 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
(typeof(IBeatSnapProvider), editorBeatmap),
|
||||
(typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Green)),
|
||||
},
|
||||
Child = new ComposeScreen { State = { Value = Visibility.Visible } },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
editorBeatmap,
|
||||
new ComposeScreen { State = { Value = Visibility.Visible } },
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
85
osu.Game.Tests/Visual/Editing/TestSceneDifficultyDelete.cs
Normal file
85
osu.Game.Tests/Visual/Editing/TestSceneDifficultyDelete.cs
Normal file
@ -0,0 +1,85 @@
|
||||
// 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;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Storyboards;
|
||||
using osu.Game.Tests.Beatmaps.IO;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
public class TestSceneDifficultyDelete : EditorTestScene
|
||||
{
|
||||
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||
protected override bool IsolateSavingFromDatabase => false;
|
||||
|
||||
[Resolved]
|
||||
private OsuGameBase game { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; } = null!;
|
||||
|
||||
private BeatmapSetInfo importedBeatmapSet = null!;
|
||||
|
||||
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null!)
|
||||
=> beatmaps.GetWorkingBeatmap(importedBeatmapSet.Beatmaps.First());
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
AddStep("import test beatmap", () => importedBeatmapSet = BeatmapImportHelper.LoadOszIntoOsu(game, virtualTrack: true).GetResultSafely());
|
||||
base.SetUpSteps();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeleteDifficulties()
|
||||
{
|
||||
Guid deletedDifficultyID = Guid.Empty;
|
||||
int countBeforeDeletion = 0;
|
||||
string beatmapSetHashBefore = string.Empty;
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
// Will be reloaded after each deletion.
|
||||
AddUntilStep("wait for editor to load", () => Editor?.ReadyForUse == true);
|
||||
|
||||
AddStep("store selected difficulty", () =>
|
||||
{
|
||||
deletedDifficultyID = EditorBeatmap.BeatmapInfo.ID;
|
||||
countBeforeDeletion = Beatmap.Value.BeatmapSetInfo.Beatmaps.Count;
|
||||
beatmapSetHashBefore = Beatmap.Value.BeatmapSetInfo.Hash;
|
||||
});
|
||||
|
||||
AddStep("click File", () => this.ChildrenOfType<DrawableOsuMenuItem>().First().TriggerClick());
|
||||
|
||||
if (i == 11)
|
||||
{
|
||||
// last difficulty shouldn't be able to be deleted.
|
||||
AddAssert("Delete menu item disabled", () => getDeleteMenuItem().Item.Action.Disabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddStep("click delete", () => getDeleteMenuItem().TriggerClick());
|
||||
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog != null);
|
||||
AddStep("confirm", () => InputManager.Key(Key.Number1));
|
||||
|
||||
AddAssert($"difficulty {i} is deleted", () => Beatmap.Value.BeatmapSetInfo.Beatmaps.Select(b => b.ID), () => Does.Not.Contain(deletedDifficultyID));
|
||||
AddAssert("count decreased by one", () => Beatmap.Value.BeatmapSetInfo.Beatmaps.Count, () => Is.EqualTo(countBeforeDeletion - 1));
|
||||
AddAssert("set hash changed", () => Beatmap.Value.BeatmapSetInfo.Hash, () => Is.Not.EqualTo(beatmapSetHashBefore));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DrawableOsuMenuItem getDeleteMenuItem() => this.ChildrenOfType<DrawableOsuMenuItem>()
|
||||
.Single(item => item.ChildrenOfType<SpriteText>().Any(text => text.Text.ToString().StartsWith("Delete", StringComparison.Ordinal)));
|
||||
}
|
||||
}
|
@ -87,7 +87,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
Add(expectedComponentsAdjustmentContainer);
|
||||
expectedComponentsAdjustmentContainer.UpdateSubTree();
|
||||
var expectedInfo = expectedComponentsContainer.CreateSkinnableInfo();
|
||||
Remove(expectedComponentsAdjustmentContainer);
|
||||
Remove(expectedComponentsAdjustmentContainer, true);
|
||||
|
||||
return almostEqual(actualInfo, expectedInfo);
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
@ -73,6 +71,18 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddAssert("origin flipped", () => sprites.All(s => s.Origin == Anchor.BottomRight));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestZeroScale()
|
||||
{
|
||||
const string lookup_name = "hitcircleoverlay";
|
||||
|
||||
AddStep("allow skin lookup", () => storyboard.UseSkinSprites = true);
|
||||
AddStep("create sprites", () => SetContents(_ => createSprite(lookup_name, Anchor.TopLeft, Vector2.Zero)));
|
||||
AddAssert("sprites present", () => sprites.All(s => s.IsPresent));
|
||||
AddStep("scale sprite", () => sprites.ForEach(s => s.VectorScale = new Vector2(0, 1)));
|
||||
AddAssert("sprites not present", () => sprites.All(s => !s.IsPresent));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNegativeScale()
|
||||
{
|
||||
|
@ -66,18 +66,20 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[TestCase(-10000, -10000, true)]
|
||||
public void TestStoryboardProducesCorrectStartTimeFadeInAfterOtherEvents(double firstStoryboardEvent, double expectedStartTime, bool addEventToLoop)
|
||||
{
|
||||
const double loop_start_time = -20000;
|
||||
|
||||
var storyboard = new Storyboard();
|
||||
|
||||
var sprite = new StoryboardSprite("unknown", Anchor.TopLeft, Vector2.Zero);
|
||||
|
||||
// these should be ignored as we have an alpha visibility blocker proceeding this command.
|
||||
sprite.TimelineGroup.Scale.Add(Easing.None, -20000, -18000, 0, 1);
|
||||
var loopGroup = sprite.AddLoop(-20000, 50);
|
||||
loopGroup.Scale.Add(Easing.None, -20000, -18000, 0, 1);
|
||||
sprite.TimelineGroup.Scale.Add(Easing.None, loop_start_time, -18000, 0, 1);
|
||||
var loopGroup = sprite.AddLoop(loop_start_time, 50);
|
||||
loopGroup.Scale.Add(Easing.None, loop_start_time, -18000, 0, 1);
|
||||
|
||||
var target = addEventToLoop ? loopGroup : sprite.TimelineGroup;
|
||||
double targetTime = addEventToLoop ? 20000 : 0;
|
||||
target.Alpha.Add(Easing.None, targetTime + firstStoryboardEvent, targetTime + firstStoryboardEvent + 500, 0, 1);
|
||||
double loopRelativeOffset = addEventToLoop ? -loop_start_time : 0;
|
||||
target.Alpha.Add(Easing.None, loopRelativeOffset + firstStoryboardEvent, loopRelativeOffset + firstStoryboardEvent + 500, 0, 1);
|
||||
|
||||
// these should be ignored due to being in the future.
|
||||
sprite.TimelineGroup.Alpha.Add(Easing.None, 18000, 20000, 0, 1);
|
||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
Player.OnUpdate += _ =>
|
||||
{
|
||||
double currentTime = Player.GameplayClockContainer.CurrentTime;
|
||||
alwaysGoingForward &= currentTime >= lastTime;
|
||||
alwaysGoingForward &= currentTime >= lastTime - 500;
|
||||
lastTime = currentTime;
|
||||
};
|
||||
});
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
resumeAndConfirm();
|
||||
|
||||
AddAssert("time didn't go backwards", () => alwaysGoingForward);
|
||||
AddAssert("time didn't go too far backwards", () => alwaysGoingForward);
|
||||
|
||||
AddStep("reset offset", () => LocalConfig.SetValue(OsuSetting.AudioOffset, 0.0));
|
||||
}
|
||||
@ -90,6 +90,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddAssert("player not playing", () => !Player.LocalUserPlaying.Value);
|
||||
|
||||
resumeAndConfirm();
|
||||
|
||||
AddAssert("Resumed without seeking forward", () => Player.LastResumeTime, () => Is.LessThanOrEqualTo(Player.LastPauseTime));
|
||||
|
||||
AddUntilStep("player playing", () => Player.LocalUserPlaying.Value);
|
||||
}
|
||||
|
||||
@ -367,7 +370,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
private void confirmNoTrackAdjustments()
|
||||
{
|
||||
AddAssert("track has no adjustments", () => Beatmap.Value.Track.AggregateFrequency.Value == 1);
|
||||
AddUntilStep("track has no adjustments", () => Beatmap.Value.Track.AggregateFrequency.Value, () => Is.EqualTo(1));
|
||||
}
|
||||
|
||||
private void restart() => AddStep("restart", () => Player.Restart());
|
||||
@ -378,7 +381,16 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddAssert("pause overlay " + (isShown ? "shown" : "hidden"), () => Player.PauseOverlayVisible == isShown);
|
||||
|
||||
private void confirmClockRunning(bool isRunning) =>
|
||||
AddUntilStep("clock " + (isRunning ? "running" : "stopped"), () => Player.GameplayClockContainer.IsRunning == isRunning);
|
||||
AddUntilStep("clock " + (isRunning ? "running" : "stopped"), () =>
|
||||
{
|
||||
bool completed = Player.GameplayClockContainer.IsRunning == isRunning;
|
||||
|
||||
if (completed)
|
||||
{
|
||||
}
|
||||
|
||||
return completed;
|
||||
});
|
||||
|
||||
protected override bool AllowFail => true;
|
||||
|
||||
@ -386,6 +398,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
protected class PausePlayer : TestPlayer
|
||||
{
|
||||
public double LastPauseTime { get; private set; }
|
||||
public double LastResumeTime { get; private set; }
|
||||
|
||||
public bool FailOverlayVisible => FailOverlay.State.Value == Visibility.Visible;
|
||||
|
||||
public bool PauseOverlayVisible => PauseOverlay.State.Value == Visibility.Visible;
|
||||
@ -399,6 +414,23 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
base.OnEntering(e);
|
||||
GameplayClockContainer.Stop();
|
||||
}
|
||||
|
||||
private bool? isRunning;
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
if (GameplayClockContainer.IsRunning != isRunning)
|
||||
{
|
||||
isRunning = GameplayClockContainer.IsRunning;
|
||||
|
||||
if (isRunning.Value)
|
||||
LastResumeTime = GameplayClockContainer.CurrentTime;
|
||||
else
|
||||
LastPauseTime = GameplayClockContainer.CurrentTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,11 +14,10 @@ using osu.Framework.Audio;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
@ -30,7 +29,6 @@ using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Play.PlayerSettings;
|
||||
using osu.Game.Utils;
|
||||
using osuTK.Input;
|
||||
using SkipOverlay = osu.Game.Screens.Play.SkipOverlay;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
@ -83,6 +81,20 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() => player = null);
|
||||
|
||||
[SetUpSteps]
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("read all notifications", () =>
|
||||
{
|
||||
notificationOverlay.Show();
|
||||
notificationOverlay.Hide();
|
||||
});
|
||||
|
||||
AddUntilStep("wait for no notifications", () => notificationOverlay.UnreadCount.Value, () => Is.EqualTo(0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the input manager child to a new test player loader container instance.
|
||||
/// </summary>
|
||||
@ -287,16 +299,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
saveVolumes();
|
||||
|
||||
AddAssert("check for notification", () => notificationOverlay.UnreadCount.Value == 1);
|
||||
AddStep("click notification", () =>
|
||||
{
|
||||
var scrollContainer = (OsuScrollContainer)notificationOverlay.Children.Last();
|
||||
var flowContainer = scrollContainer.Children.OfType<FillFlowContainer<NotificationSection>>().First();
|
||||
var notification = flowContainer.First();
|
||||
AddAssert("check for notification", () => notificationOverlay.UnreadCount.Value, () => Is.EqualTo(1));
|
||||
|
||||
InputManager.MoveMouseTo(notification);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
clickNotification();
|
||||
|
||||
AddAssert("check " + volumeName, assert);
|
||||
|
||||
@ -365,16 +370,12 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
batteryInfo.SetChargeLevel(chargeLevel);
|
||||
}));
|
||||
AddUntilStep("wait for player", () => player?.LoadState == LoadState.Ready);
|
||||
AddAssert($"notification {(shouldWarn ? "triggered" : "not triggered")}", () => notificationOverlay.UnreadCount.Value == (shouldWarn ? 1 : 0));
|
||||
AddStep("click notification", () =>
|
||||
{
|
||||
var scrollContainer = (OsuScrollContainer)notificationOverlay.Children.Last();
|
||||
var flowContainer = scrollContainer.Children.OfType<FillFlowContainer<NotificationSection>>().First();
|
||||
var notification = flowContainer.First();
|
||||
|
||||
InputManager.MoveMouseTo(notification);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
if (shouldWarn)
|
||||
clickNotification();
|
||||
else
|
||||
AddAssert("notification not triggered", () => notificationOverlay.UnreadCount.Value == 0);
|
||||
|
||||
AddUntilStep("wait for player load", () => player.IsLoaded);
|
||||
}
|
||||
|
||||
@ -439,6 +440,15 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddUntilStep("skip button not visible", () => !checkSkipButtonVisible());
|
||||
}
|
||||
|
||||
private void clickNotification()
|
||||
{
|
||||
Notification notification = null;
|
||||
|
||||
AddUntilStep("wait for notification", () => (notification = notificationOverlay.ChildrenOfType<Notification>().FirstOrDefault()) != null);
|
||||
AddStep("open notification overlay", () => notificationOverlay.Show());
|
||||
AddStep("click notification", () => notification.TriggerClick());
|
||||
}
|
||||
|
||||
private EpilepsyWarning getWarning() => loader.ChildrenOfType<EpilepsyWarning>().SingleOrDefault();
|
||||
|
||||
private class TestPlayerLoader : PlayerLoader
|
||||
|
@ -81,9 +81,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
CreateTest();
|
||||
|
||||
AddUntilStep("fail screen displayed", () => Player.ChildrenOfType<FailOverlay>().First().State.Value == Visibility.Visible);
|
||||
AddUntilStep("wait for button clickable", () => Player.ChildrenOfType<SaveFailedScoreButton>().First().ChildrenOfType<OsuClickableContainer>().First().Enabled.Value);
|
||||
|
||||
AddUntilStep("score not in database", () => Realm.Run(r => r.Find<ScoreInfo>(Player.Score.ScoreInfo.ID) == null));
|
||||
AddStep("click save button", () => Player.ChildrenOfType<SaveFailedScoreButton>().First().ChildrenOfType<OsuClickableContainer>().First().TriggerClick());
|
||||
AddUntilStep("score not in database", () => Realm.Run(r => r.Find<ScoreInfo>(Player.Score.ScoreInfo.ID) != null));
|
||||
AddUntilStep("score in database", () => Realm.Run(r => r.Find<ScoreInfo>(Player.Score.ScoreInfo.ID) != null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -202,7 +202,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
||||
|
||||
AddAssert("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
|
||||
AddAssert("state is unknown", () => downloadButton.State.Value == DownloadState.Unknown);
|
||||
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
base.TearDownSteps();
|
||||
AddStep("stop watching user", () => spectatorClient.StopWatchingUser(dummy_user_id));
|
||||
AddStep("remove test spectator client", () => Remove(spectatorClient));
|
||||
AddStep("remove test spectator client", () => Remove(spectatorClient, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -24,8 +22,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[TestFixture]
|
||||
public class TestSceneStoryboard : OsuTestScene
|
||||
{
|
||||
private Container<DrawableStoryboard> storyboardContainer;
|
||||
private DrawableStoryboard storyboard;
|
||||
private Container<DrawableStoryboard> storyboardContainer = null!;
|
||||
|
||||
private DrawableStoryboard? storyboard;
|
||||
|
||||
[Test]
|
||||
public void TestStoryboard()
|
||||
@ -40,7 +39,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
[Test]
|
||||
public void TestStoryboardMissingVideo()
|
||||
{
|
||||
AddStep("Load storyboard with missing video", loadStoryboardNoVideo);
|
||||
AddStep("Load storyboard with missing video", () => loadStoryboard("storyboard_no_video.osu"));
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -77,53 +76,44 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
Beatmap.BindValueChanged(beatmapChanged, true);
|
||||
}
|
||||
|
||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> e) => loadStoryboard(e.NewValue);
|
||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> e) => loadStoryboard(e.NewValue.Storyboard);
|
||||
|
||||
private void restart()
|
||||
{
|
||||
var track = Beatmap.Value.Track;
|
||||
|
||||
track.Reset();
|
||||
loadStoryboard(Beatmap.Value);
|
||||
loadStoryboard(Beatmap.Value.Storyboard);
|
||||
track.Start();
|
||||
}
|
||||
|
||||
private void loadStoryboard(IWorkingBeatmap working)
|
||||
private void loadStoryboard(Storyboard toLoad)
|
||||
{
|
||||
if (storyboard != null)
|
||||
storyboardContainer.Remove(storyboard);
|
||||
storyboardContainer.Remove(storyboard, true);
|
||||
|
||||
var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true };
|
||||
storyboardContainer.Clock = decoupledClock;
|
||||
|
||||
storyboard = working.Storyboard.CreateDrawable(SelectedMods.Value);
|
||||
storyboard = toLoad.CreateDrawable(SelectedMods.Value);
|
||||
storyboard.Passing = false;
|
||||
|
||||
storyboardContainer.Add(storyboard);
|
||||
decoupledClock.ChangeSource(working.Track);
|
||||
}
|
||||
|
||||
private void loadStoryboardNoVideo()
|
||||
{
|
||||
if (storyboard != null)
|
||||
storyboardContainer.Remove(storyboard);
|
||||
|
||||
var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true };
|
||||
storyboardContainer.Clock = decoupledClock;
|
||||
|
||||
Storyboard sb;
|
||||
|
||||
using (var str = TestResources.OpenResource("storyboard_no_video.osu"))
|
||||
using (var bfr = new LineBufferedReader(str))
|
||||
{
|
||||
var decoder = new LegacyStoryboardDecoder();
|
||||
sb = decoder.Decode(bfr);
|
||||
}
|
||||
|
||||
storyboard = sb.CreateDrawable(SelectedMods.Value);
|
||||
|
||||
storyboardContainer.Add(storyboard);
|
||||
decoupledClock.ChangeSource(Beatmap.Value.Track);
|
||||
}
|
||||
|
||||
private void loadStoryboard(string filename)
|
||||
{
|
||||
Storyboard loaded;
|
||||
|
||||
using (var str = TestResources.OpenResource(filename))
|
||||
using (var bfr = new LineBufferedReader(str))
|
||||
{
|
||||
var decoder = new LegacyStoryboardDecoder();
|
||||
loaded = decoder.Decode(bfr);
|
||||
}
|
||||
|
||||
loadStoryboard(loaded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
},
|
||||
notifications = new NotificationOverlay
|
||||
{
|
||||
Depth = float.MinValue,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
}
|
||||
@ -82,7 +83,14 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
[Test]
|
||||
public virtual void TestPlayIntroWithFailingAudioDevice()
|
||||
{
|
||||
AddStep("hide notifications", () => notifications.Hide());
|
||||
AddStep("reset notifications", () =>
|
||||
{
|
||||
notifications.Show();
|
||||
notifications.Hide();
|
||||
});
|
||||
|
||||
AddUntilStep("wait for no notifications", () => notifications.UnreadCount.Value, () => Is.EqualTo(0));
|
||||
|
||||
AddStep("restart sequence", () =>
|
||||
{
|
||||
logo.FinishTransforms();
|
||||
|
@ -62,8 +62,8 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
Remove(nowPlayingOverlay);
|
||||
Remove(volumeOverlay);
|
||||
Remove(nowPlayingOverlay, false);
|
||||
Remove(volumeOverlay, false);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -91,8 +91,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
break;
|
||||
|
||||
case StopCountdownRequest:
|
||||
multiplayerRoom.Countdown = null;
|
||||
raiseRoomUpdated();
|
||||
clearRoomCountdown();
|
||||
break;
|
||||
}
|
||||
});
|
||||
@ -244,14 +243,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
});
|
||||
|
||||
AddStep("start countdown", () => multiplayerClient.Object.SendMatchRequest(new StartMatchCountdownRequest { Duration = TimeSpan.FromMinutes(1) }).WaitSafely());
|
||||
AddUntilStep("countdown started", () => multiplayerRoom.Countdown != null);
|
||||
AddUntilStep("countdown started", () => multiplayerRoom.ActiveCountdowns.Any());
|
||||
|
||||
AddStep("transfer host to local user", () => transferHost(localUser));
|
||||
AddUntilStep("local user is host", () => multiplayerRoom.Host?.Equals(multiplayerClient.Object.LocalUser) == true);
|
||||
|
||||
ClickButtonWhenEnabled<MultiplayerReadyButton>();
|
||||
checkLocalUserState(MultiplayerUserState.Ready);
|
||||
AddAssert("countdown still active", () => multiplayerRoom.Countdown != null);
|
||||
AddAssert("countdown still active", () => multiplayerRoom.ActiveCountdowns.Any());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -392,7 +391,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
private void setRoomCountdown(TimeSpan duration)
|
||||
{
|
||||
multiplayerRoom.Countdown = new MatchStartCountdown { TimeRemaining = duration };
|
||||
multiplayerRoom.ActiveCountdowns.Add(new MatchStartCountdown { TimeRemaining = duration });
|
||||
raiseRoomUpdated();
|
||||
}
|
||||
|
||||
private void clearRoomCountdown()
|
||||
{
|
||||
multiplayerRoom.ActiveCountdowns.Clear();
|
||||
raiseRoomUpdated();
|
||||
}
|
||||
|
||||
|
@ -13,9 +13,11 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.OnlinePlay.Multiplayer.Spectate;
|
||||
using osu.Game.Screens.Play;
|
||||
@ -332,6 +334,18 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddUntilStep("player 2 playing from correct point in time", () => getPlayer(PLAYER_2_ID).ChildrenOfType<DrawableRuleset>().Single().FrameStableClock.CurrentTime > 30000);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGameplayRateAdjust()
|
||||
{
|
||||
start(getPlayerIds(4), mods: new[] { new APIMod(new OsuModDoubleTime()) });
|
||||
|
||||
loadSpectateScreen();
|
||||
|
||||
sendFrames(getPlayerIds(4), 300);
|
||||
|
||||
AddUntilStep("wait for correct track speed", () => Beatmap.Value.Track.Rate, () => Is.EqualTo(1.5));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPlayersLeaveWhileSpectating()
|
||||
{
|
||||
@ -420,7 +434,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
private void start(int userId, int? beatmapId = null) => start(new[] { userId }, beatmapId);
|
||||
|
||||
private void start(int[] userIds, int? beatmapId = null)
|
||||
private void start(int[] userIds, int? beatmapId = null, APIMod[]? mods = null)
|
||||
{
|
||||
AddStep("start play", () =>
|
||||
{
|
||||
@ -429,10 +443,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
var user = new MultiplayerRoomUser(id)
|
||||
{
|
||||
User = new APIUser { Id = id },
|
||||
Mods = mods ?? Array.Empty<APIMod>(),
|
||||
};
|
||||
|
||||
OnlinePlayDependencies.MultiplayerClient.AddUser(user.User, true);
|
||||
SpectatorClient.SendStartPlay(id, beatmapId ?? importedBeatmapId);
|
||||
OnlinePlayDependencies.MultiplayerClient.AddUser(user, true);
|
||||
SpectatorClient.SendStartPlay(id, beatmapId ?? importedBeatmapId, mods);
|
||||
|
||||
playingUsers.Add(user);
|
||||
}
|
||||
|
@ -26,16 +26,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
public void TestImportantNotificationDoesntInterruptSetup()
|
||||
{
|
||||
AddStep("post important notification", () => Game.Notifications.Post(new SimpleNotification { Text = "Important notification" }));
|
||||
AddAssert("no notification posted", () => Game.Notifications.UnreadCount.Value == 0);
|
||||
AddAssert("first-run setup still visible", () => Game.FirstRunOverlay.State.Value == Visibility.Visible);
|
||||
|
||||
AddUntilStep("finish first-run setup", () =>
|
||||
{
|
||||
Game.FirstRunOverlay.NextButton.TriggerClick();
|
||||
return Game.FirstRunOverlay.State.Value == Visibility.Hidden;
|
||||
});
|
||||
AddWaitStep("wait for post delay", 5);
|
||||
AddAssert("notifications shown", () => Game.Notifications.State.Value == Visibility.Visible);
|
||||
AddAssert("notification posted", () => Game.Notifications.UnreadCount.Value == 1);
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Testing;
|
||||
@ -13,7 +11,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
{
|
||||
public class TestSceneStartupImport : OsuGameTestScene
|
||||
{
|
||||
private string importFilename;
|
||||
private string? importFilename;
|
||||
|
||||
protected override TestOsuGame CreateTestGame() => new TestOsuGame(LocalStorage, API, new[] { importFilename });
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
|
||||
AddStep("force save config", () => Game.LocalConfig.Save());
|
||||
|
||||
AddStep("remove game", () => Remove(Game));
|
||||
AddStep("remove game", () => Remove(Game, true));
|
||||
|
||||
AddStep("create game again", CreateGame);
|
||||
|
||||
|
@ -60,7 +60,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
if (selected.Text == mod.Acronym)
|
||||
{
|
||||
selectedMods.Remove(selected);
|
||||
selectedMods.Remove(selected, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -20,7 +18,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
||||
{
|
||||
public class TestSceneHitEventTimingDistributionGraph : OsuTestScene
|
||||
{
|
||||
private HitEventTimingDistributionGraph graph;
|
||||
private HitEventTimingDistributionGraph graph = null!;
|
||||
|
||||
private static readonly HitObject placeholder_object = new HitCircle();
|
||||
|
||||
@ -43,6 +41,65 @@ namespace osu.Game.Tests.Visual.Ranking
|
||||
createTest(Enumerable.Range(-150, 300).Select(i => new HitEvent(i / 50f, HitResult.Perfect, placeholder_object, placeholder_object, null)).ToList());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSparse()
|
||||
{
|
||||
createTest(new List<HitEvent>
|
||||
{
|
||||
new HitEvent(-7, HitResult.Perfect, placeholder_object, placeholder_object, null),
|
||||
new HitEvent(-6, HitResult.Perfect, placeholder_object, placeholder_object, null),
|
||||
new HitEvent(-5, HitResult.Perfect, placeholder_object, placeholder_object, null),
|
||||
new HitEvent(5, HitResult.Perfect, placeholder_object, placeholder_object, null),
|
||||
new HitEvent(6, HitResult.Perfect, placeholder_object, placeholder_object, null),
|
||||
new HitEvent(7, HitResult.Perfect, placeholder_object, placeholder_object, null),
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestVariousTypesOfHitResult()
|
||||
{
|
||||
createTest(CreateDistributedHitEvents(0, 50).Select(h =>
|
||||
{
|
||||
double offset = Math.Abs(h.TimeOffset);
|
||||
HitResult result = offset > 36 ? HitResult.Miss
|
||||
: offset > 32 ? HitResult.Meh
|
||||
: offset > 24 ? HitResult.Ok
|
||||
: offset > 16 ? HitResult.Good
|
||||
: offset > 8 ? HitResult.Great
|
||||
: HitResult.Perfect;
|
||||
return new HitEvent(h.TimeOffset, result, placeholder_object, placeholder_object, null);
|
||||
}).ToList());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMultipleWindowsOfHitResult()
|
||||
{
|
||||
var wide = CreateDistributedHitEvents(0, 50).Select(h =>
|
||||
{
|
||||
double offset = Math.Abs(h.TimeOffset);
|
||||
HitResult result = offset > 36 ? HitResult.Miss
|
||||
: offset > 32 ? HitResult.Meh
|
||||
: offset > 24 ? HitResult.Ok
|
||||
: offset > 16 ? HitResult.Good
|
||||
: offset > 8 ? HitResult.Great
|
||||
: HitResult.Perfect;
|
||||
|
||||
return new HitEvent(h.TimeOffset, result, placeholder_object, placeholder_object, null);
|
||||
});
|
||||
var narrow = CreateDistributedHitEvents(0, 50).Select(h =>
|
||||
{
|
||||
double offset = Math.Abs(h.TimeOffset);
|
||||
HitResult result = offset > 25 ? HitResult.Miss
|
||||
: offset > 20 ? HitResult.Meh
|
||||
: offset > 15 ? HitResult.Ok
|
||||
: offset > 10 ? HitResult.Good
|
||||
: offset > 5 ? HitResult.Great
|
||||
: HitResult.Perfect;
|
||||
return new HitEvent(h.TimeOffset, result, placeholder_object, placeholder_object, null);
|
||||
});
|
||||
createTest(wide.Concat(narrow).ToList());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestZeroTimeOffset()
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
if (isIterating)
|
||||
AddUntilStep("selection changed", () => !carousel.SelectedBeatmapInfo?.Equals(selection) == true);
|
||||
else
|
||||
AddUntilStep("selection not changed", () => carousel.SelectedBeatmapInfo.Equals(selection));
|
||||
AddUntilStep("selection not changed", () => carousel.SelectedBeatmapInfo?.Equals(selection) == true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -382,7 +382,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
// buffer the selection
|
||||
setSelected(3, 2);
|
||||
|
||||
AddStep("get search text", () => searchText = carousel.SelectedBeatmapSet.Metadata.Title);
|
||||
AddStep("get search text", () => searchText = carousel.SelectedBeatmapSet!.Metadata.Title);
|
||||
|
||||
setSelected(1, 3);
|
||||
|
||||
@ -494,6 +494,43 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("Something is selected", () => carousel.SelectedBeatmapInfo != null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSortingDateSubmitted()
|
||||
{
|
||||
var sets = new List<BeatmapSetInfo>();
|
||||
const string zzz_string = "zzzzz";
|
||||
|
||||
AddStep("Populuate beatmap sets", () =>
|
||||
{
|
||||
sets.Clear();
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
var set = TestResources.CreateTestBeatmapSetInfo(5);
|
||||
|
||||
if (i >= 2 && i < 10)
|
||||
set.DateSubmitted = DateTimeOffset.Now.AddMinutes(i);
|
||||
if (i < 5)
|
||||
set.Beatmaps.ForEach(b => b.Metadata.Artist = zzz_string);
|
||||
|
||||
sets.Add(set);
|
||||
}
|
||||
});
|
||||
|
||||
loadBeatmaps(sets);
|
||||
|
||||
AddStep("Sort by date submitted", () => carousel.Filter(new FilterCriteria { Sort = SortMode.DateSubmitted }, false));
|
||||
checkVisibleItemCount(diff: false, count: 8);
|
||||
checkVisibleItemCount(diff: true, count: 5);
|
||||
AddStep("Sort by date submitted and string", () => carousel.Filter(new FilterCriteria
|
||||
{
|
||||
Sort = SortMode.DateSubmitted,
|
||||
SearchText = zzz_string
|
||||
}, false));
|
||||
checkVisibleItemCount(diff: false, count: 3);
|
||||
checkVisibleItemCount(diff: true, count: 5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSorting()
|
||||
{
|
||||
@ -664,7 +701,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
setSelected(2, 1);
|
||||
AddAssert("Selection is non-null", () => currentSelection != null);
|
||||
|
||||
AddStep("Remove selected", () => carousel.RemoveBeatmapSet(carousel.SelectedBeatmapSet));
|
||||
AddStep("Remove selected", () => carousel.RemoveBeatmapSet(carousel.SelectedBeatmapSet!));
|
||||
waitForSelection(2);
|
||||
|
||||
AddStep("Remove first", () => carousel.RemoveBeatmapSet(carousel.BeatmapSets.First()));
|
||||
@ -767,7 +804,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep("filter to ruleset 0", () =>
|
||||
carousel.Filter(new FilterCriteria { Ruleset = rulesets.AvailableRulesets.ElementAt(0) }, false));
|
||||
AddStep("select filtered map skipping filtered", () => carousel.SelectBeatmap(testMixed.Beatmaps[1], false));
|
||||
AddAssert("unfiltered beatmap not selected", () => carousel.SelectedBeatmapInfo.Ruleset.OnlineID == 0);
|
||||
AddAssert("unfiltered beatmap not selected", () => carousel.SelectedBeatmapInfo?.Ruleset.OnlineID == 0);
|
||||
|
||||
AddStep("remove mixed set", () =>
|
||||
{
|
||||
@ -817,7 +854,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep("Restore no filter", () =>
|
||||
{
|
||||
carousel.Filter(new FilterCriteria(), false);
|
||||
eagerSelectedIDs.Add(carousel.SelectedBeatmapSet.ID);
|
||||
eagerSelectedIDs.Add(carousel.SelectedBeatmapSet!.ID);
|
||||
});
|
||||
}
|
||||
|
||||
@ -862,10 +899,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep("Restore different ruleset filter", () =>
|
||||
{
|
||||
carousel.Filter(new FilterCriteria { Ruleset = rulesets.GetRuleset(1) }, false);
|
||||
eagerSelectedIDs.Add(carousel.SelectedBeatmapSet.ID);
|
||||
eagerSelectedIDs.Add(carousel.SelectedBeatmapSet!.ID);
|
||||
});
|
||||
|
||||
AddAssert("selection changed", () => !carousel.SelectedBeatmapInfo.Equals(manySets.First().Beatmaps.First()));
|
||||
AddAssert("selection changed", () => !carousel.SelectedBeatmapInfo!.Equals(manySets.First().Beatmaps.First()));
|
||||
}
|
||||
|
||||
AddAssert("Selection was random", () => eagerSelectedIDs.Count > 2);
|
||||
|
@ -98,7 +98,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
OsuLogo logo = new OsuLogo { Scale = new Vector2(0.15f) };
|
||||
|
||||
Remove(testDifficultyCache);
|
||||
Remove(testDifficultyCache, false);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -1,10 +1,9 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
@ -13,6 +12,7 @@ using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
@ -46,11 +46,12 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
[TestFixture]
|
||||
public class TestScenePlaySongSelect : ScreenTestScene
|
||||
{
|
||||
private BeatmapManager manager;
|
||||
private RulesetStore rulesets;
|
||||
private MusicController music;
|
||||
private WorkingBeatmap defaultBeatmap;
|
||||
private TestSongSelect songSelect;
|
||||
private BeatmapManager manager = null!;
|
||||
private RulesetStore rulesets = null!;
|
||||
private MusicController music = null!;
|
||||
private WorkingBeatmap defaultBeatmap = null!;
|
||||
private OsuConfigManager config = null!;
|
||||
private TestSongSelect? songSelect;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host, AudioManager audio)
|
||||
@ -69,8 +70,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
Dependencies.Cache(config = new OsuConfigManager(LocalStorage));
|
||||
}
|
||||
|
||||
private OsuConfigManager config;
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
@ -85,7 +84,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
songSelect = null;
|
||||
});
|
||||
|
||||
AddStep("delete all beatmaps", () => manager?.Delete());
|
||||
AddStep("delete all beatmaps", () => manager.Delete());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -98,7 +97,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
addRulesetImportStep(0);
|
||||
AddUntilStep("wait for placeholder hidden", () => getPlaceholder()?.State.Value == Visibility.Hidden);
|
||||
|
||||
AddStep("delete all beatmaps", () => manager?.Delete());
|
||||
AddStep("delete all beatmaps", () => manager.Delete());
|
||||
AddUntilStep("wait for placeholder visible", () => getPlaceholder()?.State.Value == Visibility.Visible);
|
||||
}
|
||||
|
||||
@ -144,7 +143,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
createSongSelect();
|
||||
|
||||
AddAssert("filter count is 1", () => songSelect.FilterCount == 1);
|
||||
AddAssert("filter count is 1", () => songSelect?.FilterCount == 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -156,7 +155,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
waitForInitialSelection();
|
||||
|
||||
WorkingBeatmap selected = null;
|
||||
WorkingBeatmap? selected = null;
|
||||
|
||||
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||
|
||||
@ -166,7 +165,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
InputManager.Key(Key.Enter);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
|
||||
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
|
||||
}
|
||||
|
||||
@ -179,7 +178,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
waitForInitialSelection();
|
||||
|
||||
WorkingBeatmap selected = null;
|
||||
WorkingBeatmap? selected = null;
|
||||
|
||||
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||
|
||||
@ -189,7 +188,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
InputManager.Key(Key.Down);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
|
||||
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
|
||||
}
|
||||
|
||||
@ -202,23 +201,23 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||
|
||||
WorkingBeatmap selected = null;
|
||||
WorkingBeatmap? selected = null;
|
||||
|
||||
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||
|
||||
AddUntilStep("wait for beatmaps to load", () => songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>().Any());
|
||||
AddUntilStep("wait for beatmaps to load", () => songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmap>().Any());
|
||||
|
||||
AddStep("select next and enter", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||
.First(b => !((CarouselBeatmap)b.Item).BeatmapInfo.Equals(songSelect.Carousel.SelectedBeatmapInfo)));
|
||||
InputManager.MoveMouseTo(songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||
.First(b => !((CarouselBeatmap)b.Item).BeatmapInfo.Equals(songSelect!.Carousel.SelectedBeatmapInfo)));
|
||||
|
||||
InputManager.Click(MouseButton.Left);
|
||||
|
||||
InputManager.Key(Key.Enter);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
|
||||
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
|
||||
}
|
||||
|
||||
@ -231,14 +230,14 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
waitForInitialSelection();
|
||||
|
||||
WorkingBeatmap selected = null;
|
||||
WorkingBeatmap? selected = null;
|
||||
|
||||
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||
|
||||
AddStep("select next and enter", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||
.First(b => !((CarouselBeatmap)b.Item).BeatmapInfo.Equals(songSelect.Carousel.SelectedBeatmapInfo)));
|
||||
InputManager.MoveMouseTo(songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||
.First(b => !((CarouselBeatmap)b.Item).BeatmapInfo.Equals(songSelect!.Carousel.SelectedBeatmapInfo)));
|
||||
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
|
||||
@ -247,7 +246,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
InputManager.ReleaseButton(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
|
||||
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
|
||||
}
|
||||
|
||||
@ -260,11 +259,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
createSongSelect();
|
||||
|
||||
AddStep("push child screen", () => Stack.Push(new TestSceneOsuScreenStack.TestScreen("test child")));
|
||||
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
|
||||
|
||||
AddStep("return", () => songSelect.MakeCurrent());
|
||||
AddUntilStep("wait for current", () => songSelect.IsCurrentScreen());
|
||||
AddAssert("filter count is 1", () => songSelect.FilterCount == 1);
|
||||
AddStep("return", () => songSelect!.MakeCurrent());
|
||||
AddUntilStep("wait for current", () => songSelect!.IsCurrentScreen());
|
||||
AddAssert("filter count is 1", () => songSelect!.FilterCount == 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -278,13 +277,13 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
createSongSelect();
|
||||
|
||||
AddStep("push child screen", () => Stack.Push(new TestSceneOsuScreenStack.TestScreen("test child")));
|
||||
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
|
||||
|
||||
AddStep("change convert setting", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true));
|
||||
|
||||
AddStep("return", () => songSelect.MakeCurrent());
|
||||
AddUntilStep("wait for current", () => songSelect.IsCurrentScreen());
|
||||
AddAssert("filter count is 2", () => songSelect.FilterCount == 2);
|
||||
AddStep("return", () => songSelect!.MakeCurrent());
|
||||
AddUntilStep("wait for current", () => songSelect!.IsCurrentScreen());
|
||||
AddAssert("filter count is 2", () => songSelect!.FilterCount == 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -295,7 +294,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
createSongSelect();
|
||||
|
||||
AddStep("push child screen", () => Stack.Push(new TestSceneOsuScreenStack.TestScreen("test child")));
|
||||
AddUntilStep("wait for not current", () => !songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
|
||||
|
||||
AddStep("update beatmap", () =>
|
||||
{
|
||||
@ -304,9 +303,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
Beatmap.Value = manager.GetWorkingBeatmap(anotherBeatmap);
|
||||
});
|
||||
|
||||
AddStep("return", () => songSelect.MakeCurrent());
|
||||
AddUntilStep("wait for current", () => songSelect.IsCurrentScreen());
|
||||
AddAssert("carousel updated", () => songSelect.Carousel.SelectedBeatmapInfo.Equals(Beatmap.Value.BeatmapInfo));
|
||||
AddStep("return", () => songSelect!.MakeCurrent());
|
||||
AddUntilStep("wait for current", () => songSelect!.IsCurrentScreen());
|
||||
AddAssert("carousel updated", () => songSelect!.Carousel.SelectedBeatmapInfo?.Equals(Beatmap.Value.BeatmapInfo) == true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -318,15 +317,15 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
addRulesetImportStep(0);
|
||||
|
||||
checkMusicPlaying(true);
|
||||
AddStep("select first", () => songSelect.Carousel.SelectBeatmap(songSelect.Carousel.BeatmapSets.First().Beatmaps.First()));
|
||||
AddStep("select first", () => songSelect!.Carousel.SelectBeatmap(songSelect!.Carousel.BeatmapSets.First().Beatmaps.First()));
|
||||
checkMusicPlaying(true);
|
||||
|
||||
AddStep("manual pause", () => music.TogglePause());
|
||||
checkMusicPlaying(false);
|
||||
AddStep("select next difficulty", () => songSelect.Carousel.SelectNext(skipDifficulties: false));
|
||||
AddStep("select next difficulty", () => songSelect!.Carousel.SelectNext(skipDifficulties: false));
|
||||
checkMusicPlaying(false);
|
||||
|
||||
AddStep("select next set", () => songSelect.Carousel.SelectNext());
|
||||
AddStep("select next set", () => songSelect!.Carousel.SelectNext());
|
||||
checkMusicPlaying(true);
|
||||
}
|
||||
|
||||
@ -366,13 +365,13 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
public void TestDummy()
|
||||
{
|
||||
createSongSelect();
|
||||
AddUntilStep("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap);
|
||||
AddUntilStep("dummy selected", () => songSelect!.CurrentBeatmap == defaultBeatmap);
|
||||
|
||||
AddUntilStep("dummy shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap == defaultBeatmap);
|
||||
AddUntilStep("dummy shown on wedge", () => songSelect!.CurrentBeatmapDetailsBeatmap == defaultBeatmap);
|
||||
|
||||
addManyTestMaps();
|
||||
|
||||
AddUntilStep("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
|
||||
AddUntilStep("random map selected", () => songSelect!.CurrentBeatmap != defaultBeatmap);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -381,7 +380,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
createSongSelect();
|
||||
addManyTestMaps();
|
||||
|
||||
AddUntilStep("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
|
||||
AddUntilStep("random map selected", () => songSelect!.CurrentBeatmap != defaultBeatmap);
|
||||
|
||||
AddStep(@"Sort by Artist", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Artist));
|
||||
AddStep(@"Sort by Title", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Title));
|
||||
@ -398,7 +397,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
{
|
||||
createSongSelect();
|
||||
addRulesetImportStep(2);
|
||||
AddUntilStep("no selection", () => songSelect.Carousel.SelectedBeatmapInfo == null);
|
||||
AddUntilStep("no selection", () => songSelect!.Carousel.SelectedBeatmapInfo == null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -408,13 +407,13 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
changeRuleset(2);
|
||||
addRulesetImportStep(2);
|
||||
addRulesetImportStep(1);
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo.Ruleset.OnlineID == 2);
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo?.Ruleset.OnlineID == 2);
|
||||
|
||||
changeRuleset(1);
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo.Ruleset.OnlineID == 1);
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo?.Ruleset.OnlineID == 1);
|
||||
|
||||
changeRuleset(0);
|
||||
AddUntilStep("no selection", () => songSelect.Carousel.SelectedBeatmapInfo == null);
|
||||
AddUntilStep("no selection", () => songSelect!.Carousel.SelectedBeatmapInfo == null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -423,7 +422,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
createSongSelect();
|
||||
changeRuleset(0);
|
||||
|
||||
Live<BeatmapSetInfo> original = null!;
|
||||
Live<BeatmapSetInfo>? original = null;
|
||||
int originalOnlineSetID = 0;
|
||||
|
||||
AddStep(@"Sort by artist", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Artist));
|
||||
@ -431,12 +430,17 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep("import original", () =>
|
||||
{
|
||||
original = manager.Import(new ImportTask(TestResources.GetQuickTestBeatmapForImport())).GetResultSafely();
|
||||
originalOnlineSetID = original!.Value.OnlineID;
|
||||
|
||||
Debug.Assert(original != null);
|
||||
|
||||
originalOnlineSetID = original.Value.OnlineID;
|
||||
});
|
||||
|
||||
// This will move the beatmap set to a different location in the carousel.
|
||||
AddStep("Update original with bogus info", () =>
|
||||
{
|
||||
Debug.Assert(original != null);
|
||||
|
||||
original.PerformWrite(set =>
|
||||
{
|
||||
foreach (var beatmap in set.Beatmaps)
|
||||
@ -457,13 +461,19 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
manager.Import(testBeatmapSetInfo);
|
||||
}, 10);
|
||||
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo?.BeatmapSet?.OnlineID == originalOnlineSetID);
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo?.BeatmapSet?.OnlineID == originalOnlineSetID);
|
||||
|
||||
Task<Live<BeatmapSetInfo>> updateTask = null!;
|
||||
AddStep("update beatmap", () => updateTask = manager.ImportAsUpdate(new ProgressNotification(), new ImportTask(TestResources.GetQuickTestBeatmapForImport()), original.Value));
|
||||
Task<Live<BeatmapSetInfo>?> updateTask = null!;
|
||||
|
||||
AddStep("update beatmap", () =>
|
||||
{
|
||||
Debug.Assert(original != null);
|
||||
|
||||
updateTask = manager.ImportAsUpdate(new ProgressNotification(), new ImportTask(TestResources.GetQuickTestBeatmapForImport()), original.Value);
|
||||
});
|
||||
AddUntilStep("wait for update completion", () => updateTask.IsCompleted);
|
||||
|
||||
AddUntilStep("retained selection", () => songSelect.Carousel.SelectedBeatmapInfo?.BeatmapSet?.OnlineID == originalOnlineSetID);
|
||||
AddUntilStep("retained selection", () => songSelect!.Carousel.SelectedBeatmapInfo?.BeatmapSet?.OnlineID == originalOnlineSetID);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -473,13 +483,13 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
changeRuleset(2);
|
||||
|
||||
addRulesetImportStep(2);
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo.Ruleset.OnlineID == 2);
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo?.Ruleset.OnlineID == 2);
|
||||
|
||||
addRulesetImportStep(0);
|
||||
addRulesetImportStep(0);
|
||||
addRulesetImportStep(0);
|
||||
|
||||
BeatmapInfo target = null;
|
||||
BeatmapInfo? target = null;
|
||||
|
||||
AddStep("select beatmap/ruleset externally", () =>
|
||||
{
|
||||
@ -490,10 +500,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
||||
});
|
||||
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo.Equals(target));
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo?.Equals(target) == true);
|
||||
|
||||
// this is an important check, to make sure updateComponentFromBeatmap() was actually run
|
||||
AddUntilStep("selection shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap.BeatmapInfo.MatchesOnlineID(target));
|
||||
AddUntilStep("selection shown on wedge", () => songSelect!.CurrentBeatmapDetailsBeatmap.BeatmapInfo.MatchesOnlineID(target));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -503,13 +513,13 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
changeRuleset(2);
|
||||
|
||||
addRulesetImportStep(2);
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo.Ruleset.OnlineID == 2);
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo?.Ruleset.OnlineID == 2);
|
||||
|
||||
addRulesetImportStep(0);
|
||||
addRulesetImportStep(0);
|
||||
addRulesetImportStep(0);
|
||||
|
||||
BeatmapInfo target = null;
|
||||
BeatmapInfo? target = null;
|
||||
|
||||
AddStep("select beatmap/ruleset externally", () =>
|
||||
{
|
||||
@ -520,12 +530,12 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
Ruleset.Value = rulesets.AvailableRulesets.First(r => r.OnlineID == 0);
|
||||
});
|
||||
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo.Equals(target));
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo?.Equals(target) == true);
|
||||
|
||||
AddUntilStep("has correct ruleset", () => Ruleset.Value.OnlineID == 0);
|
||||
|
||||
// this is an important check, to make sure updateComponentFromBeatmap() was actually run
|
||||
AddUntilStep("selection shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap.BeatmapInfo.MatchesOnlineID(target));
|
||||
AddUntilStep("selection shown on wedge", () => songSelect!.CurrentBeatmapDetailsBeatmap.BeatmapInfo.MatchesOnlineID(target));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -543,12 +553,12 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep("change ruleset", () =>
|
||||
{
|
||||
SelectedMods.ValueChanged += onModChange;
|
||||
songSelect.Ruleset.ValueChanged += onRulesetChange;
|
||||
songSelect!.Ruleset.ValueChanged += onRulesetChange;
|
||||
|
||||
Ruleset.Value = new TaikoRuleset().RulesetInfo;
|
||||
|
||||
SelectedMods.ValueChanged -= onModChange;
|
||||
songSelect.Ruleset.ValueChanged -= onRulesetChange;
|
||||
songSelect!.Ruleset.ValueChanged -= onRulesetChange;
|
||||
});
|
||||
|
||||
AddAssert("mods changed before ruleset", () => modChangeIndex < rulesetChangeIndex);
|
||||
@ -579,18 +589,18 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
{
|
||||
createSongSelect();
|
||||
addManyTestMaps();
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo != null);
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo != null);
|
||||
|
||||
bool startRequested = false;
|
||||
|
||||
AddStep("set filter and finalize", () =>
|
||||
{
|
||||
songSelect.StartRequested = () => startRequested = true;
|
||||
songSelect!.StartRequested = () => startRequested = true;
|
||||
|
||||
songSelect.Carousel.Filter(new FilterCriteria { SearchText = "somestringthatshouldn'tbematchable" });
|
||||
songSelect.FinaliseSelection();
|
||||
songSelect!.Carousel.Filter(new FilterCriteria { SearchText = "somestringthatshouldn'tbematchable" });
|
||||
songSelect!.FinaliseSelection();
|
||||
|
||||
songSelect.StartRequested = null;
|
||||
songSelect!.StartRequested = null;
|
||||
});
|
||||
|
||||
AddAssert("start not requested", () => !startRequested);
|
||||
@ -610,15 +620,15 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
// used for filter check below
|
||||
AddStep("allow convert display", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true));
|
||||
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo != null);
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo != null);
|
||||
|
||||
AddStep("set filter text", () => songSelect.FilterControl.ChildrenOfType<SearchTextBox>().First().Text = "nonono");
|
||||
AddStep("set filter text", () => songSelect!.FilterControl.ChildrenOfType<SearchTextBox>().First().Text = "nonono");
|
||||
|
||||
AddUntilStep("dummy selected", () => Beatmap.Value is DummyWorkingBeatmap);
|
||||
|
||||
AddUntilStep("has no selection", () => songSelect.Carousel.SelectedBeatmapInfo == null);
|
||||
AddUntilStep("has no selection", () => songSelect!.Carousel.SelectedBeatmapInfo == null);
|
||||
|
||||
BeatmapInfo target = null;
|
||||
BeatmapInfo? target = null;
|
||||
|
||||
int targetRuleset = differentRuleset ? 1 : 0;
|
||||
|
||||
@ -632,24 +642,24 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
||||
});
|
||||
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo != null);
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo != null);
|
||||
|
||||
AddAssert("selected only shows expected ruleset (plus converts)", () =>
|
||||
{
|
||||
var selectedPanel = songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().First(s => s.Item.State.Value == CarouselItemState.Selected);
|
||||
var selectedPanel = songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().First(s => s.Item.State.Value == CarouselItemState.Selected);
|
||||
|
||||
// special case for converts checked here.
|
||||
return selectedPanel.ChildrenOfType<FilterableDifficultyIcon>().All(i =>
|
||||
i.IsFiltered || i.Item.BeatmapInfo.Ruleset.OnlineID == targetRuleset || i.Item.BeatmapInfo.Ruleset.OnlineID == 0);
|
||||
});
|
||||
|
||||
AddUntilStep("carousel has correct", () => songSelect.Carousel.SelectedBeatmapInfo?.MatchesOnlineID(target) == true);
|
||||
AddUntilStep("carousel has correct", () => songSelect!.Carousel.SelectedBeatmapInfo?.MatchesOnlineID(target) == true);
|
||||
AddUntilStep("game has correct", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(target));
|
||||
|
||||
AddStep("reset filter text", () => songSelect.FilterControl.ChildrenOfType<SearchTextBox>().First().Text = string.Empty);
|
||||
AddStep("reset filter text", () => songSelect!.FilterControl.ChildrenOfType<SearchTextBox>().First().Text = string.Empty);
|
||||
|
||||
AddAssert("game still correct", () => Beatmap.Value?.BeatmapInfo.MatchesOnlineID(target) == true);
|
||||
AddAssert("carousel still correct", () => songSelect.Carousel.SelectedBeatmapInfo.MatchesOnlineID(target));
|
||||
AddAssert("carousel still correct", () => songSelect!.Carousel.SelectedBeatmapInfo.MatchesOnlineID(target));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -662,15 +672,15 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
changeRuleset(0);
|
||||
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo != null);
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo != null);
|
||||
|
||||
AddStep("set filter text", () => songSelect.FilterControl.ChildrenOfType<SearchTextBox>().First().Text = "nonono");
|
||||
AddStep("set filter text", () => songSelect!.FilterControl.ChildrenOfType<SearchTextBox>().First().Text = "nonono");
|
||||
|
||||
AddUntilStep("dummy selected", () => Beatmap.Value is DummyWorkingBeatmap);
|
||||
|
||||
AddUntilStep("has no selection", () => songSelect.Carousel.SelectedBeatmapInfo == null);
|
||||
AddUntilStep("has no selection", () => songSelect!.Carousel.SelectedBeatmapInfo == null);
|
||||
|
||||
BeatmapInfo target = null;
|
||||
BeatmapInfo? target = null;
|
||||
|
||||
AddStep("select beatmap externally", () =>
|
||||
{
|
||||
@ -682,15 +692,15 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
Beatmap.Value = manager.GetWorkingBeatmap(target);
|
||||
});
|
||||
|
||||
AddUntilStep("has selection", () => songSelect.Carousel.SelectedBeatmapInfo != null);
|
||||
AddUntilStep("has selection", () => songSelect!.Carousel.SelectedBeatmapInfo != null);
|
||||
|
||||
AddUntilStep("carousel has correct", () => songSelect.Carousel.SelectedBeatmapInfo?.MatchesOnlineID(target) == true);
|
||||
AddUntilStep("carousel has correct", () => songSelect!.Carousel.SelectedBeatmapInfo?.MatchesOnlineID(target) == true);
|
||||
AddUntilStep("game has correct", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(target));
|
||||
|
||||
AddStep("set filter text", () => songSelect.FilterControl.ChildrenOfType<SearchTextBox>().First().Text = "nononoo");
|
||||
AddStep("set filter text", () => songSelect!.FilterControl.ChildrenOfType<SearchTextBox>().First().Text = "nononoo");
|
||||
|
||||
AddUntilStep("game lost selection", () => Beatmap.Value is DummyWorkingBeatmap);
|
||||
AddAssert("carousel lost selection", () => songSelect.Carousel.SelectedBeatmapInfo == null);
|
||||
AddAssert("carousel lost selection", () => songSelect!.Carousel.SelectedBeatmapInfo == null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -711,11 +721,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
AddUntilStep("wait for player", () => Stack.CurrentScreen is PlayerLoader);
|
||||
|
||||
AddAssert("autoplay selected", () => songSelect.Mods.Value.Single() is ModAutoplay);
|
||||
AddAssert("autoplay selected", () => songSelect!.Mods.Value.Single() is ModAutoplay);
|
||||
|
||||
AddUntilStep("wait for return to ss", () => songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for return to ss", () => songSelect!.IsCurrentScreen());
|
||||
|
||||
AddAssert("no mods selected", () => songSelect.Mods.Value.Count == 0);
|
||||
AddAssert("no mods selected", () => songSelect!.Mods.Value.Count == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -738,11 +748,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
AddUntilStep("wait for player", () => Stack.CurrentScreen is PlayerLoader);
|
||||
|
||||
AddAssert("autoplay selected", () => songSelect.Mods.Value.Single() is ModAutoplay);
|
||||
AddAssert("autoplay selected", () => songSelect!.Mods.Value.Single() is ModAutoplay);
|
||||
|
||||
AddUntilStep("wait for return to ss", () => songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for return to ss", () => songSelect!.IsCurrentScreen());
|
||||
|
||||
AddAssert("autoplay still selected", () => songSelect.Mods.Value.Single() is ModAutoplay);
|
||||
AddAssert("autoplay still selected", () => songSelect!.Mods.Value.Single() is ModAutoplay);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -765,11 +775,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
AddUntilStep("wait for player", () => Stack.CurrentScreen is PlayerLoader);
|
||||
|
||||
AddAssert("only autoplay selected", () => songSelect.Mods.Value.Single() is ModAutoplay);
|
||||
AddAssert("only autoplay selected", () => songSelect!.Mods.Value.Single() is ModAutoplay);
|
||||
|
||||
AddUntilStep("wait for return to ss", () => songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for return to ss", () => songSelect!.IsCurrentScreen());
|
||||
|
||||
AddAssert("relax returned", () => songSelect.Mods.Value.Single() is ModRelax);
|
||||
AddAssert("relax returned", () => songSelect!.Mods.Value.Single() is ModRelax);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -778,10 +788,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
Guid? previousID = null;
|
||||
createSongSelect();
|
||||
addRulesetImportStep(0);
|
||||
AddStep("Move to last difficulty", () => songSelect.Carousel.SelectBeatmap(songSelect.Carousel.BeatmapSets.First().Beatmaps.Last()));
|
||||
AddStep("Store current ID", () => previousID = songSelect.Carousel.SelectedBeatmapInfo.ID);
|
||||
AddStep("Hide first beatmap", () => manager.Hide(songSelect.Carousel.SelectedBeatmapSet.Beatmaps.First()));
|
||||
AddAssert("Selected beatmap has not changed", () => songSelect.Carousel.SelectedBeatmapInfo.ID == previousID);
|
||||
AddStep("Move to last difficulty", () => songSelect!.Carousel.SelectBeatmap(songSelect!.Carousel.BeatmapSets.First().Beatmaps.Last()));
|
||||
AddStep("Store current ID", () => previousID = songSelect!.Carousel.SelectedBeatmapInfo!.ID);
|
||||
AddStep("Hide first beatmap", () => manager.Hide(songSelect!.Carousel.SelectedBeatmapSet!.Beatmaps.First()));
|
||||
AddAssert("Selected beatmap has not changed", () => songSelect!.Carousel.SelectedBeatmapInfo?.ID == previousID);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -792,17 +802,24 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
AddUntilStep("wait for selection", () => !Beatmap.IsDefault);
|
||||
|
||||
DrawableCarouselBeatmapSet set = null;
|
||||
DrawableCarouselBeatmapSet set = null!;
|
||||
AddStep("Find the DrawableCarouselBeatmapSet", () =>
|
||||
{
|
||||
set = songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().First();
|
||||
set = songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().First();
|
||||
});
|
||||
|
||||
FilterableDifficultyIcon difficultyIcon = null;
|
||||
FilterableDifficultyIcon difficultyIcon = null!;
|
||||
|
||||
AddUntilStep("Find an icon", () =>
|
||||
{
|
||||
return (difficultyIcon = set.ChildrenOfType<FilterableDifficultyIcon>()
|
||||
.FirstOrDefault(icon => getDifficultyIconIndex(set, icon) != getCurrentBeatmapIndex())) != null;
|
||||
var foundIcon = set.ChildrenOfType<FilterableDifficultyIcon>()
|
||||
.FirstOrDefault(icon => getDifficultyIconIndex(set, icon) != getCurrentBeatmapIndex());
|
||||
|
||||
if (foundIcon == null)
|
||||
return false;
|
||||
|
||||
difficultyIcon = foundIcon;
|
||||
return true;
|
||||
});
|
||||
|
||||
AddStep("Click on a difficulty", () =>
|
||||
@ -815,21 +832,24 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("Selected beatmap correct", () => getCurrentBeatmapIndex() == getDifficultyIconIndex(set, difficultyIcon));
|
||||
|
||||
double? maxBPM = null;
|
||||
AddStep("Filter some difficulties", () => songSelect.Carousel.Filter(new FilterCriteria
|
||||
AddStep("Filter some difficulties", () => songSelect!.Carousel.Filter(new FilterCriteria
|
||||
{
|
||||
BPM = new FilterCriteria.OptionalRange<double>
|
||||
{
|
||||
Min = maxBPM = songSelect.Carousel.SelectedBeatmapSet.MaxBPM,
|
||||
Min = maxBPM = songSelect!.Carousel.SelectedBeatmapSet!.MaxBPM,
|
||||
IsLowerInclusive = true
|
||||
}
|
||||
}));
|
||||
|
||||
BeatmapInfo filteredBeatmap = null;
|
||||
FilterableDifficultyIcon filteredIcon = null;
|
||||
BeatmapInfo? filteredBeatmap = null;
|
||||
FilterableDifficultyIcon? filteredIcon = null;
|
||||
|
||||
AddStep("Get filtered icon", () =>
|
||||
{
|
||||
var selectedSet = songSelect.Carousel.SelectedBeatmapSet;
|
||||
var selectedSet = songSelect!.Carousel.SelectedBeatmapSet;
|
||||
|
||||
Debug.Assert(selectedSet != null);
|
||||
|
||||
filteredBeatmap = selectedSet.Beatmaps.First(b => b.BPM < maxBPM);
|
||||
int filteredBeatmapIndex = getBeatmapIndex(selectedSet, filteredBeatmap);
|
||||
filteredIcon = set.ChildrenOfType<FilterableDifficultyIcon>().ElementAt(filteredBeatmapIndex);
|
||||
@ -842,7 +862,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddAssert("Selected beatmap correct", () => songSelect.Carousel.SelectedBeatmapInfo.Equals(filteredBeatmap));
|
||||
AddAssert("Selected beatmap correct", () => songSelect!.Carousel.SelectedBeatmapInfo?.Equals(filteredBeatmap) == true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -907,14 +927,14 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
manager.Import(TestResources.CreateTestBeatmapSetInfo(3, usableRulesets));
|
||||
});
|
||||
|
||||
DrawableCarouselBeatmapSet set = null;
|
||||
DrawableCarouselBeatmapSet? set = null;
|
||||
AddUntilStep("Find the DrawableCarouselBeatmapSet", () =>
|
||||
{
|
||||
set = songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().FirstOrDefault();
|
||||
set = songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().FirstOrDefault();
|
||||
return set != null;
|
||||
});
|
||||
|
||||
FilterableDifficultyIcon difficultyIcon = null;
|
||||
FilterableDifficultyIcon? difficultyIcon = null;
|
||||
AddUntilStep("Find an icon for different ruleset", () =>
|
||||
{
|
||||
difficultyIcon = set.ChildrenOfType<FilterableDifficultyIcon>()
|
||||
@ -937,7 +957,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
AddUntilStep("Check ruleset changed to mania", () => Ruleset.Value.OnlineID == 3);
|
||||
|
||||
AddAssert("Selected beatmap still same set", () => songSelect.Carousel.SelectedBeatmapInfo.BeatmapSet?.OnlineID == previousSetID);
|
||||
AddAssert("Selected beatmap still same set", () => songSelect!.Carousel.SelectedBeatmapInfo?.BeatmapSet?.OnlineID == previousSetID);
|
||||
AddAssert("Selected beatmap is mania", () => Beatmap.Value.BeatmapInfo.Ruleset.OnlineID == 3);
|
||||
}
|
||||
|
||||
@ -948,7 +968,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
createSongSelect();
|
||||
|
||||
BeatmapSetInfo imported = null;
|
||||
BeatmapSetInfo? imported = null;
|
||||
|
||||
AddStep("import huge difficulty count map", () =>
|
||||
{
|
||||
@ -956,20 +976,27 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
imported = manager.Import(TestResources.CreateTestBeatmapSetInfo(50, usableRulesets))?.Value;
|
||||
});
|
||||
|
||||
AddStep("select the first beatmap of import", () => Beatmap.Value = manager.GetWorkingBeatmap(imported.Beatmaps.First()));
|
||||
AddStep("select the first beatmap of import", () => Beatmap.Value = manager.GetWorkingBeatmap(imported?.Beatmaps.First()));
|
||||
|
||||
DrawableCarouselBeatmapSet set = null;
|
||||
DrawableCarouselBeatmapSet? set = null;
|
||||
AddUntilStep("Find the DrawableCarouselBeatmapSet", () =>
|
||||
{
|
||||
set = songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().FirstOrDefault();
|
||||
set = songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().FirstOrDefault();
|
||||
return set != null;
|
||||
});
|
||||
|
||||
GroupedDifficultyIcon groupIcon = null;
|
||||
GroupedDifficultyIcon groupIcon = null!;
|
||||
|
||||
AddUntilStep("Find group icon for different ruleset", () =>
|
||||
{
|
||||
return (groupIcon = set.ChildrenOfType<GroupedDifficultyIcon>()
|
||||
.FirstOrDefault(icon => icon.Items.First().BeatmapInfo.Ruleset.OnlineID == 3)) != null;
|
||||
var foundIcon = set.ChildrenOfType<GroupedDifficultyIcon>()
|
||||
.FirstOrDefault(icon => icon.Items.First().BeatmapInfo.Ruleset.OnlineID == 3);
|
||||
|
||||
if (foundIcon == null)
|
||||
return false;
|
||||
|
||||
groupIcon = foundIcon;
|
||||
return true;
|
||||
});
|
||||
|
||||
AddAssert("Check ruleset is osu!", () => Ruleset.Value.OnlineID == 0);
|
||||
@ -1004,7 +1031,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
// this ruleset change should be overridden by the present.
|
||||
Ruleset.Value = getSwitchBeatmap().Ruleset;
|
||||
|
||||
songSelect.PresentScore(new ScoreInfo
|
||||
songSelect!.PresentScore(new ScoreInfo
|
||||
{
|
||||
User = new APIUser { Username = "woo" },
|
||||
BeatmapInfo = getPresentBeatmap(),
|
||||
@ -1012,7 +1039,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
});
|
||||
});
|
||||
|
||||
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for results screen presented", () => !songSelect!.IsCurrentScreen());
|
||||
|
||||
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(getPresentBeatmap()));
|
||||
AddAssert("check ruleset is correct for score", () => Ruleset.Value.OnlineID == 0);
|
||||
@ -1038,10 +1065,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
// this beatmap change should be overridden by the present.
|
||||
Beatmap.Value = manager.GetWorkingBeatmap(getSwitchBeatmap());
|
||||
|
||||
songSelect.PresentScore(TestResources.CreateTestScoreInfo(getPresentBeatmap()));
|
||||
songSelect!.PresentScore(TestResources.CreateTestScoreInfo(getPresentBeatmap()));
|
||||
});
|
||||
|
||||
AddUntilStep("wait for results screen presented", () => !songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for results screen presented", () => !songSelect!.IsCurrentScreen());
|
||||
|
||||
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(getPresentBeatmap()));
|
||||
AddAssert("check ruleset is correct for score", () => Ruleset.Value.OnlineID == 0);
|
||||
@ -1054,23 +1081,29 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
createSongSelect();
|
||||
|
||||
AddStep("toggle mod overlay on", () => InputManager.Key(Key.F1));
|
||||
AddUntilStep("mod overlay shown", () => songSelect.ModSelect.State.Value == Visibility.Visible);
|
||||
AddUntilStep("mod overlay shown", () => songSelect!.ModSelect.State.Value == Visibility.Visible);
|
||||
|
||||
AddStep("toggle mod overlay off", () => InputManager.Key(Key.F1));
|
||||
AddUntilStep("mod overlay hidden", () => songSelect.ModSelect.State.Value == Visibility.Hidden);
|
||||
AddUntilStep("mod overlay hidden", () => songSelect!.ModSelect.State.Value == Visibility.Hidden);
|
||||
}
|
||||
|
||||
private void waitForInitialSelection()
|
||||
{
|
||||
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||
AddUntilStep("wait for difficulty panels visible", () => songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>().Any());
|
||||
AddUntilStep("wait for difficulty panels visible", () => songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmap>().Any());
|
||||
}
|
||||
|
||||
private int getBeatmapIndex(BeatmapSetInfo set, BeatmapInfo info) => set.Beatmaps.IndexOf(info);
|
||||
|
||||
private NoResultsPlaceholder getPlaceholder() => songSelect.ChildrenOfType<NoResultsPlaceholder>().FirstOrDefault();
|
||||
private NoResultsPlaceholder? getPlaceholder() => songSelect!.ChildrenOfType<NoResultsPlaceholder>().FirstOrDefault();
|
||||
|
||||
private int getCurrentBeatmapIndex() => getBeatmapIndex(songSelect.Carousel.SelectedBeatmapSet, songSelect.Carousel.SelectedBeatmapInfo);
|
||||
private int getCurrentBeatmapIndex()
|
||||
{
|
||||
Debug.Assert(songSelect!.Carousel.SelectedBeatmapSet != null);
|
||||
Debug.Assert(songSelect!.Carousel.SelectedBeatmapInfo != null);
|
||||
|
||||
return getBeatmapIndex(songSelect!.Carousel.SelectedBeatmapSet, songSelect!.Carousel.SelectedBeatmapInfo);
|
||||
}
|
||||
|
||||
private int getDifficultyIconIndex(DrawableCarouselBeatmapSet set, FilterableDifficultyIcon icon)
|
||||
{
|
||||
@ -1079,14 +1112,14 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
private void addRulesetImportStep(int id)
|
||||
{
|
||||
Live<BeatmapSetInfo> imported = null;
|
||||
Live<BeatmapSetInfo>? imported = null;
|
||||
AddStep($"import test map for ruleset {id}", () => imported = importForRuleset(id));
|
||||
// This is specifically for cases where the add is happening post song select load.
|
||||
// For cases where song select is null, the assertions are provided by the load checks.
|
||||
AddUntilStep("wait for imported to arrive in carousel", () => songSelect == null || songSelect.Carousel.BeatmapSets.Any(s => s.ID == imported?.ID));
|
||||
AddUntilStep("wait for imported to arrive in carousel", () => songSelect == null || songSelect!.Carousel.BeatmapSets.Any(s => s.ID == imported?.ID));
|
||||
}
|
||||
|
||||
private Live<BeatmapSetInfo> importForRuleset(int id) => manager.Import(TestResources.CreateTestBeatmapSetInfo(3, rulesets.AvailableRulesets.Where(r => r.OnlineID == id).ToArray()));
|
||||
private Live<BeatmapSetInfo>? importForRuleset(int id) => manager.Import(TestResources.CreateTestBeatmapSetInfo(3, rulesets.AvailableRulesets.Where(r => r.OnlineID == id).ToArray()));
|
||||
|
||||
private void checkMusicPlaying(bool playing) =>
|
||||
AddUntilStep($"music {(playing ? "" : "not ")}playing", () => music.IsPlaying == playing);
|
||||
@ -1098,8 +1131,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
private void createSongSelect()
|
||||
{
|
||||
AddStep("create song select", () => LoadScreen(songSelect = new TestSongSelect()));
|
||||
AddUntilStep("wait for present", () => songSelect.IsCurrentScreen());
|
||||
AddUntilStep("wait for carousel loaded", () => songSelect.Carousel.IsAlive);
|
||||
AddUntilStep("wait for present", () => songSelect!.IsCurrentScreen());
|
||||
AddUntilStep("wait for carousel loaded", () => songSelect!.Carousel.IsAlive);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1123,12 +1156,14 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
rulesets?.Dispose();
|
||||
|
||||
if (rulesets.IsNotNull())
|
||||
rulesets.Dispose();
|
||||
}
|
||||
|
||||
private class TestSongSelect : PlaySongSelect
|
||||
{
|
||||
public Action StartRequested;
|
||||
public Action? StartRequested;
|
||||
|
||||
public new Bindable<RulesetInfo> Ruleset => base.Ruleset;
|
||||
|
||||
|
@ -194,7 +194,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
AddStep("notification arrived", () => notificationOverlay.Verify(n => n.Post(It.IsAny<Notification>()), Times.Once));
|
||||
|
||||
AddStep("run notification action", () => lastNotification.Activated());
|
||||
AddStep("run notification action", () => lastNotification.Activated?.Invoke());
|
||||
|
||||
AddAssert("overlay shown", () => overlay.State.Value == Visibility.Visible);
|
||||
AddAssert("is resumed", () => overlay.CurrentScreen is ScreenUIScale);
|
||||
|
@ -259,7 +259,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
private void removeFacade()
|
||||
{
|
||||
trackingContainer.Remove(logoFacade);
|
||||
trackingContainer.Remove(logoFacade, false);
|
||||
visualBox.Colour = Color4.White;
|
||||
moveLogoFacade();
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays;
|
||||
@ -23,9 +24,12 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
private SpriteText displayedCount = null!;
|
||||
|
||||
public double TimeToCompleteProgress { get; set; } = 2000;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
TimeToCompleteProgress = 2000;
|
||||
progressingNotifications.Clear();
|
||||
|
||||
Content.Children = new Drawable[]
|
||||
@ -41,10 +45,36 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
notificationOverlay.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count.NewValue}"; };
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestPresence()
|
||||
{
|
||||
AddAssert("tray not present", () => !notificationOverlay.ChildrenOfType<NotificationOverlayToastTray>().Single().IsPresent);
|
||||
AddAssert("overlay not present", () => !notificationOverlay.IsPresent);
|
||||
|
||||
AddStep(@"post notification", sendBackgroundNotification);
|
||||
|
||||
AddUntilStep("wait tray not present", () => !notificationOverlay.ChildrenOfType<NotificationOverlayToastTray>().Single().IsPresent);
|
||||
AddUntilStep("wait overlay not present", () => !notificationOverlay.IsPresent);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPresenceWithManualDismiss()
|
||||
{
|
||||
AddAssert("tray not present", () => !notificationOverlay.ChildrenOfType<NotificationOverlayToastTray>().Single().IsPresent);
|
||||
AddAssert("overlay not present", () => !notificationOverlay.IsPresent);
|
||||
|
||||
AddStep(@"post notification", sendBackgroundNotification);
|
||||
AddStep("click notification", () => notificationOverlay.ChildrenOfType<Notification>().Single().TriggerClick());
|
||||
|
||||
AddUntilStep("wait tray not present", () => !notificationOverlay.ChildrenOfType<NotificationOverlayToastTray>().Single().IsPresent);
|
||||
AddUntilStep("wait overlay not present", () => !notificationOverlay.IsPresent);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCompleteProgress()
|
||||
{
|
||||
ProgressNotification notification = null!;
|
||||
|
||||
AddStep("add progress notification", () =>
|
||||
{
|
||||
notification = new ProgressNotification
|
||||
@ -57,6 +87,31 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
});
|
||||
|
||||
AddUntilStep("wait completion", () => notification.State == ProgressNotificationState.Completed);
|
||||
|
||||
AddAssert("Completion toast shown", () => notificationOverlay.ToastCount == 1);
|
||||
AddUntilStep("wait forwarded", () => notificationOverlay.ToastCount == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCompleteProgressSlow()
|
||||
{
|
||||
ProgressNotification notification = null!;
|
||||
|
||||
AddStep("Set progress slow", () => TimeToCompleteProgress *= 2);
|
||||
AddStep("add progress notification", () =>
|
||||
{
|
||||
notification = new ProgressNotification
|
||||
{
|
||||
Text = @"Uploading to BSS...",
|
||||
CompletionText = "Uploaded to BSS!",
|
||||
};
|
||||
notificationOverlay.Post(notification);
|
||||
progressingNotifications.Add(notification);
|
||||
});
|
||||
|
||||
AddUntilStep("wait completion", () => notification.State == ProgressNotificationState.Completed);
|
||||
|
||||
AddAssert("Completion toast shown", () => notificationOverlay.ToastCount == 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -110,7 +165,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
AddStep(@"simple #1", sendHelloNotification);
|
||||
|
||||
AddAssert("Is visible", () => notificationOverlay.State.Value == Visibility.Visible);
|
||||
AddAssert("toast displayed", () => notificationOverlay.ToastCount == 1);
|
||||
AddAssert("is not visible", () => notificationOverlay.State.Value == Visibility.Hidden);
|
||||
|
||||
checkDisplayedCount(1);
|
||||
|
||||
@ -176,14 +232,14 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
foreach (var n in progressingNotifications.FindAll(n => n.State == ProgressNotificationState.Active))
|
||||
{
|
||||
if (n.Progress < 1)
|
||||
n.Progress += (float)(Time.Elapsed / 2000);
|
||||
n.Progress += (float)(Time.Elapsed / TimeToCompleteProgress);
|
||||
else
|
||||
n.State = ProgressNotificationState.Completed;
|
||||
}
|
||||
}
|
||||
|
||||
private void checkDisplayedCount(int expected) =>
|
||||
AddAssert($"Displayed count is {expected}", () => notificationOverlay.UnreadCount.Value == expected);
|
||||
AddUntilStep($"Displayed count is {expected}", () => notificationOverlay.UnreadCount.Value == expected);
|
||||
|
||||
private void sendDownloadProgress()
|
||||
{
|
||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
{
|
||||
AddStep("setup screen", () =>
|
||||
{
|
||||
Remove(chat);
|
||||
Remove(chat, false);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -40,5 +40,7 @@ namespace osu.Game.Tournament.Models
|
||||
MinValue = 3,
|
||||
MaxValue = 4,
|
||||
};
|
||||
|
||||
public Bindable<bool> AutoProgressScreens = new BindableBool(true);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
@ -41,7 +40,7 @@ namespace osu.Game.Tournament.Models
|
||||
StarRating = beatmap.StarRating;
|
||||
Metadata = beatmap.Metadata;
|
||||
Difficulty = beatmap.Difficulty;
|
||||
Covers = beatmap.BeatmapSet.AsNonNull().Covers;
|
||||
Covers = beatmap.BeatmapSet?.Covers ?? new BeatmapSetOnlineCovers();
|
||||
}
|
||||
|
||||
public bool Equals(IBeatmapInfo? other) => other is TournamentBeatmap b && this.MatchesOnlineID(b);
|
||||
|
@ -106,13 +106,16 @@ namespace osu.Game.Tournament.Models
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialise this match with zeroed scores. Will be a noop if either team is not present.
|
||||
/// Initialise this match with zeroed scores. Will be a noop if either team is not present or if either of the scores are non-zero.
|
||||
/// </summary>
|
||||
public void StartMatch()
|
||||
{
|
||||
if (Team1.Value == null || Team2.Value == null)
|
||||
return;
|
||||
|
||||
if (Team1Score.Value > 0 || Team2Score.Value > 0)
|
||||
return;
|
||||
|
||||
Team1Score.Value = 0;
|
||||
Team2Score.Value = 0;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
||||
{
|
||||
allTeams.RemoveAll(gt => gt.Team == team);
|
||||
|
||||
if (teams.RemoveAll(gt => gt.Team == team) > 0)
|
||||
if (teams.RemoveAll(gt => gt.Team == team, true) > 0)
|
||||
{
|
||||
TeamsCount--;
|
||||
return true;
|
||||
|
@ -170,7 +170,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
||||
|
||||
availableTeams.Add(team);
|
||||
|
||||
RemoveAll(c => c is ScrollingTeam);
|
||||
RemoveAll(c => c is ScrollingTeam, true);
|
||||
setScrollState(ScrollState.Idle);
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
||||
public void ClearTeams()
|
||||
{
|
||||
availableTeams.Clear();
|
||||
RemoveAll(c => c is ScrollingTeam);
|
||||
RemoveAll(c => c is ScrollingTeam, true);
|
||||
setScrollState(ScrollState.Idle);
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
||||
if (allLines.Count == 0)
|
||||
return;
|
||||
|
||||
Remove(allLines.First());
|
||||
Remove(allLines.First(), true);
|
||||
allLines.Remove(allLines.First());
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
args.OldItems.Cast<TModel>().ForEach(i => flow.RemoveAll(d => d.Model == i));
|
||||
args.OldItems.Cast<TModel>().ForEach(i => flow.RemoveAll(d => d.Model == i, true));
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
@ -25,6 +25,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
|
||||
public bool ShowScore
|
||||
{
|
||||
get => teamDisplay.ShowScore;
|
||||
set => teamDisplay.ShowScore = value;
|
||||
}
|
||||
|
||||
@ -92,10 +93,14 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
|
||||
private void teamChanged(ValueChangedEvent<TournamentTeam> team)
|
||||
{
|
||||
bool wasShowingScores = teamDisplay?.ShowScore ?? false;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
teamDisplay = new TeamDisplay(team.NewValue, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0),
|
||||
};
|
||||
|
||||
teamDisplay.ShowScore = wasShowingScores;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -199,6 +199,8 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
case TourneyState.Idle:
|
||||
contract();
|
||||
|
||||
if (LadderInfo.AutoProgressScreens.Value)
|
||||
{
|
||||
const float delay_before_progression = 4000;
|
||||
|
||||
// if we've returned to idle and the last screen was ranking
|
||||
@ -210,6 +212,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
|
||||
else if (CurrentMatch.Value?.Completed.Value == false)
|
||||
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, delay_before_progression);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
@ -280,7 +280,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (editorInfo == null || Match is ConditionalTournamentMatch)
|
||||
if (editorInfo == null || Match is ConditionalTournamentMatch || e.Button != MouseButton.Left)
|
||||
return false;
|
||||
|
||||
Selected = true;
|
||||
|
@ -46,7 +46,10 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
Loop = true,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new MatchHeader(),
|
||||
new MatchHeader
|
||||
{
|
||||
ShowScores = true,
|
||||
},
|
||||
mapFlows = new FillFlowContainer<FillFlowContainer<TournamentBeatmapPanel>>
|
||||
{
|
||||
Y = 160,
|
||||
@ -197,12 +200,15 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
|
||||
setNextMode();
|
||||
|
||||
if (LadderInfo.AutoProgressScreens.Value)
|
||||
{
|
||||
if (pickType == ChoiceType.Pick && CurrentMatch.Value.PicksBans.Any(i => i.Type == ChoiceType.Pick))
|
||||
{
|
||||
scheduledChange?.Cancel();
|
||||
scheduledChange = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(GameplayScreen)); }, 10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void CurrentMatchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
{
|
||||
|
@ -131,6 +131,12 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
windowSize.Value = new Size((int)(height * aspect_ratio / TournamentSceneManager.STREAM_AREA_WIDTH * TournamentSceneManager.REQUIRED_WIDTH), height);
|
||||
}
|
||||
},
|
||||
new LabelledSwitchButton
|
||||
{
|
||||
Label = "Auto advance screens",
|
||||
Description = "Screens will progress automatically from gameplay -> results -> map pool",
|
||||
Current = LadderInfo.AutoProgressScreens,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -319,8 +319,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
AddFile(setInfo, stream, createBeatmapFilenameFromMetadata(beatmapInfo));
|
||||
|
||||
setInfo.Hash = beatmapImporter.ComputeHash(setInfo);
|
||||
setInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||
updateHashAndMarkDirty(setInfo);
|
||||
|
||||
Realm.Write(r =>
|
||||
{
|
||||
@ -363,6 +362,33 @@ namespace osu.Game.Beatmaps
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete a beatmap difficulty immediately.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// There's no undoing this operation, as we don't have a soft-deletion flag on <see cref="BeatmapInfo"/>.
|
||||
/// This may be a future consideration if there's a user requirement for undeleting support.
|
||||
/// </remarks>
|
||||
public void DeleteDifficultyImmediately(BeatmapInfo beatmapInfo)
|
||||
{
|
||||
Realm.Write(r =>
|
||||
{
|
||||
if (!beatmapInfo.IsManaged)
|
||||
beatmapInfo = r.Find<BeatmapInfo>(beatmapInfo.ID);
|
||||
|
||||
Debug.Assert(beatmapInfo.BeatmapSet != null);
|
||||
Debug.Assert(beatmapInfo.File != null);
|
||||
|
||||
var setInfo = beatmapInfo.BeatmapSet;
|
||||
|
||||
DeleteFile(setInfo, beatmapInfo.File);
|
||||
setInfo.Beatmaps.Remove(beatmapInfo);
|
||||
|
||||
updateHashAndMarkDirty(setInfo);
|
||||
workingBeatmapCache.Invalidate(setInfo);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete videos from a list of beatmaps.
|
||||
/// This will post notifications tracking progress.
|
||||
@ -416,6 +442,12 @@ namespace osu.Game.Beatmaps
|
||||
public Task<Live<BeatmapSetInfo>?> ImportAsUpdate(ProgressNotification notification, ImportTask importTask, BeatmapSetInfo original) =>
|
||||
beatmapImporter.ImportAsUpdate(notification, importTask, original);
|
||||
|
||||
private void updateHashAndMarkDirty(BeatmapSetInfo setInfo)
|
||||
{
|
||||
setInfo.Hash = beatmapImporter.ComputeHash(setInfo);
|
||||
setInfo.Status = BeatmapOnlineStatus.LocallyModified;
|
||||
}
|
||||
|
||||
#region Implementation of ICanAcceptFiles
|
||||
|
||||
public Task Import(params string[] paths) => beatmapImporter.Import(paths);
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
|
@ -17,8 +17,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
|
||||
{
|
||||
public class DownloadButton : BeatmapCardIconButton
|
||||
{
|
||||
public IBindable<DownloadState> State => state;
|
||||
private readonly Bindable<DownloadState> state = new Bindable<DownloadState>();
|
||||
public Bindable<DownloadState> State { get; } = new Bindable<DownloadState>();
|
||||
|
||||
private readonly APIBeatmapSet beatmapSet;
|
||||
|
||||
@ -48,14 +47,19 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
|
||||
{
|
||||
base.LoadComplete();
|
||||
preferNoVideo.BindValueChanged(_ => updateState());
|
||||
state.BindValueChanged(_ => updateState(), true);
|
||||
State.BindValueChanged(_ => updateState(), true);
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
switch (state.Value)
|
||||
switch (State.Value)
|
||||
{
|
||||
case DownloadState.Unknown:
|
||||
Action = null;
|
||||
TooltipText = string.Empty;
|
||||
break;
|
||||
|
||||
case DownloadState.Downloading:
|
||||
case DownloadState.Importing:
|
||||
Action = null;
|
||||
|
@ -373,7 +373,11 @@ namespace osu.Game.Beatmaps.Formats
|
||||
string[] split = line.Split(',');
|
||||
|
||||
double time = getOffsetTime(Parsing.ParseDouble(split[0].Trim()));
|
||||
double beatLength = Parsing.ParseDouble(split[1].Trim());
|
||||
|
||||
// beatLength is allowed to be NaN to handle an edge case in which some beatmaps use NaN slider velocity to disable slider tick generation (see LegacyDifficultyControlPoint).
|
||||
double beatLength = Parsing.ParseDouble(split[1].Trim(), allowNaN: true);
|
||||
|
||||
// If beatLength is NaN, speedMultiplier should still be 1 because all comparisons against NaN are false.
|
||||
double speedMultiplier = beatLength < 0 ? 100.0 / -beatLength : 1;
|
||||
|
||||
TimeSignature timeSignature = TimeSignature.SimpleQuadruple;
|
||||
@ -412,6 +416,9 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
if (timingChange)
|
||||
{
|
||||
if (double.IsNaN(beatLength))
|
||||
throw new InvalidDataException("Beat length cannot be NaN in a timing control point");
|
||||
|
||||
var controlPoint = CreateTimingControlPoint();
|
||||
|
||||
controlPoint.BeatLength = beatLength;
|
||||
|
@ -168,11 +168,18 @@ namespace osu.Game.Beatmaps.Formats
|
||||
/// </summary>
|
||||
public double BpmMultiplier { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not slider ticks should be generated at this control point.
|
||||
/// This exists for backwards compatibility with maps that abuse NaN slider velocity behavior on osu!stable (e.g. /b/2628991).
|
||||
/// </summary>
|
||||
public bool GenerateTicks { get; private set; } = true;
|
||||
|
||||
public LegacyDifficultyControlPoint(double beatLength)
|
||||
: this()
|
||||
{
|
||||
// Note: In stable, the division occurs on floats, but with compiler optimisations turned on actually seems to occur on doubles via some .NET black magic (possibly inlining?).
|
||||
BpmMultiplier = beatLength < 0 ? Math.Clamp((float)-beatLength, 10, 10000) / 100.0 : 1;
|
||||
GenerateTicks = !double.IsNaN(beatLength);
|
||||
}
|
||||
|
||||
public LegacyDifficultyControlPoint()
|
||||
@ -180,11 +187,16 @@ namespace osu.Game.Beatmaps.Formats
|
||||
SliderVelocityBindable.Precision = double.Epsilon;
|
||||
}
|
||||
|
||||
public override bool IsRedundant(ControlPoint? existing)
|
||||
=> base.IsRedundant(existing)
|
||||
&& GenerateTicks == ((existing as LegacyDifficultyControlPoint)?.GenerateTicks ?? true);
|
||||
|
||||
public override void CopyFrom(ControlPoint other)
|
||||
{
|
||||
base.CopyFrom(other);
|
||||
|
||||
BpmMultiplier = ((LegacyDifficultyControlPoint)other).BpmMultiplier;
|
||||
GenerateTicks = ((LegacyDifficultyControlPoint)other).GenerateTicks;
|
||||
}
|
||||
|
||||
public override bool Equals(ControlPoint? other)
|
||||
@ -193,10 +205,11 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
public bool Equals(LegacyDifficultyControlPoint? other)
|
||||
=> base.Equals(other)
|
||||
&& BpmMultiplier == other.BpmMultiplier;
|
||||
&& BpmMultiplier == other.BpmMultiplier
|
||||
&& GenerateTicks == other.GenerateTicks;
|
||||
|
||||
// ReSharper disable once NonReadonlyMemberInGetHashCode
|
||||
public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), BpmMultiplier);
|
||||
// ReSharper disable twice NonReadonlyMemberInGetHashCode
|
||||
public override int GetHashCode() => HashCode.Combine(base.GetHashCode(), BpmMultiplier, GenerateTicks);
|
||||
}
|
||||
|
||||
internal class LegacySampleControlPoint : SampleControlPoint, IEquatable<LegacySampleControlPoint>
|
||||
|
@ -17,26 +17,26 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
public const double MAX_PARSE_VALUE = int.MaxValue;
|
||||
|
||||
public static float ParseFloat(string input, float parseLimit = (float)MAX_PARSE_VALUE)
|
||||
public static float ParseFloat(string input, float parseLimit = (float)MAX_PARSE_VALUE, bool allowNaN = false)
|
||||
{
|
||||
float output = float.Parse(input, CultureInfo.InvariantCulture);
|
||||
|
||||
if (output < -parseLimit) throw new OverflowException("Value is too low");
|
||||
if (output > parseLimit) throw new OverflowException("Value is too high");
|
||||
|
||||
if (float.IsNaN(output)) throw new FormatException("Not a number");
|
||||
if (!allowNaN && float.IsNaN(output)) throw new FormatException("Not a number");
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public static double ParseDouble(string input, double parseLimit = MAX_PARSE_VALUE)
|
||||
public static double ParseDouble(string input, double parseLimit = MAX_PARSE_VALUE, bool allowNaN = false)
|
||||
{
|
||||
double output = double.Parse(input, CultureInfo.InvariantCulture);
|
||||
|
||||
if (output < -parseLimit) throw new OverflowException("Value is too low");
|
||||
if (output > parseLimit) throw new OverflowException("Value is too high");
|
||||
|
||||
if (double.IsNaN(output)) throw new FormatException("Not a number");
|
||||
if (!allowNaN && double.IsNaN(output)) throw new FormatException("Not a number");
|
||||
|
||||
return output;
|
||||
}
|
||||
|
@ -108,11 +108,10 @@ namespace osu.Game.Database
|
||||
|
||||
bool isBatchImport = tasks.Length >= minimum_items_considered_batch_import;
|
||||
|
||||
try
|
||||
{
|
||||
await Task.WhenAll(tasks.Select(async task =>
|
||||
{
|
||||
notification.CancellationToken.ThrowIfCancellationRequested();
|
||||
if (notification.CancellationToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
@ -128,27 +127,23 @@ namespace osu.Game.Database
|
||||
notification.Progress = (float)current / tasks.Length;
|
||||
}
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, $@"Could not import ({task})", LoggingTarget.Database);
|
||||
}
|
||||
})).ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
|
||||
if (imported.Count == 0)
|
||||
{
|
||||
if (notification.CancellationToken.IsCancellationRequested)
|
||||
{
|
||||
notification.State = ProgressNotificationState.Cancelled;
|
||||
return imported;
|
||||
}
|
||||
}
|
||||
|
||||
if (imported.Count == 0)
|
||||
{
|
||||
notification.Text = $"{HumanisedModelName.Humanize(LetterCasing.Title)} import failed!";
|
||||
notification.State = ProgressNotificationState.Cancelled;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user