1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-04 12:24:42 +08:00

Compare commits

...

60 Commits

396 changed files with 17817 additions and 14768 deletions
@@ -1,20 +0,0 @@
name: Copy labels from linked issues
on:
pull_request:
types: [opened]
permissions:
issues: write
pull-requests: write
contents: read
jobs:
copy-labels:
runs-on: ubuntu-latest
name: Copy labels from linked issues
steps:
- name: Copy labels
uses: michalvankodev/copy-issue-labels@v1.3.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
+1 -1
View File
@@ -10,7 +10,7 @@
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2026.303.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2026.310.0" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.
+9 -12
View File
@@ -5,16 +5,13 @@
android:supportsRtl="true"
android:label="osu!"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher" />
<!-- for editor usage -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
<!--
READ_MEDIA_* permissions are available only on API 33 or greater. Devices with older android versions
don't understand the new permissions, so request the old READ_EXTERNAL_STORAGE permission to get storage access.
Since the old permission has no effect on >= API 33, don't request it.
Care needs to be taken to ensure runtime permission checks target the correct permission for the API level.
-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32"/>
android:roundIcon="@mipmap/ic_launcher">
<provider android:name="androidx.core.content.FileProvider"
android:authorities="sh.ppy.osulazer.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/filepaths" />
</provider>
</application>
</manifest>
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<paths>
<!-- https://developer.android.com/reference/androidx/core/content/FileProvider -->
<external-files-path path="logs" name="logs" />
<external-files-path path="exports" name="exports" />
</paths>
@@ -5,7 +5,7 @@ using BenchmarkDotNet.Attributes;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Carousel;
using osu.Game.Tests.NonVisual.Filtering;
namespace osu.Game.Benchmarks
{
@@ -42,7 +42,7 @@ namespace osu.Game.Benchmarks
Status = BeatmapOnlineStatus.Loved
};
private CarouselBeatmap carouselBeatmap = null!;
private FilterMatchingTest.CarouselBeatmap carouselBeatmap = null!;
private FilterCriteria criteria1 = null!;
private FilterCriteria criteria2 = null!;
private FilterCriteria criteria3 = null!;
@@ -55,7 +55,7 @@ namespace osu.Game.Benchmarks
var beatmap = getExampleBeatmap();
beatmap.OnlineID = 20201010;
beatmap.BeatmapSet = new BeatmapSetInfo { OnlineID = 1535 };
carouselBeatmap = new CarouselBeatmap(beatmap);
carouselBeatmap = new FilterMatchingTest.CarouselBeatmap(beatmap);
criteria1 = new FilterCriteria();
criteria2 = new FilterCriteria
{
@@ -0,0 +1,351 @@
// 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.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Tests.Visual;
using osuTK;
using osuTK.Input;
using DragArea = osu.Game.Screens.Edit.Compose.Components.Timeline.TimelineHitObjectBlueprint.DragArea;
namespace osu.Game.Rulesets.Mania.Tests.Editor
{
public partial class TestSceneHoldNoteTailDrag : EditorTestScene
{
protected override Ruleset CreateEditorRuleset() => new ManiaRuleset();
[SetUpSteps]
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("Clear objects", () => EditorBeatmap.Clear());
}
[Test]
public void TestSimpleTailDragForward()
{
AddStep("Add hold note", () =>
{
EditorBeatmap.Add(new HoldNote { StartTime = 2170, Duration = 937.5 });
});
AddStep("Drag tail", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().Single();
dragForward(blueprintDragArea);
});
AddStep("Release tail", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("Duration is higher", () => ((HoldNote)EditorBeatmap.HitObjects.First())!.Duration > 937.5f);
}
[Test]
public void TestSimpleTailDragBackwards()
{
AddStep("Add hold note", () =>
{
EditorBeatmap.Add(new HoldNote { StartTime = 2170, Duration = 937.5 });
});
AddStep("Drag tail", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().Single();
dragBackward(blueprintDragArea);
});
AddStep("Release tail", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("Duration is lower", () => ((HoldNote)EditorBeatmap.HitObjects[0]).Duration < 937.5f);
}
[Test]
public void TestSamePositionButNotSelectedDragForward()
{
AddStep("Add hold notes", () =>
{
EditorBeatmap.AddRange([
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 0 },
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 1 }
]);
});
AddStep("Drag tail", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().First();
dragForward(blueprintDragArea);
});
AddStep("Release tail", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("Duration is higher, other is unchanged", () =>
((HoldNote)EditorBeatmap.HitObjects[0]).Duration > 937.5f &&
((HoldNote)EditorBeatmap.HitObjects[^1]).Duration == 937.5f
);
}
[Test]
public void TestSamePositionButNotSelectedDragBackward()
{
AddStep("Add hold notes", () =>
{
EditorBeatmap.AddRange([
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 0 },
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 1 }
]);
});
AddStep("Drag tail", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().First();
dragBackward(blueprintDragArea);
});
AddStep("Release tail", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("Duration is lower, other is unchanged", () =>
((HoldNote)EditorBeatmap.HitObjects[0]).Duration < 937.5f &&
((HoldNote)EditorBeatmap.HitObjects[^1]).Duration == 937.5f
);
}
[Test]
public void TestSamePositionSelectedDragForward()
{
AddStep("Add hold notes", () =>
{
EditorBeatmap.AddRange([
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 0 },
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 1 }
]);
});
AddStep("Select all", () =>
{
EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects);
});
AddStep("Drag tail", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().First();
dragForward(blueprintDragArea);
});
AddStep("Release tail", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("Both durations are higher", () =>
((HoldNote)EditorBeatmap.HitObjects[0]).Duration > 937.5f &&
((HoldNote)EditorBeatmap.HitObjects[^1]).Duration > 937.5f
);
}
[Test]
public void TestSamePositionSelectedDragBackward()
{
AddStep("Add hold notes", () =>
{
EditorBeatmap.AddRange([
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 0 },
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 1 }
]);
});
AddStep("Select all", () =>
{
EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects);
});
AddStep("Drag tail", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().First();
dragBackward(blueprintDragArea);
});
AddStep("Release tail", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("Both durations are lower", () =>
((HoldNote)EditorBeatmap.HitObjects[0]).Duration < 937.5f &&
((HoldNote)EditorBeatmap.HitObjects[^1]).Duration < 937.5f
);
}
[Test]
public void TestSelectedButDifferentPositions()
{
AddStep("Add hold notes", () =>
{
EditorBeatmap.AddRange([
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 0 },
new HoldNote { StartTime = 2404, Duration = 937.5, Column = 1 }
]);
});
AddStep("Select all", () =>
{
EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects);
});
AddStep("Drag tail", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().First();
dragBackward(blueprintDragArea);
});
AddStep("Release tail", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("Duration is unchanged, other is lower", () =>
((HoldNote)EditorBeatmap.HitObjects[0]).Duration == 937.5f &&
((HoldNote)EditorBeatmap.HitObjects[^1]).Duration < 937.5f
);
}
[Test]
public void TestSelectedSameStartTimeDifferentDurations()
{
AddStep("Add hold notes", () =>
{
EditorBeatmap.AddRange([
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 0 },
new HoldNote { StartTime = 2170, Duration = 1171.8, Column = 1 }
]);
});
AddStep("Select all", () =>
{
EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects);
});
AddStep("Drag until both match", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().First();
InputManager.MoveMouseTo(blueprintDragArea);
InputManager.PressKey(Key.LShift);
InputManager.PressButton(MouseButton.Left);
InputManager.MoveMouseTo(new Vector2(1000, 110));
});
AddStep("Continue the drag", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().First();
dragBackward(blueprintDragArea);
});
AddStep("Release tail", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("Duration is unchanged, other is lower", () =>
((HoldNote)EditorBeatmap.HitObjects[0]).Duration == 937.5f &&
((HoldNote)EditorBeatmap.HitObjects[^1]).Duration < 937.5f
);
}
[Test]
public void TestSelectedSameDurationDifferentStartTimes()
{
AddStep("Add hold notes", () =>
{
EditorBeatmap.AddRange([
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 0 },
new HoldNote { StartTime = 2638.7, Duration = 937.5, Column = 1 }
]);
});
AddStep("Select all", () =>
{
EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects);
});
AddStep("Drag tail", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().First();
dragBackward(blueprintDragArea);
});
AddStep("Release tail", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("Duration is unchanged, other is lower", () =>
((HoldNote)EditorBeatmap.HitObjects[0]).Duration == 937.5f &&
((HoldNote)EditorBeatmap.HitObjects[^1]).Duration < 937.5f
);
}
[Test]
public void TestDragNoteOutsideOfSelection()
{
AddStep("Add hold notes", () =>
{
EditorBeatmap.AddRange([
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 0 },
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 1 }
]);
});
AddStep("Select the back stack slider", () =>
{
EditorBeatmap.SelectedHitObjects.Add(EditorBeatmap.HitObjects.Last());
});
AddStep("Drag tail", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().First();
dragBackward(blueprintDragArea);
});
AddStep("Release tail", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("Duration is lower, other is unchanged", () =>
((HoldNote)EditorBeatmap.HitObjects[0]).Duration < 937.5f &&
((HoldNote)EditorBeatmap.HitObjects[^1]).Duration == 937.5f
);
}
[Test]
public void TestDragHoldNoteWithNotes()
{
AddStep("Add notes", () =>
{
EditorBeatmap.AddRange([
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 0 },
new Note { StartTime = 2170, Column = 1 },
new Note { StartTime = 3107.5, Column = 2 },
new HoldNote { StartTime = 2170, Duration = 937.5, Column = 3 }
]);
});
AddStep("Select all", () =>
{
EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects);
});
AddStep("Drag tail", () =>
{
var blueprintDragArea = this.ChildrenOfType<DragArea>().First();
dragBackward(blueprintDragArea);
});
AddStep("Release tail", () => InputManager.ReleaseButton(MouseButton.Left));
AddAssert("Both durations are lower", () =>
{
var holdNotes = EditorBeatmap.HitObjects.OfType<HoldNote>();
return holdNotes.First().Duration < 937.5f && holdNotes.Last().Duration < 937.5f;
}
);
}
private void dragForward(DragArea dragArea)
{
InputManager.MoveMouseTo(dragArea);
InputManager.PressButton(MouseButton.Left);
InputManager.MoveMouseTo(new Vector2(1100, 110));
}
private void dragBackward(DragArea dragArea)
{
InputManager.MoveMouseTo(dragArea);
InputManager.PressButton(MouseButton.Left);
InputManager.MoveMouseTo(new Vector2(700, 110));
}
}
}
@@ -62,14 +62,22 @@ namespace osu.Game.Rulesets.Osu.Mods
if (osuObject is not Spinner)
osuObject.TimePreempt += osuObject.StartTime - lastNewComboTime;
int repeatCount = 0;
foreach (var nested in osuObject.NestedHitObjects.OfType<OsuHitObject>())
{
switch (nested)
{
//Freezing the SliderTicks doesnt play well with snaking sliders
// Freezing the SliderTicks doesnt play well with snaking sliders
case SliderTick:
//SliderRepeat wont layer correctly if preempt is changed.
break;
case SliderRepeat:
if (repeatCount > 2)
break;
applyFadeInAdjustment(nested);
repeatCount++;
break;
default:
@@ -11,7 +11,6 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.Filter;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Carousel;
using osu.Game.Screens.Select.Filter;
namespace osu.Game.Tests.NonVisual.Filtering
@@ -588,6 +587,26 @@ namespace osu.Game.Tests.NonVisual.Filtering
Assert.That(visibleBeatmaps, Is.EqualTo(expectedBeatmapIndexes));
}
// This is a temporary class that emulates what these tests originally used from song select v1.
// If anyone ever ends up tidying up these test, here's a starting point:
// https://gist.github.com/peppy/67fda38f6483fd1dd01ef845ed5bf932
public class CarouselBeatmap
{
public readonly BeatmapInfo BeatmapInfo;
public BindableBool Filtered = new BindableBool();
public CarouselBeatmap(BeatmapInfo beatmapInfo)
{
BeatmapInfo = beatmapInfo;
}
public void Filter(FilterCriteria criteria)
{
Filtered.Value = !BeatmapCarouselFilterMatching.CheckCriteriaMatch(BeatmapInfo, criteria);
}
}
private class CustomCriteria : IRulesetFilterCriteria
{
private readonly bool match;
@@ -10,7 +10,6 @@ using osu.Game.Beatmaps;
using osu.Game.Rulesets.Filter;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Carousel;
using osu.Game.Screens.Select.Filter;
namespace osu.Game.Tests.NonVisual.Filtering
@@ -509,7 +508,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
("Another One", "diff ]with [[ brackets]]]"),
("Diff in title", "a"),
("a", "Diff in diff"),
}).Select(info => new CarouselBeatmap(new BeatmapInfo
}).Select(info => new FilterMatchingTest.CarouselBeatmap(new BeatmapInfo
{
Metadata = new BeatmapMetadata
{
File diff suppressed because it is too large Load Diff
@@ -32,7 +32,7 @@ using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.PlayerSettings;
using osu.Game.Screens.Ranking;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Storyboards.Drawables;
using osu.Game.Tests.Resources;
using osuTK;
@@ -15,7 +15,7 @@ using osu.Game.Online.Rooms;
using osu.Game.Overlays;
using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Resources;
using osu.Game.Tests.Visual.Metadata;
using osu.Game.Tests.Visual.OnlinePlay;
@@ -15,7 +15,7 @@ using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Overlays;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Editing
@@ -1046,6 +1046,174 @@ namespace osu.Game.Tests.Visual.Editing
}
}
[Test]
public void TestAddSoundBeforeSettingNonAutoAdditionBankOnSelectedObject()
{
AddStep("select first object", () =>
{
EditorBeatmap.SelectedHitObjects.Clear();
EditorBeatmap.SelectedHitObjects.Add(EditorBeatmap.HitObjects[0]);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
AddStep("add finish sound", () => InputManager.Key(Key.E));
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_FINISH);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasSampleAdditionBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasAutoAdditionBankFlag(0, true);
AddStep("set drum addition bank", () =>
{
InputManager.PressKey(Key.AltLeft);
InputManager.Key(Key.R);
InputManager.ReleaseKey(Key.AltLeft);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_FINISH);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasSampleAdditionBank(0, HitSampleInfo.BANK_DRUM);
hitObjectHasAutoAdditionBankFlag(0, false);
}
[Test]
public void TestAddSoundAfterSettingNonAutoAdditionBankOnSelectedObject()
{
AddStep("select first object", () =>
{
EditorBeatmap.SelectedHitObjects.Clear();
EditorBeatmap.SelectedHitObjects.Add(EditorBeatmap.HitObjects[0]);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
AddStep("set drum addition bank", () =>
{
InputManager.PressKey(Key.AltLeft);
InputManager.Key(Key.R);
InputManager.ReleaseKey(Key.AltLeft);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
AddStep("add finish sound", () => InputManager.Key(Key.E));
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_FINISH);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasSampleAdditionBank(0, HitSampleInfo.BANK_DRUM);
hitObjectHasAutoAdditionBankFlag(0, false);
}
[Test]
public void TestSwitchSoundAfterSettingNonAutoAdditionBankOnSelectedObject()
{
AddStep("select first object", () =>
{
EditorBeatmap.SelectedHitObjects.Clear();
EditorBeatmap.SelectedHitObjects.Add(EditorBeatmap.HitObjects[0]);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
AddStep("set drum addition bank", () =>
{
InputManager.PressKey(Key.AltLeft);
InputManager.Key(Key.R);
InputManager.ReleaseKey(Key.AltLeft);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
AddStep("add finish sound", () => InputManager.Key(Key.E));
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_FINISH);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasSampleAdditionBank(0, HitSampleInfo.BANK_DRUM);
hitObjectHasAutoAdditionBankFlag(0, false);
AddStep("remove finish sound", () => InputManager.Key(Key.E));
AddStep("add whistle sound", () => InputManager.Key(Key.W));
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_WHISTLE);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasSampleAdditionBank(0, HitSampleInfo.BANK_DRUM);
hitObjectHasAutoAdditionBankFlag(0, false);
}
[Test]
public void TestAddSoundBeforeSettingAutoAdditionBankOnSelectedObject()
{
AddStep("select first object", () =>
{
EditorBeatmap.SelectedHitObjects.Clear();
EditorBeatmap.SelectedHitObjects.Add(EditorBeatmap.HitObjects[0]);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
AddStep("add finish sound", () => InputManager.Key(Key.E));
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_FINISH);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasSampleAdditionBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasAutoAdditionBankFlag(0, true);
AddStep("set auto addition bank", () =>
{
InputManager.PressKey(Key.AltLeft);
InputManager.Key(Key.Q);
InputManager.ReleaseKey(Key.AltLeft);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_FINISH);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasSampleAdditionBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasAutoAdditionBankFlag(0, true);
AddStep("set drum normal bank", () =>
{
InputManager.PressKey(Key.ShiftLeft);
InputManager.Key(Key.R);
InputManager.ReleaseKey(Key.ShiftLeft);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_FINISH);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_DRUM);
hitObjectHasSampleAdditionBank(0, HitSampleInfo.BANK_DRUM);
hitObjectHasAutoAdditionBankFlag(0, true);
}
[Test]
public void TestAddSoundAfterSettingAutoAdditionBankOnSelectedObject()
{
AddStep("select first object", () =>
{
EditorBeatmap.SelectedHitObjects.Clear();
EditorBeatmap.SelectedHitObjects.Add(EditorBeatmap.HitObjects[0]);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
AddStep("set auto addition bank", () =>
{
InputManager.PressKey(Key.AltLeft);
InputManager.Key(Key.Q);
InputManager.ReleaseKey(Key.AltLeft);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
AddStep("add finish sound", () => InputManager.Key(Key.E));
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_FINISH);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasSampleAdditionBank(0, HitSampleInfo.BANK_NORMAL);
hitObjectHasAutoAdditionBankFlag(0, true);
AddStep("set drum normal bank", () =>
{
InputManager.PressKey(Key.ShiftLeft);
InputManager.Key(Key.R);
InputManager.ReleaseKey(Key.ShiftLeft);
});
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_FINISH);
hitObjectHasSampleNormalBank(0, HitSampleInfo.BANK_DRUM);
hitObjectHasSampleAdditionBank(0, HitSampleInfo.BANK_DRUM);
hitObjectHasAutoAdditionBankFlag(0, true);
}
private void clickSamplePiece(int objectIndex) => AddStep($"click {objectIndex.ToOrdinalWords()} sample piece", () =>
{
var samplePiece = this.ChildrenOfType<SamplePointPiece>().Single(piece => piece is not NodeSamplePointPiece && piece.HitObject == EditorBeatmap.HitObjects.ElementAt(objectIndex));
@@ -14,7 +14,7 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Menu;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Visual.Editing
@@ -19,7 +19,7 @@ using osu.Game.Screens.Menu;
using osu.Game.Screens.Play;
using osuTK;
namespace osu.Game.Tests.Visual.SongSelect
namespace osu.Game.Tests.Visual.Gameplay
{
public partial class TestSceneBeatmapMetadataDisplay : OsuTestScene
{
@@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.Play.Leaderboards;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.Gameplay
@@ -14,6 +14,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.IO.Stores;
using osu.Framework.Testing;
using osu.Framework.Timing;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
@@ -53,12 +54,20 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestSpriteFadeOverflowBehaviour()
{
ManualClock manualClock = new ManualClock();
AddStep("allow storyboard lookup", () =>
{
storyboard.UseSkinSprites = false;
storyboard.ProvideResources = true;
});
AddStep("create sprite", () => SetContents(_ =>
{
var layer = storyboard.GetLayer("Background");
var sprite = new StoryboardSprite(lookup_name, Anchor.TopLeft, new Vector2(256, 192));
sprite.Commands.AddAlpha(Easing.None, Time.Current, Time.Current + 2000, 0, 2);
sprite.Commands.AddAlpha(Easing.None, 0, 2000, 0, 2);
layer.Elements.Clear();
layer.Add(sprite);
@@ -68,13 +77,16 @@ namespace osu.Game.Tests.Visual.Gameplay
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
storyboard.CreateDrawable()
storyboard.CreateDrawable().With(d => d.Clock = new FramedClock(manualClock))
}
};
}));
AddStep("seek to 1000 ms", () => manualClock.CurrentTime = 900);
AddUntilStep("sprite reached high opacity once", () => sprites.All(sprite => sprite.ChildrenOfType<Sprite>().All(s => s.Alpha > 0.8f)));
AddStep("seek to 2000 ms", () => manualClock.CurrentTime = 1100);
AddUntilStep("sprite reset to low opacity", () => sprites.All(sprite => sprite.ChildrenOfType<Sprite>().All(s => s.Alpha < 0.2f)));
AddStep("seek to 2000 ms", () => manualClock.CurrentTime = 1900);
AddUntilStep("sprite reached high opacity twice", () => sprites.All(sprite => sprite.ChildrenOfType<Sprite>().All(s => s.Alpha > 0.8f)));
}
@@ -21,7 +21,7 @@ using osu.Game.Rulesets.Osu;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.Play.Leaderboards;
using osu.Game.Tests.Gameplay;
using osuTK.Graphics;
@@ -25,7 +25,7 @@ using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.Play.Leaderboards;
using osu.Game.Skinning;
using osu.Game.Tests.Gameplay;
using osu.Game.Tests.Visual.Spectator;
@@ -15,7 +15,7 @@ using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.Play.Leaderboards;
using osu.Game.Tests.Gameplay;
using osuTK.Input;
@@ -21,7 +21,7 @@ using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.Play.Leaderboards;
using osu.Game.Skinning;
using osu.Game.Tests.Gameplay;
@@ -10,7 +10,7 @@ using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets.Osu;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.Play.Leaderboards;
using osu.Game.Tests.Gameplay;
namespace osu.Game.Tests.Visual.Gameplay
@@ -6,16 +6,16 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Online.API.Requests.Responses;
using osuTK.Graphics;
using osu.Game.Online.Leaderboards;
using osu.Game.Overlays;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Scoring;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Scoring;
using osu.Game.Users;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.SongSelect
namespace osu.Game.Tests.Visual.Gameplay
{
public partial class TestSceneUserTopScoreContainer : OsuTestScene
{
@@ -7,6 +7,7 @@ using osu.Framework.Allocation;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Matchmaking;
using osu.Game.Screens.OnlinePlay.Matchmaking.Intro;
using osu.Game.Screens.OnlinePlay.Matchmaking.Queue;
using osu.Game.Tests.Visual.Multiplayer;
@@ -26,7 +27,7 @@ namespace osu.Game.Tests.Visual.Matchmaking
{
base.SetUpSteps();
AddStep("load screen", () => LoadScreen(new ScreenIntro()));
AddStep("load screen", () => LoadScreen(new ScreenIntro(MatchmakingPoolType.QuickPlay)));
}
[Test]
@@ -21,7 +21,7 @@ using osu.Game.Online.Spectator;
using osu.Game.Replays.Legacy;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.Play.Leaderboards;
namespace osu.Game.Tests.Visual.Multiplayer
{
@@ -125,7 +125,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
protected void AddBeatmapFromSongSelect(Func<BeatmapInfo> beatmap, RulesetInfo? ruleset = null, IReadOnlyList<Mod>? mods = null)
{
Screens.SelectV2.SongSelect? songSelect = null;
Screens.Select.SongSelect? songSelect = null;
AddStep("click add button", () =>
{
@@ -133,7 +133,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
InputManager.Click(MouseButton.Left);
});
AddUntilStep("wait for song select", () => (songSelect = CurrentSubScreen as Screens.SelectV2.SongSelect) != null);
AddUntilStep("wait for song select", () => (songSelect = CurrentSubScreen as Screens.Select.SongSelect) != null);
AddUntilStep("wait for loaded", () => songSelect.IsCurrentScreen() && !songSelect.AsNonNull().IsFiltering);
if (ruleset != null)
@@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
private void selectNewItem(Func<BeatmapInfo> beatmap)
{
Screens.SelectV2.SongSelect? songSelect = null;
Screens.Select.SongSelect? songSelect = null;
AddUntilStep("wait for playlist panels to load", () =>
{
@@ -103,7 +103,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
InputManager.Click(MouseButton.Left);
});
AddUntilStep("wait for song select", () => (songSelect = CurrentSubScreen as Screens.SelectV2.SongSelect) != null);
AddUntilStep("wait for song select", () => (songSelect = CurrentSubScreen as Screens.Select.SongSelect) != null);
AddUntilStep("wait for loaded", () => songSelect.IsCurrentScreen() && !songSelect.AsNonNull().IsFiltering);
BeatmapInfo otherBeatmap = null!;
@@ -1,52 +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.
using System.Linq;
using osu.Framework.Graphics;
using osu.Game.Online.API;
using osu.Game.Online.Rooms;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.OnlinePlay.Components;
using osu.Game.Tests.Beatmaps;
using osu.Game.Tests.Visual.OnlinePlay;
using osuTK;
namespace osu.Game.Tests.Visual.Multiplayer
{
public partial class TestSceneMatchBeatmapDetailArea : OnlinePlayTestScene
{
private Room room = null!;
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("create area", () =>
{
Child = new MatchBeatmapDetailArea(room = new Room())
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(500),
CreateNewItem = createNewItem
};
});
}
private void createNewItem()
{
room.Playlist = room.Playlist.Append(new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo)
{
ID = room.Playlist.Count,
RulesetID = new OsuRuleset().RulesetInfo.OnlineID,
RequiredMods = new[]
{
new APIMod(new OsuModHardRock()),
new APIMod(new OsuModDoubleTime()),
new APIMod(new OsuModAutoplay())
}
}).ToArray();
}
}
}
@@ -10,7 +10,7 @@ using osu.Framework.Timing;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Multiplayer;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.Play.Leaderboards;
namespace osu.Game.Tests.Visual.Multiplayer
{
@@ -9,7 +9,7 @@ using osu.Game.Online.API;
using osu.Game.Online.Multiplayer;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.Play.Leaderboards;
namespace osu.Game.Tests.Visual.Multiplayer
{
@@ -7,7 +7,7 @@ using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
using osu.Game.Screens.OnlinePlay.Multiplayer;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.Play.Leaderboards;
namespace osu.Game.Tests.Visual.Multiplayer
{
@@ -12,7 +12,7 @@ using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.OnlinePlay.Multiplayer;
using osu.Game.Screens.Play;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.Play.Leaderboards;
using osu.Game.Tests.Gameplay;
namespace osu.Game.Tests.Visual.Multiplayer
@@ -26,8 +26,8 @@ using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.GameplayTest;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
using osu.Game.Tests.Resources;
using osuTK.Input;
@@ -5,7 +5,7 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Screens.Menu;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Navigation
@@ -15,7 +15,7 @@ using osu.Game.Input.Bindings;
using osu.Game.Overlays.Settings.Sections.Input;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Beatmaps.IO;
using osuTK.Input;
@@ -5,7 +5,7 @@ using NUnit.Framework;
using osu.Framework.Extensions;
using osu.Game.Configuration;
using osu.Game.Screens.Play;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Beatmaps.IO;
using osuTK.Input;
@@ -17,7 +17,7 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Screens;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Beatmaps.IO;
using osuTK.Input;
@@ -16,7 +16,7 @@ using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Menu;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual.Navigation
{
@@ -18,8 +18,8 @@ using osu.Game.Screens;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking;
using osu.Game.Screens.SelectV2;
using FilterControl = osu.Game.Screens.SelectV2.FilterControl;
using osu.Game.Screens.Select;
using FilterControl = osu.Game.Screens.Select.FilterControl;
namespace osu.Game.Tests.Visual.Navigation
{
@@ -349,8 +349,8 @@ namespace osu.Game.Tests.Visual.Navigation
AutoSizeAxes = Axes.Both,
Children = new[]
{
new ShearedButton(200) { Text = "Action #1", Action = () => { } },
new ShearedButton(140) { Text = "Action #2", Action = () => { } },
new ShearedButton { Width = 200, Text = "Action #1", Action = () => { } },
new ShearedButton { Width = 140, Text = "Action #2", Action = () => { } },
}
};
}
@@ -48,15 +48,16 @@ using osu.Game.Screens.OnlinePlay.Match.Components;
using osu.Game.Screens.OnlinePlay.Playlists;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Play.Leaderboards;
using osu.Game.Screens.Play.PlayerSettings;
using osu.Game.Screens.Ranking;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Beatmaps.IO;
using osu.Game.Tests.Resources;
using osu.Game.Utils;
using osuTK;
using osuTK.Input;
using CollectionDropdown = osu.Game.Screens.Select.CollectionDropdown;
namespace osu.Game.Tests.Visual.Navigation
{
@@ -197,14 +198,14 @@ namespace osu.Game.Tests.Visual.Navigation
AddStep("set filter again", () => filterControlTextBox().Current.Value = "test");
AddStep("open collections dropdown", () =>
{
InputManager.MoveMouseTo(songSelect.ChildrenOfType<Screens.SelectV2.CollectionDropdown>().Single());
InputManager.MoveMouseTo(songSelect.ChildrenOfType<CollectionDropdown>().Single());
InputManager.Click(MouseButton.Left);
});
AddStep("press back once", () => InputManager.Click(MouseButton.Button1));
AddAssert("still at song select", () => Game.ScreenStack.CurrentScreen == songSelect);
AddAssert("collections dropdown closed", () => songSelect
.ChildrenOfType<Screens.SelectV2.CollectionDropdown>().Single()
.ChildrenOfType<CollectionDropdown>().Single()
.ChildrenOfType<Dropdown<CollectionFilterMenuItem>.DropdownMenu>().Single().State == MenuState.Closed);
AddStep("press back a second time", () => InputManager.Click(MouseButton.Button1));
@@ -317,7 +318,7 @@ namespace osu.Game.Tests.Visual.Navigation
[Test]
public void TestAttemptPlayBeatmapWrongHashFails()
{
Screens.SelectV2.SongSelect songSelect = null;
Screens.Select.SongSelect songSelect = null;
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).GetResultSafely());
PushAndConfirm(() => songSelect = new SoloSongSelect());
@@ -352,7 +353,7 @@ namespace osu.Game.Tests.Visual.Navigation
[Test]
public void TestAttemptPlayBeatmapMissingFails()
{
Screens.SelectV2.SongSelect songSelect = null;
Screens.Select.SongSelect songSelect = null;
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).GetResultSafely());
PushAndConfirm(() => songSelect = new SoloSongSelect());
@@ -386,7 +387,7 @@ namespace osu.Game.Tests.Visual.Navigation
{
Player player = null;
Screens.SelectV2.SongSelect songSelect = null;
Screens.Select.SongSelect songSelect = null;
PushAndConfirm(() => songSelect = new SoloSongSelect());
AddUntilStep("wait for song select", () => songSelect.CarouselItemsPresented);
@@ -429,7 +430,7 @@ namespace osu.Game.Tests.Visual.Navigation
{
Player player = null;
Screens.SelectV2.SongSelect songSelect = null;
Screens.Select.SongSelect songSelect = null;
PushAndConfirm(() => songSelect = new SoloSongSelect());
AddUntilStep("wait for song select", () => songSelect.CarouselItemsPresented);
@@ -483,7 +484,7 @@ namespace osu.Game.Tests.Visual.Navigation
{
Player player = null;
Screens.SelectV2.SongSelect songSelect = null;
Screens.Select.SongSelect songSelect = null;
PushAndConfirm(() => songSelect = new SoloSongSelect());
AddUntilStep("wait for song select", () => songSelect.CarouselItemsPresented);
@@ -526,7 +527,7 @@ namespace osu.Game.Tests.Visual.Navigation
{
Player player = null;
Screens.SelectV2.SongSelect songSelect = null;
Screens.Select.SongSelect songSelect = null;
PushAndConfirm(() => songSelect = new SoloSongSelect());
AddUntilStep("wait for song select", () => songSelect.CarouselItemsPresented);
@@ -1194,9 +1195,9 @@ namespace osu.Game.Tests.Visual.Navigation
AddStep("close settings sidebar", () => InputManager.Key(Key.Escape));
Screens.SelectV2.SongSelect songSelect = null;
Screens.Select.SongSelect songSelect = null;
AddRepeatStep("go to solo", () => InputManager.Key(Key.P), 3);
AddUntilStep("wait for song select", () => (songSelect = Game.ScreenStack.CurrentScreen as Screens.SelectV2.SongSelect) != null);
AddUntilStep("wait for song select", () => (songSelect = Game.ScreenStack.CurrentScreen as Screens.Select.SongSelect) != null);
AddUntilStep("wait for beatmap sets loaded", () => songSelect.CarouselItemsPresented);
AddStep("switch to osu! ruleset", () =>
@@ -1281,7 +1282,7 @@ namespace osu.Game.Tests.Visual.Navigation
[Test]
public void TestExitSongSelectAndImmediatelyClickLogo()
{
Screens.SelectV2.SongSelect songSelect = null;
Screens.Select.SongSelect songSelect = null;
PushAndConfirm(() => songSelect = new SoloSongSelect());
AddUntilStep("wait for song select", () => songSelect.CarouselItemsPresented);
@@ -1312,7 +1313,7 @@ namespace osu.Game.Tests.Visual.Navigation
{
BeatmapSetInfo beatmap = null;
Screens.SelectV2.SongSelect songSelect = null;
Screens.Select.SongSelect songSelect = null;
PushAndConfirm(() => songSelect = new SoloSongSelect());
AddUntilStep("wait for song select", () => songSelect.CarouselItemsPresented);
@@ -1371,7 +1372,7 @@ namespace osu.Game.Tests.Visual.Navigation
IWorkingBeatmap beatmap() => Game.Beatmap.Value;
Screens.SelectV2.SongSelect songSelect = null;
Screens.Select.SongSelect songSelect = null;
PushAndConfirm(() => songSelect = new SoloSongSelect());
AddUntilStep("wait for song select", () => songSelect.CarouselItemsPresented);
@@ -27,7 +27,7 @@ using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Play;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Play.HUD.HitErrorMeters;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Skinning;
using osu.Game.Tests.Beatmaps.IO;
using osuTK;
@@ -24,17 +24,13 @@ using osu.Game.Screens.Footer;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Beatmaps.IO;
using osu.Game.Tests.Resources;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Navigation
{
/// <summary>
/// Tests copied out of `TestSceneScreenNavigation` which are specific to song select.
/// These are for SongSelectV2. Eventually, the tests in the above class should be deleted along with old song select.
/// </summary>
public partial class TestSceneSongSelectNavigation : OsuGameTestScene
{
[Test]
@@ -86,6 +82,8 @@ namespace osu.Game.Tests.Visual.Navigation
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
AddStep("open menu", () => InputManager.Key(Key.F3));
AddUntilStep("wait for footer focus", () => InputManager.FocusedDrawable is FooterButtonOptions.Popover);
AddStep("trigger edit", () =>
{
// TODO: should be 5, not 4.
@@ -277,7 +275,7 @@ namespace osu.Game.Tests.Visual.Navigation
/// <summary>
/// Note: This test was written to demonstrate the failure described at https://github.com/ppy/osu/issues/35023,
/// but because the failure scenario there entailed a race condition, it was possible for the test to pass regardless
/// unless <see cref="osu.Game.Screens.SelectV2.SongSelect.SELECTION_DEBOUNCE"/> was increased.
/// unless <see cref="osu.Game.Screens.Select.SongSelect.SELECTION_DEBOUNCE"/> was increased.
/// </summary>
[Test]
public void TestPresentFromResults()
@@ -12,15 +12,15 @@ using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Localisation;
using osu.Game.Overlays.BeatmapSet;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.Select.Details;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.SongSelect
namespace osu.Game.Tests.Visual.Online
{
[System.ComponentModel.Description("Advanced beatmap statistics display")]
public partial class TestSceneAdvancedStats : OsuTestScene
@@ -22,7 +22,6 @@ using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.BeatmapSet.Scores;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.Select.Details;
using APIUser = osu.Game.Online.API.Requests.Responses.APIUser;
namespace osu.Game.Tests.Visual.Online
@@ -278,7 +277,7 @@ namespace osu.Game.Tests.Visual.Online
public void TestSelectedModsDontAffectStatistics()
{
AddStep("show map", () => overlay.ShowBeatmapSet(getBeatmapSet()));
AddAssert("AR displayed as 0", () => overlay.ChildrenOfType<AdvancedStats.StatisticRow>().Single(s => s.Title == SongSelectStrings.ApproachRate).Value, () => Is.EqualTo((0, 0)));
AddAssert("AR displayed as 7", () => overlay.ChildrenOfType<AdvancedStats.StatisticRow>().Single(s => s.Title == SongSelectStrings.ApproachRate).Value, () => Is.EqualTo((7.0f, 7.0f)));
AddStep("set AR10 diff adjust", () => SelectedMods.Value = new[]
{
new OsuModDifficultyAdjust
@@ -286,7 +285,7 @@ namespace osu.Game.Tests.Visual.Online
ApproachRate = { Value = 10 }
}
});
AddAssert("AR still displayed as 0", () => overlay.ChildrenOfType<AdvancedStats.StatisticRow>().Single(s => s.Title == SongSelectStrings.ApproachRate).Value, () => Is.EqualTo((0, 0)));
AddAssert("AR still displayed as 7", () => overlay.ChildrenOfType<AdvancedStats.StatisticRow>().Single(s => s.Title == SongSelectStrings.ApproachRate).Value, () => Is.EqualTo((7.0f, 7.0f)));
}
[Test]
@@ -12,7 +12,6 @@ using osu.Game.Beatmaps;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Game.Overlays.BeatmapSet;
using osu.Game.Screens.Select.Details;
namespace osu.Game.Tests.Visual.Online
{
@@ -16,7 +16,6 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Game.Overlays.BeatmapSet;
using osu.Game.Screens.Select.Details;
using osuTK;
using osuTK.Graphics;
@@ -4,9 +4,9 @@
using osu.Game.Overlays.BeatmapSet;
using osu.Framework.Graphics;
using osu.Framework.Bindables;
using osu.Game.Screens.Select.Leaderboards;
using osu.Framework.Allocation;
using osu.Game.Overlays;
using osu.Game.Screens.Play.Leaderboards;
namespace osu.Game.Tests.Visual.Online
{
@@ -116,6 +116,33 @@ needs_cleanup: true
});
}
[Test]
public void TestOutdatedNoticeBoxWithSuffixComments()
{
AddStep("Add outdated yaml with comments", () =>
{
markdownContainer.Text = @"---
outdated: true # not sure about the format for ""list of mods"".
---";
});
AddAssert("Outdated notice box visible", () => markdownContainer.ChildrenOfType<Container>().Any());
}
[Test]
public void TestCommentedOutFrontMatter()
{
AddStep("Add commented out front matter", () =>
{
markdownContainer.Text = @"---
#outdated: true
# outdated: true
---";
});
AddAssert("No notice box visible", () => !markdownContainer.ChildrenOfType<Container>().Any());
}
[Test]
public void TestAbsoluteImage()
{
@@ -0,0 +1,78 @@
// 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.IO;
using System.Linq;
using Newtonsoft.Json;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Tests.Resources;
using osu.Game.Tests.Visual.Multiplayer;
namespace osu.Game.Tests.Visual.RankedPlay
{
public abstract partial class RankedPlayTestScene : MultiplayerTestScene
{
/// <summary>
/// Returns 5 sample <see cref="APIBeatmap"/>s.
/// </summary>
protected static APIBeatmap[] GetSampleBeatmaps()
{
using var resourceStream = TestResources.OpenResource("Requests/api-beatmaps-rankedplay.json");
using var reader = new StreamReader(resourceStream);
return JsonConvert.DeserializeObject<APIBeatmap[]>(reader.ReadToEnd())!;
}
/// <summary>
/// A request handler that will resolve api requests to any beatmaps provided by <see cref="GetSampleBeatmaps"/>.
/// </summary>
public class BeatmapRequestHandler
{
public readonly APIBeatmap[] Beatmaps = GetSampleBeatmaps();
public bool HandleRequest(APIRequest request)
{
switch (request)
{
case GetBeatmapRequest beatmapRequest:
var beatmap = Beatmaps.FirstOrDefault(it => it.OnlineID == beatmapRequest.OnlineID);
if (beatmap != null)
{
beatmapRequest.TriggerSuccess(beatmap);
return true;
}
break;
case GetBeatmapsRequest beatmapsRequest:
beatmapsRequest.TriggerSuccess(new GetBeatmapsResponse
{
Beatmaps = beatmapsRequest
.BeatmapIds
.Select(id => Beatmaps.FirstOrDefault(it => it.OnlineID == id))
.ToList()
});
return true;
}
return false;
}
}
public class RevealedRankedPlayCardWithPlaylistItem : RankedPlayCardWithPlaylistItem
{
public RevealedRankedPlayCardWithPlaylistItem(APIBeatmap beatmap, RankedPlayCardItem? card = null)
: base(card ?? new RankedPlayCardItem())
{
PlaylistItem.Value = new MultiplayerPlaylistItem(new PlaylistItem(beatmap));
}
}
}
}
@@ -0,0 +1,32 @@
// 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 osu.Framework.Extensions;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Tests.Visual.Multiplayer;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneDiscardScreen : MultiplayerTestScene
{
private RankedPlayScreen screen = null!;
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("join room", () => JoinRoom(CreateDefaultRoom(MatchType.RankedPlay)));
WaitForJoined();
AddStep("add other user", () => MultiplayerClient.AddUser(new MultiplayerRoomUser(2)));
AddStep("load screen", () => LoadScreen(screen = new RankedPlayScreen(MultiplayerClient.ClientRoom!)));
AddUntilStep("screen loaded", () => screen.IsLoaded);
AddStep("set pick state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardDiscard).WaitSafely());
}
}
}
@@ -0,0 +1,63 @@
// 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 NUnit.Framework;
using osu.Framework.Extensions;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Tests.Visual.Multiplayer;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneEndedScreen : MultiplayerTestScene
{
private RankedPlayScreen screen = null!;
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("join room", () => JoinRoom(CreateDefaultRoom(MatchType.RankedPlay)));
WaitForJoined();
AddStep("add other user", () => MultiplayerClient.AddUser(new MultiplayerRoomUser(2)));
AddStep("load screen", () => LoadScreen(screen = new RankedPlayScreen(MultiplayerClient.ClientRoom!)));
AddUntilStep("screen loaded", () => screen.IsLoaded);
}
[Test]
public void TestVictory()
{
AddStep("set results state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.Ended, s =>
{
s.WinningUserId = API.LocalUser.Value.OnlineID;
s.Users[API.LocalUser.Value.OnlineID].RatingAfter = 1520;
s.Users[2].RatingAfter = 1480;
}).WaitSafely());
}
[Test]
public void TestDefeat()
{
AddStep("set results state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.Ended, s =>
{
s.WinningUserId = 2;
s.Users[API.LocalUser.Value.OnlineID].RatingAfter = 1480;
s.Users[2].RatingAfter = 1520;
}).WaitSafely());
}
[Test]
public void TestDraw()
{
AddStep("set results state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.Ended, s =>
{
s.Users[API.LocalUser.Value.OnlineID].RatingAfter = 1480;
s.Users[2].RatingAfter = 1520;
}).WaitSafely());
}
}
}
@@ -0,0 +1,49 @@
// 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 osu.Framework.Extensions;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Tests.Beatmaps;
using osu.Game.Tests.Visual.Multiplayer;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneGameplayWarmupScreen : MultiplayerTestScene
{
private RankedPlayScreen screen = null!;
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("join room", () =>
{
var beatmap = new TestBeatmap(Ruleset.Value).BeatmapInfo;
beatmap.StarRating = 2;
var room = CreateDefaultRoom(MatchType.RankedPlay);
room.Playlist =
[
new PlaylistItem(beatmap)
{
RulesetID = Ruleset.Value.OnlineID
}
];
JoinRoom(room);
});
WaitForJoined();
AddStep("add other user", () => MultiplayerClient.AddUser(new MultiplayerRoomUser(2)));
AddStep("load screen", () => LoadScreen(screen = new RankedPlayScreen(MultiplayerClient.ClientRoom!)));
AddUntilStep("screen loaded", () => screen.IsLoaded);
AddStep("play card", () => MultiplayerClient.PlayCard(new RankedPlayCardItem()));
AddStep("set warmup state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.GameplayWarmup).WaitSafely());
}
}
}
@@ -0,0 +1,140 @@
// 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.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Utils;
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
using osu.Game.Online.RankedPlay;
using osu.Game.Online.Rooms;
using osu.Game.Overlays;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Hand;
using osu.Game.Tests.Visual.Multiplayer;
using osuTK;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneHandReplay : MultiplayerTestScene
{
private PlayerHandOfCards playerHand = null!;
private OpponentHandOfCards opponentHand = null!;
private TestHandReplayRecorder recorder = null!;
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink);
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("join room", () => JoinRoom(CreateDefaultRoom(MatchType.RankedPlay)));
WaitForJoined();
AddStep("setup", () =>
{
var cards = Enumerable.Range(0, 5)
.Select(_ => new RankedPlayCardWithPlaylistItem(new RankedPlayCardItem()))
.ToArray();
Children =
[
playerHand = new PlayerHandOfCards
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.5f),
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
SelectionMode = HandSelectionMode.Multiple
},
opponentHand = new OpponentHandOfCards
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.5f),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
new HandReplayPlayer(API.LocalUser.Value.OnlineID, opponentHand),
recorder = new TestHandReplayRecorder(playerHand)
{
FlushInterval = flushInterval,
RecordInterval = recordInterval,
}
];
foreach (var card in cards)
{
playerHand.AddCard(card);
opponentHand.AddCard(card);
}
});
}
private double flushInterval = 1000;
private double recordInterval = 25;
private double fixedLatency;
private double maxLatency;
[Test]
public void TestCardHandReplay()
{
AddSliderStep("record interval", 0.0, 1000.0, 25.0, value =>
{
recordInterval = value;
recreateRecorder();
});
AddSliderStep("flush interval", 0.0, 5000.0, 1000.0, value =>
{
flushInterval = value;
recreateRecorder();
});
AddSliderStep("latency", 0.0, 5000.0, 0.0, value =>
{
fixedLatency = value;
recreateRecorder();
});
AddSliderStep("randomize latency", 0.0, 5000.0, 0.0, value =>
{
maxLatency = value;
recreateRecorder();
});
}
private void recreateRecorder()
{
if (recorder.IsNotNull())
{
Remove(recorder, true);
Add(recorder = new TestHandReplayRecorder(playerHand)
{
FlushInterval = flushInterval,
RecordInterval = recordInterval,
FixedLatency = fixedLatency,
RandomLatency = maxLatency,
});
}
}
private partial class TestHandReplayRecorder(PlayerHandOfCards handOfCards) : HandReplayRecorder(handOfCards)
{
private double lastSendTime;
public double FixedLatency;
public double RandomLatency;
protected override void Flush(RankedPlayCardHandReplayFrame[] frames)
{
double sendTime = Math.Max(lastSendTime, Time.Current + FixedLatency + RNG.NextDouble(RandomLatency));
lastSendTime = sendTime;
Scheduler.AddDelayed(() => base.Flush(frames), sendTime - Time.Current);
}
}
}
}
@@ -0,0 +1,37 @@
// 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 osu.Game.Online.API.Requests.Responses;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Intro;
using osu.Game.Tests.Visual.Matchmaking;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneIntroScreen : MatchmakingTestScene
{
public override void SetUpSteps()
{
base.SetUpSteps();
IntroScreen introScreen = null!;
AddStep("Add screen", () => Child = introScreen = new IntroScreen());
AddStep("play animation", () => introScreen.PlayIntroSequence(
new UserWithRating(new APIUser
{
Id = 2,
Username = "User 1",
CoverUrl = "https://assets.ppy.sh/user-profile-covers/13845312/53e4eda7ad3ce41f0990c041179d8ab5d553fef988835f346a8d8da0482506ec.png"
}, 1234),
new UserWithRating(new APIUser
{
Id = 3,
Username = "User 2",
CoverUrl = "https://assets.ppy.sh/user-profile-covers/14102976/10144df2f1c6fb2101726e0f89087a6061bc75755d88e59a9faf2c84034f2c71.jpeg"
}, 1234),
6.3f
));
}
}
}
@@ -0,0 +1,32 @@
// 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 osu.Framework.Extensions;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Tests.Visual.Multiplayer;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneOpponentPickScreen : MultiplayerTestScene
{
private RankedPlayScreen screen = null!;
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("join room", () => JoinRoom(CreateDefaultRoom(MatchType.RankedPlay)));
WaitForJoined();
AddStep("add other user", () => MultiplayerClient.AddUser(new MultiplayerRoomUser(2)));
AddStep("load screen", () => LoadScreen(screen = new RankedPlayScreen(MultiplayerClient.ClientRoom!)));
AddUntilStep("screen loaded", () => screen.IsLoaded);
AddStep("set pick state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardPlay, state => state.ActiveUserId = 2).WaitSafely());
}
}
}
@@ -0,0 +1,32 @@
// 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 osu.Framework.Extensions;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Tests.Visual.Multiplayer;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestScenePickScreen : MultiplayerTestScene
{
private RankedPlayScreen screen = null!;
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("join room", () => JoinRoom(CreateDefaultRoom(MatchType.RankedPlay)));
WaitForJoined();
AddStep("add other user", () => MultiplayerClient.AddUser(new MultiplayerRoomUser(2)));
AddStep("load screen", () => LoadScreen(screen = new RankedPlayScreen(MultiplayerClient.ClientRoom!)));
AddUntilStep("screen loaded", () => screen.IsLoaded);
AddStep("set pick state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardPlay, state => state.ActiveUserId = API.LocalUser.Value.OnlineID).WaitSafely());
}
}
}
@@ -0,0 +1,161 @@
// 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.Linq;
using Humanizer;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
using osu.Game.Overlays;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Hand;
using osuTK.Input;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestScenePlayerCardHand : OsuManualInputManagerTestScene
{
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
private PlayerHandOfCards handOfCards = null!;
[BackgroundDependencyLoader]
private void load()
{
Child = handOfCards = new PlayerHandOfCards
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.Both,
Height = 0.5f,
};
}
[Test]
public void TestSingleSelectionMode()
{
AddStep("add cards", () =>
{
handOfCards.Clear();
for (int i = 0; i < 5; i++)
handOfCards.AddCard(new RankedPlayCardWithPlaylistItem(new RankedPlayCardItem()));
});
AddStep("single selection mode", () => handOfCards.SelectionMode = HandSelectionMode.Single);
AddStep("click first card", () => handOfCards.Cards.First().TriggerClick());
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.First().Item]));
AddStep("click second card", () => handOfCards.Cards.ElementAt(1).TriggerClick());
AddAssert("second card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(1).Item]));
AddStep("click second card again", () => handOfCards.Cards.ElementAt(1).TriggerClick());
AddAssert("second card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(1).Item]));
}
[Test]
public void TestMultiSelectionMode()
{
AddStep("add cards", () =>
{
handOfCards.Clear();
for (int i = 0; i < 5; i++)
handOfCards.AddCard(new RankedPlayCardWithPlaylistItem(new RankedPlayCardItem()));
});
AddStep("multi selection mode", () => handOfCards.SelectionMode = HandSelectionMode.Multiple);
AddStep("click first card", () => handOfCards.Cards.First().TriggerClick());
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.First().Item]));
AddStep("click second card", () => handOfCards.Cards.ElementAt(1).TriggerClick());
AddAssert("both cards selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(0).Item, handOfCards.Cards.ElementAt(1).Item]));
AddStep("click second card again", () => handOfCards.Cards.ElementAt(1).TriggerClick());
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(0).Item]));
}
[Test]
public void TestCardCount()
{
for (int i = 1; i <= 8; i++)
{
int numCards = i;
AddStep($"{i} {"cards".Pluralize(i == 1)}", () =>
{
handOfCards.Clear();
for (int j = 0; j < numCards; j++)
handOfCards.AddCard(new RankedPlayCardWithPlaylistItem(new RankedPlayCardItem()));
});
}
}
[Test]
public void TestKeyboardSelectionSingleSelection()
{
bool playActionTriggered = false;
AddStep("add cards", () =>
{
playActionTriggered = false;
handOfCards.PlayCardAction = () => playActionTriggered = true;
handOfCards.Clear();
for (int i = 0; i < 5; i++)
handOfCards.AddCard(new RankedPlayCardWithPlaylistItem(new RankedPlayCardItem()));
});
AddStep("single selection mode", () => handOfCards.SelectionMode = HandSelectionMode.Single);
for (int i = 0; i < 5; i++)
{
int i1 = i;
Key key = Key.Number1 + i;
AddStep($"key {i + 1}", () => InputManager.Key(key));
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(i1).Item]));
}
AddStep("right arrow", () => InputManager.Key(Key.Right));
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(0).Item]));
AddStep("right arrow", () => InputManager.Key(Key.Right));
AddAssert("second card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(1).Item]));
AddStep("left arrow", () => InputManager.Key(Key.Left));
AddAssert("first card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(0).Item]));
AddStep("left arrow", () => InputManager.Key(Key.Left));
AddAssert("last card selected", () => handOfCards.Selection.SequenceEqual([handOfCards.Cards.ElementAt(^1).Item]));
AddStep("space", () => InputManager.Key(Key.Space));
AddAssert("play action triggered", () => playActionTriggered);
}
[Test]
public void TestKeyboardSelectionMultiSelection()
{
AddStep("add cards", () =>
{
handOfCards.Clear();
for (int i = 0; i < 5; i++)
handOfCards.AddCard(new RankedPlayCardWithPlaylistItem(new RankedPlayCardItem()));
});
AddStep("multi selection mode", () => handOfCards.SelectionMode = HandSelectionMode.Multiple);
for (int i = 0; i < 5; i++)
{
int i1 = i;
Key key = Key.Number1 + i;
AddStep($"key {i + 1}", () => InputManager.Key(key));
AddAssert("card hovered", () => handOfCards.Cards.ElementAt(i1).CardHovered);
AddAssert("card not selected", () => !handOfCards.Selection.Contains(handOfCards.Cards.ElementAt(i1).Card.Item));
AddStep("space", () => InputManager.Key(Key.Space));
AddAssert("card selected", () => handOfCards.Selection.Contains(handOfCards.Cards.ElementAt(i1).Card.Item));
}
}
}
}
@@ -0,0 +1,62 @@
// 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 osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osuTK;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneRankedPlayBackground : OsuTestScene
{
private readonly RankedPlayBackground background;
private readonly Bindable<Colour4> gradientOuter = new Bindable<Colour4>(Color4Extensions.FromHex("AC6D97"));
private readonly Bindable<Colour4> gradientInner = new Bindable<Colour4>(Color4Extensions.FromHex("544483"));
private readonly Bindable<Colour4> dots = new Bindable<Colour4>(Color4Extensions.FromHex("D56CF6"));
public TestSceneRankedPlayBackground()
{
Children =
[
background = new RankedPlayBackground { RelativeSizeAxes = Axes.Both },
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children =
[
new BasicColourPicker
{
Scale = new Vector2(0.4f),
Current = gradientOuter,
},
new BasicColourPicker
{
Scale = new Vector2(0.4f),
Current = gradientInner,
},
new BasicColourPicker
{
Scale = new Vector2(0.4f),
Current = dots,
}
]
}
];
}
protected override void LoadComplete()
{
base.LoadComplete();
gradientOuter.BindValueChanged(e => background.GradientOutside = e.NewValue, true);
gradientInner.BindValueChanged(e => background.GradientInside = e.NewValue, true);
dots.BindValueChanged(e => background.DotsColour = e.NewValue, true);
}
}
}
@@ -0,0 +1,222 @@
// 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.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Cursor;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays;
using osu.Game.Rulesets;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Card;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Hand;
using osuTK;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneRankedPlayCard : RankedPlayTestScene
{
protected override Container<Drawable> Content { get; }
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
[Cached]
private readonly CardDetailsOverlayContainer overlayContainer;
[Cached]
private readonly SongPreviewParticleContainer particleContainer;
private readonly BeatmapRequestHandler requestHandler = new BeatmapRequestHandler();
public TestSceneRankedPlayCard()
{
base.Content.AddRange(new Drawable[]
{
new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.Both,
Child = Content = new Container
{
RelativeSizeAxes = Axes.Both,
}
},
overlayContainer = new CardDetailsOverlayContainer(),
particleContainer = new SongPreviewParticleContainer(),
});
}
[Test]
public void TestCards()
{
AddStep("add cards", () =>
{
FillFlowContainer flow;
Child = flow = new FillFlowContainer
{
RelativeSizeAxes = Axes.Y,
Width = 800f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Spacing = new Vector2(10),
};
for (int i = 0; i < 10; i++)
{
var beatmap = CreateAPIBeatmap();
beatmap.BeatmapSet!.Ratings = Enumerable.Range(0, 11).ToArray();
beatmap.BeatmapSet!.RelatedTags =
[
new APITag
{
Id = 2,
Name = "song representation/simple",
Description = "Accessible and straightforward map design."
},
new APITag
{
Id = 4,
Name = "style/clean",
Description = "Visually uncluttered and organised patterns, often involving few overlaps and equal visual spacing between objects."
},
new APITag
{
Id = 23,
Name = "aim/aim control",
Description = "Patterns with velocity or direction changes which strongly go against a player's natural movement pattern."
}
];
beatmap.TopTags =
[
new APIBeatmapTag { TagId = 4, VoteCount = 1 },
new APIBeatmapTag { TagId = 2, VoteCount = 1 },
new APIBeatmapTag { TagId = 23, VoteCount = 5 },
];
beatmap.FailTimes = new APIFailTimes
{
Fails = Enumerable.Range(1, 100).Select(x => x % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(x => x % 12 - 6).ToArray(),
};
beatmap.StarRating = i + 1;
flow.Add(new RankedPlayCardContent(beatmap)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(1.2f),
});
}
});
}
[Test]
public void TestCardHand()
{
AddStep("setup request handler", () => ((DummyAPIAccess)API).HandleRequest = requestHandler.HandleRequest);
AddStep("add cards", () =>
{
PlayerHandOfCards handOfCards;
Child = handOfCards = new PlayerHandOfCards
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.5f),
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
SelectionMode = HandSelectionMode.Single
};
foreach (var beatmap in requestHandler.Beatmaps)
{
handOfCards.AddCard(new RevealedRankedPlayCardWithPlaylistItem(beatmap));
}
});
}
[Resolved]
private RulesetStore rulesetStore { get; set; } = null!;
[Test]
public void TestRulesets()
{
var rulesets = rulesetStore.AvailableRulesets.Where(it => it.OnlineID >= 0);
foreach (var ruleset in rulesets)
{
AddStep(ruleset.ShortName, () =>
{
FillFlowContainer flow;
Child = flow = new FillFlowContainer
{
RelativeSizeAxes = Axes.Y,
Width = 800f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Spacing = new Vector2(10),
};
for (int i = 0; i < 10; i++)
{
var beatmap = CreateAPIBeatmap(ruleset);
beatmap.BeatmapSet!.Ratings = Enumerable.Range(0, 11).ToArray();
beatmap.BeatmapSet!.RelatedTags =
[
new APITag
{
Id = 2,
Name = "song representation/simple",
Description = "Accessible and straightforward map design."
},
new APITag
{
Id = 4,
Name = "style/clean",
Description = "Visually uncluttered and organised patterns, often involving few overlaps and equal visual spacing between objects."
},
new APITag
{
Id = 23,
Name = "aim/aim control",
Description = "Patterns with velocity or direction changes which strongly go against a player's natural movement pattern."
}
];
beatmap.TopTags =
[
new APIBeatmapTag { TagId = 4, VoteCount = 1 },
new APIBeatmapTag { TagId = 2, VoteCount = 1 },
new APIBeatmapTag { TagId = 23, VoteCount = 5 },
];
beatmap.FailTimes = new APIFailTimes
{
Fails = Enumerable.Range(1, 100).Select(x => x % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(x => x % 12 - 6).ToArray(),
};
beatmap.StarRating = i + 1;
flow.Add(new RankedPlayCardContent(beatmap)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(1.2f),
});
}
});
}
}
}
}
@@ -0,0 +1,61 @@
// 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 NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Components;
using osu.Game.Tests.Visual.Multiplayer;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneRankedPlayCornerPiece : MultiplayerTestScene
{
private readonly Bindable<Visibility> visibility = new Bindable<Visibility>(Visibility.Visible);
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("add children", () =>
{
Children =
[
new RankedPlayCornerPiece(RankedPlayColourScheme.Blue, Anchor.BottomLeft)
{
State = { BindTarget = visibility },
Child = new RankedPlayUserDisplay(2, Anchor.BottomLeft, RankedPlayColourScheme.Blue)
{
RelativeSizeAxes = Axes.Both,
}
},
new RankedPlayCornerPiece(RankedPlayColourScheme.Red, Anchor.TopRight)
{
State = { BindTarget = visibility },
Child = new RankedPlayUserDisplay(2, Anchor.TopRight, RankedPlayColourScheme.Red)
{
RelativeSizeAxes = Axes.Both,
}
},
];
});
}
[Test]
public void TestCornerPieces()
{
AddStep("show", () => visibility.Value = Visibility.Visible);
AddStep("hide", () => visibility.Value = Visibility.Hidden);
AddSliderStep("health", 0, 1_000_000, 1_000_000, value =>
{
foreach (var d in this.ChildrenOfType<RankedPlayUserDisplay>())
{
d.Health.Value = value;
}
});
}
}
}
@@ -0,0 +1,176 @@
// 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.Linq;
using NUnit.Framework;
using osu.Framework.Extensions;
using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Hand;
using osuTK.Input;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneRankedPlayScreen : RankedPlayTestScene
{
private RankedPlayScreen screen = null!;
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("join room", () => JoinRoom(CreateDefaultRoom(MatchType.RankedPlay)));
WaitForJoined();
AddStep("join other user", () => MultiplayerClient.AddUser(new APIUser { Id = 2 }));
AddStep("load screen", () => LoadScreen(screen = new RankedPlayScreen(MultiplayerClient.ClientRoom!)));
}
[Test]
public void TestIntroStage()
{
AddStep("set round warmup phase", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.RoundWarmup, s => s.StarRating = 6.3f).WaitSafely());
}
[Test]
public void TestDiscardCardsStage()
{
AddStep("set discard phase", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardDiscard).WaitSafely());
AddWaitStep("wait", 3);
for (int i = 0; i < 3; i++)
{
int i2 = i;
AddStep($"click card {i2}", () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<PlayerHandOfCards.PlayerHandCard>().ElementAt(i2));
InputManager.Click(MouseButton.Left);
});
}
AddWaitStep("wait", 3);
AddStep("click discard button", () =>
{
var button = screen.ChildrenOfType<ShearedButton>().Single(it => it.Name == "Discard Button");
InputManager.MoveMouseTo(button);
InputManager.Click(MouseButton.Left);
});
AddWaitStep("wait", 13);
AddStep("set finish discard phase", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.FinishCardDiscard).WaitSafely());
}
[Test]
public void TestAddRemoveCards()
{
AddStep("set discard phase", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardDiscard).WaitSafely());
for (int i = 0; i < 3; i++)
AddStep("add card", () => MultiplayerClient.RankedPlayAddCards([new RankedPlayCardItem()]).WaitSafely());
for (int i = 0; i < 3; i++)
AddStep("remove card", () => MultiplayerClient.RankedPlayRemoveCards(hand => [hand[0]]).WaitSafely());
}
[Test]
public void TestRevealCards()
{
var requestHandler = new BeatmapRequestHandler();
AddStep("setup request handler", () => ((DummyAPIAccess)API).HandleRequest = requestHandler.HandleRequest);
AddStep("set discard phase", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardDiscard).WaitSafely());
for (int i = 0; i < 3; i++)
{
int i2 = i;
AddStep("reveal card", () => MultiplayerClient.RankedPlayRevealCard(hand => hand[i2], new MultiplayerPlaylistItem
{
ID = i2,
BeatmapID = requestHandler.Beatmaps[i2].OnlineID
}).WaitSafely());
}
}
[Test]
public void TestPlayCardDirect()
{
AddStep("set play phase", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardPlay, state => state.ActiveUserId = API.LocalUser.Value.OnlineID).WaitSafely());
AddWaitStep("wait", 3);
AddStep("play card", () => MultiplayerClient.PlayCard(hand => hand[0]).WaitSafely());
}
[Test]
public void TestDiscardCardsDirect()
{
AddStep("set discard phase", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardDiscard).WaitSafely());
AddWaitStep("wait", 3);
AddStep("discard cards", () => MultiplayerClient.DiscardCards(hand => hand.Take(3)).WaitSafely());
AddWaitStep("wait", 13);
AddStep("set finish discard phase", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.FinishCardDiscard).WaitSafely());
}
[Test]
public void TestPlayStage()
{
AddStep("set play phase", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardPlay, state => state.ActiveUserId = API.LocalUser.Value.OnlineID).WaitSafely());
AddUntilStep("wait until cards are present", () => this.ChildrenOfType<PlayerHandOfCards.PlayerHandCard>().Count() == 5);
for (int i = 0; i < 3; i++)
{
int i2 = i;
AddStep($"click card {i2}", () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<PlayerHandOfCards.PlayerHandCard>().ElementAt(i2));
InputManager.Click(MouseButton.Left);
});
}
AddWaitStep("wait", 3);
AddStep("click play button", () =>
{
var button = screen
.ChildrenOfType<PlayerHandOfCards.PlayerHandCard>()
.First(it => it.Selected)
.ChildrenOfType<ShearedButton>()
.First();
InputManager.MoveMouseTo(button);
InputManager.Click(MouseButton.Left);
});
}
[Test]
public void TestOtherPlaysCard()
{
AddStep("set play phase", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardPlay, state => state.ActiveUserId = 2).WaitSafely());
AddWaitStep("wait", 5);
AddStep("play beatmap", () => MultiplayerClient.PlayUserCard(2, hand => hand[0]).WaitSafely());
AddStep("reveal card", () => MultiplayerClient.RankedPlayRevealUserCard(2, hand => hand[0], new MultiplayerPlaylistItem
{
ID = 0,
BeatmapID = 0
}).WaitSafely());
}
[Test]
public void TestHealthChange()
{
AddStep("set play phase", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.CardPlay, state => state.ActiveUserId = 2).WaitSafely());
AddWaitStep("wait", 5);
AddStep("change player 1 health", () => MultiplayerClient.RankedPlayChangeUserState(MultiplayerClient.LocalUser!.UserID, state => state.Life = 250_000).WaitSafely());
AddWaitStep("wait", 5);
AddStep("change player 2 health", () => MultiplayerClient.RankedPlayChangeUserState(2, state => state.Life = 250_000).WaitSafely());
}
}
}
@@ -0,0 +1,58 @@
// 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 NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Components;
using osu.Game.Tests.Visual.Multiplayer;
using osuTK;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneRankedPlayUserDisplay : MultiplayerTestScene
{
private readonly BindableInt health = new BindableInt
{
MaxValue = 1_000_000,
MinValue = 0,
Value = 1_000_000,
};
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("add display", () => Child = new RankedPlayUserDisplay(2, Anchor.BottomLeft, RankedPlayColourScheme.Blue)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(256, 72),
Health = { BindTarget = health }
});
}
[Test]
public void TesUserDisplay()
{
AddStep("blue color scheme", () => Child = new RankedPlayUserDisplay(2, Anchor.BottomLeft, RankedPlayColourScheme.Blue)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(256, 72),
Health = { BindTarget = health }
});
AddStep("red color scheme", () => Child = new RankedPlayUserDisplay(2, Anchor.BottomLeft, RankedPlayColourScheme.Red)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(256, 72),
Health = { BindTarget = health }
});
AddSliderStep("health", 0, 1_000_000, 1_000_000, value => health.Value = value);
}
}
}
@@ -0,0 +1,231 @@
// 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.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Extensions;
using osu.Framework.Utils;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.MatchTypes.RankedPlay;
using osu.Game.Online.Rooms;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay;
using osu.Game.Tests.Visual.Multiplayer;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneResultsScreen : MultiplayerTestScene
{
private RankedPlayScreen screen = null!;
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("join room", () => JoinRoom(CreateDefaultRoom(MatchType.RankedPlay)));
WaitForJoined();
AddStep("add other user", () => MultiplayerClient.AddUser(new MultiplayerRoomUser(2)));
AddStep("load screen", () => LoadScreen(screen = new RankedPlayScreen(MultiplayerClient.ClientRoom!)));
AddUntilStep("screen loaded", () => screen.IsLoaded);
setupRequestHandler();
}
[Test]
public void TestBasic()
{
AddStep("set results state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.Results, state =>
{
int losingPlayer = state.Users.Keys.First();
foreach (var (id, userInfo) in state.Users)
{
if (id == losingPlayer)
{
userInfo.DamageInfo = new RankedPlayDamageInfo
{
RawDamage = 123_456,
Damage = 123_456,
OldLife = 500_000,
NewLife = 500_000 - 123_456,
};
userInfo.Life = 500_000 - 123_456;
}
else
{
userInfo.DamageInfo = new RankedPlayDamageInfo
{
RawDamage = 0,
Damage = 0,
OldLife = 1_000_000,
NewLife = 1_000_000,
};
}
}
}).WaitSafely());
}
[Test]
public void TestMultiplier()
{
AddStep("set results state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.Results, state =>
{
int losingPlayer = state.Users.Keys.First();
state.DamageMultiplier = 2;
foreach (var (id, userInfo) in state.Users)
{
if (id == losingPlayer)
{
userInfo.DamageInfo = new RankedPlayDamageInfo
{
RawDamage = 123_456,
Damage = 123_456 * 2,
OldLife = 1_000_000,
NewLife = 1_000_000 - 123_456 * 2,
};
userInfo.Life = 1_000_000 - 123_456 * 2;
}
else
{
userInfo.DamageInfo = new RankedPlayDamageInfo
{
RawDamage = 0,
Damage = 0,
OldLife = 1_000_000,
NewLife = 1_000_000,
};
}
}
}).WaitSafely());
}
[Test]
public void TestMissingScores()
{
AddStep("setup request handler", () =>
{
Func<APIRequest, bool>? defaultRequestHandler = ((DummyAPIAccess)API).HandleRequest;
((DummyAPIAccess)API).HandleRequest = request =>
{
switch (request)
{
case IndexPlaylistScoresRequest index:
index.TriggerSuccess(new IndexedMultiplayerScores());
return true;
default:
return defaultRequestHandler?.Invoke(request) ?? false;
}
};
});
AddStep("set results state", () => MultiplayerClient.RankedPlayChangeStage(RankedPlayStage.Results, state =>
{
int losingPlayer = state.Users.Keys.First();
state.DamageMultiplier = 2;
foreach (var (id, userInfo) in state.Users)
{
if (id == losingPlayer)
{
userInfo.DamageInfo = new RankedPlayDamageInfo
{
RawDamage = 123_456,
Damage = 123_456 * 2,
OldLife = 1_000_000,
NewLife = 1_000_000 - 123_456 * 2,
};
}
else
{
userInfo.DamageInfo = new RankedPlayDamageInfo
{
RawDamage = 0,
Damage = 0,
OldLife = 1_000_000,
NewLife = 1_000_000,
};
}
}
}).WaitSafely());
}
private void setupRequestHandler()
{
AddStep("setup request handler", () =>
{
Func<APIRequest, bool>? defaultRequestHandler = ((DummyAPIAccess)API).HandleRequest;
((DummyAPIAccess)API).HandleRequest = request =>
{
switch (request)
{
case IndexPlaylistScoresRequest index:
var result = new IndexedMultiplayerScores();
foreach (int userId in new[] { 2, API.LocalUser.Value.OnlineID })
{
result.Scores.Add(new MultiplayerScore
{
ID = userId,
Accuracy = RNG.NextSingle(),
EndedAt = DateTimeOffset.Now,
Passed = true,
Rank = (ScoreRank)RNG.Next((int)ScoreRank.D, (int)ScoreRank.XH),
MaxCombo = RNG.Next(1000),
TotalScore = userId == 2 ? 750_000 : 750_000 - 123_456,
Statistics = new Dictionary<HitResult, int>
{
[HitResult.Miss] = 1,
[HitResult.Meh] = 50,
[HitResult.Ok] = 100,
[HitResult.Good] = 200,
[HitResult.Great] = 300,
[HitResult.Perfect] = 320,
[HitResult.SmallTickHit] = 50,
[HitResult.SmallTickMiss] = 25,
[HitResult.LargeTickHit] = 100,
[HitResult.LargeTickMiss] = 50,
[HitResult.SmallBonus] = 10,
[HitResult.LargeBonus] = 50
},
MaximumStatistics = new Dictionary<HitResult, int>
{
[HitResult.Perfect] = 971,
[HitResult.SmallTickHit] = 75,
[HitResult.LargeTickHit] = 150,
[HitResult.SmallBonus] = 10,
[HitResult.LargeBonus] = 50,
},
User = new APIUser
{
Id = userId,
Username = $"user {userId}",
}
});
}
index.TriggerSuccess(result);
return true;
default:
return defaultRequestHandler?.Invoke(request) ?? false;
}
};
});
}
}
}
@@ -0,0 +1,80 @@
// 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.Linq;
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Online.API;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Card;
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Hand;
using osuTK;
namespace osu.Game.Tests.Visual.RankedPlay
{
public partial class TestSceneSongPreview : RankedPlayTestScene
{
private readonly Bindable<bool> previewEnabled = new BindableBool(true);
private readonly BeatmapRequestHandler requestHandler = new BeatmapRequestHandler();
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("setup request handler", () => ((DummyAPIAccess)API).HandleRequest = requestHandler.HandleRequest);
AddStep("add cards", () =>
{
PlayerHandOfCards handOfCards;
Child = handOfCards = new PlayerHandOfCards
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Size = new Vector2(0.5f),
};
foreach (var beatmap in requestHandler.Beatmaps.Take(3))
{
handOfCards.AddCard(new RevealedRankedPlayCardWithPlaylistItem(beatmap), handCard =>
{
handCard.Card.SongPreviewEnabled.BindTarget = previewEnabled;
});
}
});
AddUntilStep("load tracks", () => this.ChildrenOfType<RankedPlayCard>().All(card => card.PreviewTrackLoaded));
}
[Test]
public void TestSongPreview()
{
AddStep("move mouse to first card", () => InputManager.MoveMouseTo(getCard(0)));
AddAssert("first track running", () => getCard(0).PreviewTrackRunning);
AddAssert("only one track running", () => this.ChildrenOfType<RankedPlayCard>().Count(c => c.PreviewTrackRunning) == 1);
AddStep("move mouse to second card", () => InputManager.MoveMouseTo(getCard(1)));
AddAssert("second track running", () => getCard(1).PreviewTrackRunning);
AddAssert("only one track running", () => this.ChildrenOfType<RankedPlayCard>().Count(c => c.PreviewTrackRunning) == 1);
AddStep("disable preview", () => previewEnabled.Value = false);
AddAssert("no tracks running", () => !this.ChildrenOfType<RankedPlayCard>().Any(c => c.PreviewTrackRunning));
AddStep("move mouse to third card", () => InputManager.MoveMouseTo(getCard(2)));
AddAssert("no tracks running", () => !this.ChildrenOfType<RankedPlayCard>().Any(c => c.PreviewTrackRunning));
AddStep("enable preview", () => previewEnabled.Value = true);
AddAssert("third track running", () => getCard(2).PreviewTrackRunning);
}
private RankedPlayCard getCard(int index) => this.ChildrenOfType<RankedPlayCard>().ElementAt(index);
}
}
@@ -19,8 +19,8 @@ using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Leaderboards;
using osu.Game.Rulesets;
using osu.Game.Scoring;
using osu.Game.Screens.Play.Leaderboards;
using osu.Game.Screens.Ranking;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Visual.Ranking
@@ -14,10 +14,9 @@ using osu.Game.Graphics.Carousel;
using osu.Game.Scoring;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class BeatmapCarouselFilterGroupingTest
@@ -12,10 +12,9 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics.Carousel;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class BeatmapCarouselFilterSortingTest
@@ -25,15 +25,13 @@ using osu.Game.Overlays;
using osu.Game.Scoring;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
using osu.Game.Tests.Beatmaps;
using osu.Game.Tests.Resources;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
using BeatmapCarousel = osu.Game.Screens.SelectV2.BeatmapCarousel;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public abstract partial class BeatmapCarouselTestScene : OsuManualInputManagerTestScene
{
@@ -9,7 +9,7 @@ using osu.Framework.Testing;
using osu.Game.Graphics.Cursor;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public abstract partial class SongSelectComponentsTestScene : OsuManualInputManagerTestScene
{
@@ -23,11 +23,11 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public abstract partial class SongSelectTestScene : ScreenTestScene
{
@@ -38,7 +38,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
private RealmDetachedBeatmapStore beatmapStore = null!;
protected Screens.SelectV2.SongSelect SongSelect { get; private set; } = null!;
protected Screens.Select.SongSelect SongSelect { get; private set; } = null!;
protected BeatmapCarousel Carousel => SongSelect.ChildrenOfType<BeatmapCarousel>().Single();
[Cached]
File diff suppressed because it is too large Load Diff
@@ -7,12 +7,12 @@ using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Graphics.Carousel;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
using osu.Game.Tests.Resources;
using osuTK;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class TestSceneBeatmapCarouselArtistGrouping : BeatmapCarouselTestScene
@@ -8,7 +8,7 @@ using osu.Framework.Testing;
using osu.Game.Collections;
using osu.Game.Screens.Select.Filter;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class TestSceneBeatmapCarouselCollectionGrouping : BeatmapCarouselTestScene
@@ -5,11 +5,11 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Graphics.Carousel;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
using osuTK;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class TestSceneBeatmapCarouselDifficultyGrouping : BeatmapCarouselTestScene
@@ -9,11 +9,11 @@ using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class TestSceneBeatmapCarouselFiltering : BeatmapCarouselTestScene
@@ -4,12 +4,12 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
using osuTK;
using osuTK.Input;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class TestSceneBeatmapCarouselNoGrouping : BeatmapCarouselTestScene
@@ -5,10 +5,10 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class TestSceneBeatmapCarouselRandom : BeatmapCarouselTestScene
@@ -5,9 +5,9 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Testing;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class TestSceneBeatmapCarouselScrolling : BeatmapCarouselTestScene
@@ -6,10 +6,10 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class TestSceneBeatmapCarouselSetsSplitApart : BeatmapCarouselTestScene
@@ -12,11 +12,11 @@ using osu.Game.Database;
using osu.Game.Extensions;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Filter;
using osu.Game.Screens.SelectV2;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class TestSceneBeatmapCarouselUpdateHandling : BeatmapCarouselTestScene
@@ -1,162 +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.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual.SongSelect
{
[System.ComponentModel.Description("PlaySongSelect beatmap details")]
public partial class TestSceneBeatmapDetails : OsuTestScene
{
private BeatmapDetails details;
private DummyAPIAccess api => (DummyAPIAccess)API;
[SetUp]
public void Setup() => Schedule(() =>
{
Child = details = new BeatmapDetails
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(150),
};
});
[Test]
public void TestAllMetrics()
{
AddStep("all metrics", () => details.BeatmapInfo = new APIBeatmap
{
BeatmapSet = new APIBeatmapSet
{
Source = "osu!",
Tags = "this beatmap has all the metrics",
Ratings = Enumerable.Range(0, 11).ToArray(),
},
DifficultyName = "All Metrics",
CircleSize = 7,
DrainRate = 1,
OverallDifficulty = 5.7f,
ApproachRate = 3.5f,
StarRating = 5.3f,
FailTimes = new APIFailTimes
{
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
},
});
}
[Test]
public void TestAllMetricsExceptSource()
{
AddStep("all except source", () => details.BeatmapInfo = new APIBeatmap
{
BeatmapSet = new APIBeatmapSet
{
Tags = "this beatmap has all the metrics",
Ratings = Enumerable.Range(0, 11).ToArray(),
},
DifficultyName = "All Metrics",
CircleSize = 7,
DrainRate = 1,
OverallDifficulty = 5.7f,
ApproachRate = 3.5f,
StarRating = 5.3f,
FailTimes = new APIFailTimes
{
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
},
});
}
[Test]
public void TestOnlyRatings()
{
AddStep("ratings", () => details.BeatmapInfo = new APIBeatmap
{
BeatmapSet = new APIBeatmapSet
{
Ratings = Enumerable.Range(0, 11).ToArray(),
Source = "osu!",
Tags = "this beatmap has ratings metrics but not retries or fails",
},
DifficultyName = "Only Ratings",
CircleSize = 6,
DrainRate = 9,
OverallDifficulty = 6,
ApproachRate = 6,
StarRating = 4.8f,
});
}
[Test]
public void TestOnlyFailsAndRetries()
{
AddStep("fails retries", () => details.BeatmapInfo = new APIBeatmap
{
DifficultyName = "Only Retries and Fails",
BeatmapSet = new APIBeatmapSet
{
Source = "osu!",
Tags = "this beatmap has retries and fails but no ratings",
},
CircleSize = 3.7f,
DrainRate = 6,
OverallDifficulty = 6,
ApproachRate = 7,
StarRating = 2.91f,
FailTimes = new APIFailTimes
{
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6).ToArray(),
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6).ToArray(),
},
});
}
[Test]
public void TestNoMetrics()
{
AddStep("no metrics", () => details.BeatmapInfo = new APIBeatmap
{
DifficultyName = "No Metrics",
BeatmapSet = new APIBeatmapSet
{
Source = "osu!",
Tags = "this beatmap has no metrics",
},
CircleSize = 5,
DrainRate = 5,
OverallDifficulty = 5.5f,
ApproachRate = 6.5f,
StarRating = 1.97f,
});
}
[Test]
public void TestNullBeatmap()
{
AddStep("null beatmap", () => details.BeatmapInfo = null);
}
[Test]
public void TestOnlineMetrics()
{
AddStep("online ratings/retries/fails", () => details.BeatmapInfo = new APIBeatmap
{
OnlineID = 162,
});
AddStep("set online", () => api.SetState(APIState.Online));
AddStep("set offline", () => api.SetState(APIState.Offline));
}
}
}
@@ -4,9 +4,9 @@
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneBeatmapFilterControl : SongSelectComponentsTestScene
{
@@ -1,305 +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.
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Extensions;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Taiko;
using osu.Game.Screens.Select;
using osuTK;
namespace osu.Game.Tests.Visual.SongSelect
{
[TestFixture]
public partial class TestSceneBeatmapInfoWedge : OsuTestScene
{
[Resolved]
private RulesetStore rulesets { get; set; } = null!;
private TestBeatmapInfoWedge infoWedge = null!;
private readonly List<IBeatmap> beatmaps = new List<IBeatmap>();
protected override void LoadComplete()
{
base.LoadComplete();
Add(infoWedge = new TestBeatmapInfoWedge
{
Size = new Vector2(0.5f, 245),
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding { Top = 20 }
});
AddStep("show", () => infoWedge.Show());
selectBeatmap(Beatmap.Value.Beatmap);
AddWaitStep("wait for select", 3);
AddStep("hide", () => { infoWedge.Hide(); });
AddWaitStep("wait for hide", 3);
AddStep("show", () => { infoWedge.Show(); });
AddSliderStep("change star difficulty", 0, 11.9, 5.55, v =>
{
foreach (var hasCurrentValue in infoWedge.Info.ChildrenOfType<IHasCurrentValue<StarDifficulty>>())
hasCurrentValue.Current.Value = new StarDifficulty(v, 0);
});
foreach (var rulesetInfo in rulesets.AvailableRulesets)
{
var instance = rulesetInfo.CreateInstance();
var testBeatmap = CreateTestBeatmap(rulesetInfo);
beatmaps.Add(testBeatmap);
setRuleset(rulesetInfo);
selectBeatmap(testBeatmap);
testBeatmapLabels(instance);
switch (instance)
{
case OsuRuleset:
testInfoLabels(5);
break;
case TaikoRuleset:
testInfoLabels(5);
break;
case CatchRuleset:
testInfoLabels(5);
break;
case ManiaRuleset:
testInfoLabels(4);
break;
default:
testInfoLabels(2);
break;
}
}
}
private void testBeatmapLabels(Ruleset ruleset)
{
AddAssert("check version", () => infoWedge.Info.VersionLabel.Current.Value == $"{ruleset.ShortName}Version");
AddAssert("check title", () => infoWedge.Info.TitleLabel.Current.Value == $"{ruleset.ShortName}Title");
AddAssert("check artist", () => infoWedge.Info.ArtistLabel.Current.Value == $"{ruleset.ShortName}Artist");
AddAssert("check author", () => infoWedge.Info.MapperContainer.ChildrenOfType<OsuSpriteText>().Any(s => s.Current.Value == $"{ruleset.ShortName}Author"));
}
private void testInfoLabels(int expectedCount)
{
AddAssert("check info labels exists", () => infoWedge.Info.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>().Any());
AddAssert("check info labels count", () => infoWedge.Info.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>().Count() == expectedCount);
}
[SetUpSteps]
public void SetUpSteps()
{
AddStep("reset mods", () => SelectedMods.SetDefault());
}
[Test]
public void TestTruncation()
{
selectBeatmap(CreateLongMetadata());
}
[Test]
public void TestNullBeatmap()
{
selectBeatmap(null);
AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Current.Value));
AddAssert("check default title", () => infoWedge.Info.TitleLabel.Current.Value == Beatmap.Default.BeatmapInfo.Metadata.Title);
AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Current.Value == Beatmap.Default.BeatmapInfo.Metadata.Artist);
AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.ChildrenOfType<OsuSpriteText>().Any());
AddAssert("check no info labels", () => !infoWedge.Info.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>().Any());
}
[Test]
public void TestBPMUpdates()
{
const double bpm = 120;
IBeatmap beatmap = CreateTestBeatmap(new OsuRuleset().RulesetInfo);
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 60 * 1000 / bpm });
OsuModDoubleTime doubleTime = null!;
selectBeatmap(beatmap);
checkDisplayedBPM($"{bpm}");
AddStep("select DT", () => SelectedMods.Value = new[] { doubleTime = new OsuModDoubleTime() });
checkDisplayedBPM($"{bpm * 1.5f}");
AddStep("change DT rate", () => doubleTime.SpeedChange.Value = 2);
checkDisplayedBPM($"{bpm * 2}");
}
[TestCase(120, 125, null, "120-125 (mostly 120)")]
[TestCase(120, 120.6, null, "120-121 (mostly 120)")]
[TestCase(120, 120.4, null, "120")]
[TestCase(120, 120.6, "DT", "180-181 (mostly 180)")]
[TestCase(120, 120.4, "DT", "180-181 (mostly 180)")]
public void TestVaryingBPM(double commonBpm, double otherBpm, string? mod, string expectedDisplay)
{
IBeatmap beatmap = CreateTestBeatmap(new OsuRuleset().RulesetInfo);
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm });
beatmap.ControlPointInfo.Add(100, new TimingControlPoint { BeatLength = 60 * 1000 / otherBpm });
beatmap.ControlPointInfo.Add(200, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm });
if (mod != null)
AddStep($"select {mod}", () => SelectedMods.Value = new[] { Ruleset.Value.CreateInstance().CreateModFromAcronym(mod) });
selectBeatmap(beatmap);
checkDisplayedBPM(expectedDisplay);
}
private void checkDisplayedBPM(string target)
{
AddUntilStep($"displayed bpm is {target}", () =>
{
var label = infoWedge.DisplayedContent.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>().Single(l => l.Statistic.Name == BeatmapsetsStrings.ShowStatsBpm);
return label.Statistic.Content == target;
});
}
[TestCase]
public void TestLengthUpdates()
{
IBeatmap beatmap = CreateTestBeatmap(new OsuRuleset().RulesetInfo);
double drain = beatmap.CalculateDrainLength();
beatmap.BeatmapInfo.Length = drain;
OsuModDoubleTime doubleTime = null!;
selectBeatmap(beatmap);
checkDisplayedLength(drain);
AddStep("select DT", () => SelectedMods.Value = new[] { doubleTime = new OsuModDoubleTime() });
checkDisplayedLength(Math.Round(drain / 1.5f));
AddStep("change DT rate", () => doubleTime.SpeedChange.Value = 2);
checkDisplayedLength(Math.Round(drain / 2));
}
private void checkDisplayedLength(double drain)
{
var displayedLength = drain.ToFormattedDuration();
AddUntilStep($"check map drain ({displayedLength})", () =>
{
var label = infoWedge.DisplayedContent.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>()
.Single(l => l.Statistic.Name == BeatmapsetsStrings.ShowStatsTotalLength(displayedLength));
return label.Statistic.Content == displayedLength.ToString();
});
}
private void setRuleset(RulesetInfo rulesetInfo)
{
Container? containerBefore = null;
AddStep("set ruleset", () =>
{
// wedge content is only refreshed if the ruleset changes, so only wait for load in that case.
if (!rulesetInfo.Equals(Ruleset.Value))
containerBefore = infoWedge.DisplayedContent;
Ruleset.Value = rulesetInfo;
});
AddUntilStep("wait for async load", () => infoWedge.DisplayedContent != containerBefore);
}
private void selectBeatmap(IBeatmap? b)
{
Container? containerBefore = null;
AddStep($"select {b?.Metadata.Title ?? "null"} beatmap", () =>
{
containerBefore = infoWedge.DisplayedContent;
infoWedge.Beatmap = Beatmap.Value = b == null ? Beatmap.Default : CreateWorkingBeatmap(b);
});
AddUntilStep("wait for async load", () => infoWedge.DisplayedContent != containerBefore);
}
public static IBeatmap CreateTestBeatmap(RulesetInfo ruleset)
{
List<HitObject> objects = new List<HitObject>();
for (double i = 0; i < 50000; i += 1000)
objects.Add(new TestHitObject { StartTime = i });
return new Beatmap
{
BeatmapInfo = new BeatmapInfo
{
Metadata = new BeatmapMetadata
{
Author = { Username = $"{ruleset.ShortName}Author" },
Artist = $"{ruleset.ShortName}Artist",
Source = $"{ruleset.ShortName}Source",
Title = $"{ruleset.ShortName}Title"
},
Ruleset = ruleset,
StarRating = 6,
DifficultyName = $"{ruleset.ShortName}Version",
Difficulty = new BeatmapDifficulty()
},
HitObjects = objects
};
}
public static IBeatmap CreateLongMetadata()
{
return new Beatmap
{
BeatmapInfo = new BeatmapInfo
{
Metadata = new BeatmapMetadata
{
Author = { Username = "WWWWWWWWWWWWWWW" },
Artist = "Verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long Artist",
Source = "Verrrrry long Source",
Title = "Verrrrry long Title"
},
DifficultyName = "Verrrrrrrrrrrrrrrrrrrrrrrrrrrrry long Version",
Status = BeatmapOnlineStatus.Graveyard,
},
};
}
private partial class TestBeatmapInfoWedge : BeatmapInfoWedge
{
public new Container DisplayedContent => base.DisplayedContent;
public new WedgeInfoText Info => base.Info;
}
private class TestHitObject : ConvertHitObject;
}
}
@@ -21,13 +21,13 @@ using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Resources;
using osu.Game.Users;
using osuTK;
using osuTK.Input;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneBeatmapLeaderboardScore : SongSelectComponentsTestScene
{
@@ -24,11 +24,11 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Resources;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneBeatmapLeaderboardSorting : SongSelectComponentsTestScene
{
@@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
private LeaderboardManager leaderboardManager = null!;
private readonly IBindable<Screens.SelectV2.SongSelect.BeatmapSetLookupResult?> onlineLookupResult = new Bindable<Screens.SelectV2.SongSelect.BeatmapSetLookupResult?>();
private readonly IBindable<Screens.Select.SongSelect.BeatmapSetLookupResult?> onlineLookupResult = new Bindable<Screens.Select.SongSelect.BeatmapSetLookupResult?>();
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{
@@ -25,13 +25,13 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Play.Leaderboards;
using osu.Game.Screens.Select;
using osu.Game.Tests.Resources;
using osu.Game.Users;
using osuTK.Input;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneBeatmapLeaderboardWedge : SongSelectComponentsTestScene
{
@@ -13,16 +13,16 @@ using osu.Game.Extensions;
using osu.Game.Graphics.Sprites;
using osu.Game.Models;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneBeatmapMetadataWedge : SongSelectComponentsTestScene
{
private BeatmapMetadataWedge wedge = null!;
[Cached(typeof(IBindable<Screens.SelectV2.SongSelect.BeatmapSetLookupResult?>))]
private Bindable<Screens.SelectV2.SongSelect.BeatmapSetLookupResult?> onlineLookupResult = new Bindable<Screens.SelectV2.SongSelect.BeatmapSetLookupResult?>();
[Cached(typeof(IBindable<Screens.Select.SongSelect.BeatmapSetLookupResult?>))]
private Bindable<Screens.Select.SongSelect.BeatmapSetLookupResult?> onlineLookupResult = new Bindable<Screens.Select.SongSelect.BeatmapSetLookupResult?>();
protected override void LoadComplete()
{
@@ -103,7 +103,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
working.BeatmapInfo.OnlineID = 0;
Beatmap.Value = working;
onlineLookupResult.Value = Screens.SelectV2.SongSelect.BeatmapSetLookupResult.Completed(null);
onlineLookupResult.Value = Screens.Select.SongSelect.BeatmapSetLookupResult.Completed(null);
});
}
@@ -154,7 +154,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
var (working, _) = createTestBeatmap();
Beatmap.Value = working;
onlineLookupResult.Value = Screens.SelectV2.SongSelect.BeatmapSetLookupResult.Completed(null);
onlineLookupResult.Value = Screens.Select.SongSelect.BeatmapSetLookupResult.Completed(null);
});
AddAssert("rating wedge still hidden", () => !wedge.RatingsVisible);
AddAssert("fail time wedge still hidden", () => !wedge.FailRetryVisible);
@@ -189,7 +189,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
var (working, online) = createTestBeatmap();
Beatmap.Value = working;
onlineLookupResult.Value = Screens.SelectV2.SongSelect.BeatmapSetLookupResult.InProgress();
onlineLookupResult.Value = Screens.Select.SongSelect.BeatmapSetLookupResult.InProgress();
Scheduler.AddDelayed(() => onlineLookupResult.Value = online, 500);
});
AddWaitStep("wait", 5);
@@ -203,7 +203,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
online.Result!.RelatedTags[2].Name = "some/tag";
Beatmap.Value = working;
onlineLookupResult.Value = Screens.SelectV2.SongSelect.BeatmapSetLookupResult.InProgress();
onlineLookupResult.Value = Screens.Select.SongSelect.BeatmapSetLookupResult.InProgress();
Scheduler.AddDelayed(() => onlineLookupResult.Value = online, 500);
});
AddWaitStep("wait", 5);
@@ -217,7 +217,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
working.BeatmapSetInfo.Beatmaps.Single().Metadata.UserTags.Clear();
Beatmap.Value = working;
onlineLookupResult.Value = Screens.SelectV2.SongSelect.BeatmapSetLookupResult.InProgress();
onlineLookupResult.Value = Screens.Select.SongSelect.BeatmapSetLookupResult.InProgress();
Scheduler.AddDelayed(() => onlineLookupResult.Value = online, 500);
});
AddWaitStep("wait", 5);
@@ -231,13 +231,13 @@ namespace osu.Game.Tests.Visual.SongSelectV2
working.BeatmapSetInfo.Beatmaps.Single().Metadata.UserTags.Clear();
Beatmap.Value = working;
onlineLookupResult.Value = Screens.SelectV2.SongSelect.BeatmapSetLookupResult.InProgress();
onlineLookupResult.Value = Screens.Select.SongSelect.BeatmapSetLookupResult.InProgress();
Scheduler.AddDelayed(() => onlineLookupResult.Value = online, 500);
});
AddWaitStep("wait", 5);
}
private (WorkingBeatmap, Screens.SelectV2.SongSelect.BeatmapSetLookupResult) createTestBeatmap()
private (WorkingBeatmap, Screens.Select.SongSelect.BeatmapSetLookupResult) createTestBeatmap()
{
var working = CreateWorkingBeatmap(Ruleset.Value);
var onlineSet = new APIBeatmapSet
@@ -292,7 +292,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
working.BeatmapSetInfo.DateSubmitted = DateTimeOffset.Now;
working.BeatmapSetInfo.DateRanked = DateTimeOffset.Now;
working.Metadata.UserTags.AddRange(onlineSet.RelatedTags.Select(t => t.Name));
return (working, Screens.SelectV2.SongSelect.BeatmapSetLookupResult.Completed(onlineSet));
return (working, Screens.Select.SongSelect.BeatmapSetLookupResult.Completed(onlineSet));
}
}
}
@@ -1,31 +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.
using System.ComponentModel;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Screens.Select.Options;
namespace osu.Game.Tests.Visual.SongSelect
{
[Description("bottom beatmap details")]
public partial class TestSceneBeatmapOptionsOverlay : OsuTestScene
{
public TestSceneBeatmapOptionsOverlay()
{
var overlay = new BeatmapOptionsOverlay();
var colours = new OsuColour();
overlay.AddButton(@"Manage", @"collections", FontAwesome.Solid.Book, colours.Green, null);
overlay.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, null);
overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null);
overlay.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, null);
overlay.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, colours.Yellow, null);
Add(overlay);
AddStep(@"Toggle", overlay.ToggleVisibility);
}
}
}
@@ -23,7 +23,7 @@ using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Taiko;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Resources;
using osu.Game.Users;
using osu.Game.Utils;
@@ -29,11 +29,10 @@ using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Skinning;
using osu.Game.Tests.Visual.SongSelect;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneBeatmapTitleWedge : SongSelectComponentsTestScene
{
@@ -42,8 +41,8 @@ namespace osu.Game.Tests.Visual.SongSelectV2
private BeatmapTitleWedge titleWedge = null!;
private BeatmapTitleWedge.DifficultyDisplay difficultyDisplay => titleWedge.ChildrenOfType<BeatmapTitleWedge.DifficultyDisplay>().Single();
[Cached(typeof(IBindable<Screens.SelectV2.SongSelect.BeatmapSetLookupResult?>))]
private Bindable<Screens.SelectV2.SongSelect.BeatmapSetLookupResult?> onlineLookupResult = new Bindable<Screens.SelectV2.SongSelect.BeatmapSetLookupResult?>();
[Cached(typeof(IBindable<Screens.Select.SongSelect.BeatmapSetLookupResult?>))]
private Bindable<Screens.Select.SongSelect.BeatmapSetLookupResult?> onlineLookupResult = new Bindable<Screens.Select.SongSelect.BeatmapSetLookupResult?>();
[BackgroundDependencyLoader]
private void load(RulesetStore rulesets)
@@ -86,7 +85,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
foreach (var rulesetInfo in rulesets.AvailableRulesets)
{
var testBeatmap = TestSceneBeatmapInfoWedge.CreateTestBeatmap(rulesetInfo);
var testBeatmap = createTestBeatmapFromRuleset(rulesetInfo);
setRuleset(rulesetInfo);
selectBeatmap(testBeatmap);
@@ -108,7 +107,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
public void TestBPMUpdates()
{
const double bpm = 120;
IBeatmap beatmap = TestSceneBeatmapInfoWedge.CreateTestBeatmap(new OsuRuleset().RulesetInfo);
IBeatmap beatmap = createTestBeatmapFromRuleset(new OsuRuleset().RulesetInfo);
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 60 * 1000 / bpm });
OsuModDoubleTime doubleTime = null!;
@@ -160,7 +159,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
var (working, _) = createTestBeatmap();
Beatmap.Value = working;
onlineLookupResult.Value = Screens.SelectV2.SongSelect.BeatmapSetLookupResult.Completed(null);
onlineLookupResult.Value = Screens.Select.SongSelect.BeatmapSetLookupResult.Completed(null);
});
AddUntilStep("play count is -", () => this.ChildrenOfType<BeatmapTitleWedge.Statistic>().ElementAt(0).Text.ToString(), () => Is.EqualTo("-"));
AddUntilStep("favourites count is -", () => this.ChildrenOfType<BeatmapTitleWedge.FavouriteButton>().Single().Text.ToString(), () => Is.EqualTo("-"));
@@ -241,11 +240,11 @@ namespace osu.Game.Tests.Visual.SongSelectV2
});
AddStep("reset event", resetEvent.Reset);
AddStep("click favourite button", () => this.ChildrenOfType<BeatmapTitleWedge.FavouriteButton>().Single().TriggerClick());
AddAssert("spinner visible", () => this.ChildrenOfType<BeatmapTitleWedge.FavouriteButton>().Single()
.ChildrenOfType<LoadingSpinner>().Single().State.Value, () => Is.EqualTo(Visibility.Visible));
AddUntilStep("spinner visible", () => this.ChildrenOfType<BeatmapTitleWedge.FavouriteButton>().Single()
.ChildrenOfType<LoadingSpinner>().Single().State.Value, () => Is.EqualTo(Visibility.Visible));
AddStep("allow request to complete", resetEvent.Set);
AddAssert("spinner hidden", () => this.ChildrenOfType<BeatmapTitleWedge.FavouriteButton>().Single()
.ChildrenOfType<LoadingSpinner>().Single().State.Value, () => Is.EqualTo(Visibility.Hidden));
AddUntilStep("spinner hidden", () => this.ChildrenOfType<BeatmapTitleWedge.FavouriteButton>().Single()
.ChildrenOfType<LoadingSpinner>().Single().State.Value, () => Is.EqualTo(Visibility.Hidden));
}
[TestCase(120, 125, null, "120-125 (mostly 120)")]
@@ -255,7 +254,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
[TestCase(120, 120.4, "DT", "180-181 (mostly 180)")]
public void TestVaryingBPM(double commonBpm, double otherBpm, string? mod, string expectedDisplay)
{
IBeatmap beatmap = TestSceneBeatmapInfoWedge.CreateTestBeatmap(new OsuRuleset().RulesetInfo);
IBeatmap beatmap = createTestBeatmapFromRuleset(new OsuRuleset().RulesetInfo);
beatmap.ControlPointInfo.Add(0, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm });
beatmap.ControlPointInfo.Add(100, new TimingControlPoint { BeatLength = 60 * 1000 / otherBpm });
beatmap.ControlPointInfo.Add(200, new TimingControlPoint { BeatLength = 60 * 1000 / commonBpm });
@@ -299,7 +298,7 @@ namespace osu.Game.Tests.Visual.SongSelectV2
});
}
private (WorkingBeatmap, Screens.SelectV2.SongSelect.BeatmapSetLookupResult) createTestBeatmap()
private (WorkingBeatmap, Screens.Select.SongSelect.BeatmapSetLookupResult) createTestBeatmap()
{
var working = CreateWorkingBeatmap(Ruleset.Value);
var onlineSet = new APIBeatmapSet
@@ -320,7 +319,33 @@ namespace osu.Game.Tests.Visual.SongSelectV2
working.BeatmapSetInfo.DateSubmitted = DateTimeOffset.Now;
working.BeatmapSetInfo.DateRanked = DateTimeOffset.Now;
return (working, Screens.SelectV2.SongSelect.BeatmapSetLookupResult.Completed(onlineSet));
return (working, Screens.Select.SongSelect.BeatmapSetLookupResult.Completed(onlineSet));
}
private static IBeatmap createTestBeatmapFromRuleset(RulesetInfo ruleset)
{
List<HitObject> objects = new List<HitObject>();
for (double i = 0; i < 50000; i += 1000)
objects.Add(new TestHitObject { StartTime = i });
return new Beatmap
{
BeatmapInfo = new BeatmapInfo
{
Metadata = new BeatmapMetadata
{
Author = { Username = $"{ruleset.ShortName}Author" },
Artist = $"{ruleset.ShortName}Artist",
Source = $"{ruleset.ShortName}Source",
Title = $"{ruleset.ShortName}Title"
},
Ruleset = ruleset,
StarRating = 6,
DifficultyName = $"{ruleset.ShortName}Version",
Difficulty = new BeatmapDifficulty()
},
HitObjects = objects
};
}
private class TestHitObject : ConvertHitObject;
@@ -8,10 +8,10 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Graphics;
using osu.Game.Overlays;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Visual.UserInterface;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneBeatmapTitleWedgeStatistic : ThemeComparisonTestScene
{
@@ -24,9 +24,13 @@ using osu.Game.Rulesets;
using osu.Game.Tests.Resources;
using osuTK.Input;
using Realms;
using CollectionDropdown = osu.Game.Screens.Select.CollectionDropdown;
namespace osu.Game.Tests.Visual.SongSelect
{
/// <summary>
/// WARNING: TODO: we have TWO `CollectionDropdowns` with diverging functionality. This is not good.
/// </summary>
public partial class TestSceneCollectionDropdown : OsuManualInputManagerTestScene
{
private RulesetStore rulesets = null!;
@@ -198,8 +202,6 @@ namespace osu.Game.Tests.Visual.SongSelect
[Test]
public void TestManageCollectionsFilterIsNotSelected()
{
bool received = false;
addExpandHeaderStep();
AddStep("add collection", () => writeAndRefresh(r => r.Add(new BeatmapCollection(name: "1", new List<string> { "abc" }))));
@@ -213,12 +215,6 @@ namespace osu.Game.Tests.Visual.SongSelect
addExpandHeaderStep();
AddStep("watch for filter requests", () =>
{
received = false;
dropdown.ChildrenOfType<CollectionDropdown>().First().RequestFilter = () => received = true;
});
AddStep("click manage collections filter", () =>
{
int lastItemIndex = dropdown.ChildrenOfType<CollectionDropdown>().Single().Items.Count() - 1;
@@ -227,8 +223,6 @@ namespace osu.Game.Tests.Visual.SongSelect
});
AddAssert("collection filter still selected", () => dropdown.Current.Value.CollectionName == "1");
AddAssert("filter request not fired", () => !received);
}
private void writeAndRefresh(Action<Realm> action) => Realm.Write(r =>
@@ -241,7 +235,7 @@ namespace osu.Game.Tests.Visual.SongSelect
private void assertCollectionHeaderDisplays(LocalisableString collectionName, bool shouldDisplay = true)
=> AddUntilStep($"collection dropdown header displays '{collectionName}'",
() => shouldDisplay == dropdown.ChildrenOfType<CollectionDropdown.OsuDropdownHeader>().Any(h => h.ChildrenOfType<SpriteText>().Any(t => t.Text == collectionName)));
() => shouldDisplay == dropdown.ChildrenOfType<CollectionDropdown.ShearedDropdownHeader>().Any(h => h.ChildrenOfType<SpriteText>().Any(t => t.Text == collectionName)));
private void assertFirstButtonIs(IconUsage icon) => AddUntilStep($"button is {icon.Icon.ToString()}", () => getAddOrRemoveButton(1).Icon.Equals(icon));
@@ -255,7 +249,7 @@ namespace osu.Game.Tests.Visual.SongSelect
private void addExpandHeaderStep() => AddStep("expand header", () =>
{
InputManager.MoveMouseTo(dropdown.ChildrenOfType<CollectionDropdown.OsuDropdownHeader>().Single());
InputManager.MoveMouseTo(dropdown.ChildrenOfType<CollectionDropdown.ShearedDropdownHeader>().Single());
InputManager.Click(MouseButton.Left);
});
@@ -7,12 +7,12 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Overlays;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Visual.UserInterface;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneDifficultyRangeSlider : ThemeComparisonTestScene
{
@@ -11,10 +11,10 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing;
using osu.Game.Overlays;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneDifficultyStatisticsDisplay : OsuTestScene
{
@@ -1,24 +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.
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneFilterControl : OsuManualInputManagerTestScene
{
[SetUp]
public void SetUp() => Schedule(() =>
{
Child = new FilterControl
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
Height = FilterControl.HEIGHT,
};
});
}
}
@@ -13,10 +13,10 @@ using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Utils;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestSceneFooterButtonMods : OsuTestScene
{
@@ -19,12 +19,12 @@ using osu.Game.Overlays;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Scoring;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Resources;
using osu.Game.Tests.Visual.UserInterface;
using osuTK;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestScenePanelBeatmap : ThemeComparisonTestScene
{
@@ -19,12 +19,12 @@ using osu.Game.Overlays;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Scoring;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.Select;
using osu.Game.Tests.Resources;
using osu.Game.Tests.Visual.UserInterface;
using osuTK;
namespace osu.Game.Tests.Visual.SongSelectV2
namespace osu.Game.Tests.Visual.SongSelect
{
public partial class TestScenePanelBeatmapStandalone : ThemeComparisonTestScene
{

Some files were not shown because too many files have changed in this diff Show More