mirror of
https://github.com/osukey/osukey.git
synced 2025-05-23 14:37:39 +09:00
Fix failing tests
This commit is contained in:
parent
b536f571fd
commit
1f0aa974dd
@ -427,7 +427,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
var set = createTestBeatmapSet(i, 3);
|
var set = createTestBeatmapSet(i);
|
||||||
set.Beatmaps[0].StarDifficulty = 3 - i;
|
set.Beatmaps[0].StarDifficulty = 3 - i;
|
||||||
set.Beatmaps[2].StarDifficulty = 6 + i;
|
set.Beatmaps[2].StarDifficulty = 6 + i;
|
||||||
sets.Add(set);
|
sets.Add(set);
|
||||||
@ -822,7 +822,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddAssert("Selection is visible", selectedBeatmapVisible);
|
AddAssert("Selection is visible", selectedBeatmapVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BeatmapSetInfo createTestBeatmapSet(int id, int minimumDifficulties = 1)
|
private BeatmapSetInfo createTestBeatmapSet(int id, bool randomDifficultyCount = false)
|
||||||
{
|
{
|
||||||
return new BeatmapSetInfo
|
return new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
@ -836,7 +836,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Title = $"test set #{id}!",
|
Title = $"test set #{id}!",
|
||||||
AuthorString = string.Concat(Enumerable.Repeat((char)('z' - Math.Min(25, id - 1)), 5))
|
AuthorString = string.Concat(Enumerable.Repeat((char)('z' - Math.Min(25, id - 1)), 5))
|
||||||
},
|
},
|
||||||
Beatmaps = getBeatmaps(RNG.Next(minimumDifficulties, 20)).ToList()
|
Beatmaps = getBeatmaps(randomDifficultyCount ? RNG.Next(1, 20) : 3).ToList()
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -846,14 +846,22 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
float diff = (float)i / count * 10;
|
||||||
|
|
||||||
|
string version = "Normal";
|
||||||
|
if (diff > 6.6)
|
||||||
|
version = "Insane";
|
||||||
|
else if (diff > 3.3)
|
||||||
|
version = "Hard";
|
||||||
|
|
||||||
yield return new BeatmapInfo
|
yield return new BeatmapInfo
|
||||||
{
|
{
|
||||||
OnlineBeatmapID = id++ * 10,
|
OnlineBeatmapID = id++ * 10,
|
||||||
Version = "Normal",
|
Version = version,
|
||||||
StarDifficulty = RNG.NextSingle() * 10,
|
StarDifficulty = diff,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
OverallDifficulty = RNG.NextSingle() * 10,
|
OverallDifficulty = diff,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -899,7 +907,22 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
{
|
{
|
||||||
public bool PendingFilterTask => PendingFilter != null;
|
public bool PendingFilterTask => PendingFilter != null;
|
||||||
|
|
||||||
public IEnumerable<DrawableCarouselItem> Items => InternalChildren.OfType<DrawableCarouselItem>();
|
public IEnumerable<DrawableCarouselItem> Items
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
foreach (var item in ScrollableContent)
|
||||||
|
{
|
||||||
|
yield return item;
|
||||||
|
|
||||||
|
if (item is DrawableCarouselBeatmapSet set)
|
||||||
|
{
|
||||||
|
foreach (var difficulty in set.ChildItems)
|
||||||
|
yield return difficulty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override IEnumerable<BeatmapSetInfo> GetLoadableBeatmaps() => Enumerable.Empty<BeatmapSetInfo>();
|
protected override IEnumerable<BeatmapSetInfo> GetLoadableBeatmaps() => Enumerable.Empty<BeatmapSetInfo>();
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ namespace osu.Game.Screens.Select
|
|||||||
if (selectedBeatmapSet != null && !beatmapSets.Contains(selectedBeatmapSet.BeatmapSet))
|
if (selectedBeatmapSet != null && !beatmapSets.Contains(selectedBeatmapSet.BeatmapSet))
|
||||||
selectedBeatmapSet = null;
|
selectedBeatmapSet = null;
|
||||||
|
|
||||||
scrollableContent.Clear(false);
|
ScrollableContent.Clear(false);
|
||||||
itemsCache.Invalidate();
|
itemsCache.Invalidate();
|
||||||
scrollPositionCache.Invalidate();
|
scrollPositionCache.Invalidate();
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ namespace osu.Game.Screens.Select
|
|||||||
private readonly Cached itemsCache = new Cached();
|
private readonly Cached itemsCache = new Cached();
|
||||||
private readonly Cached scrollPositionCache = new Cached();
|
private readonly Cached scrollPositionCache = new Cached();
|
||||||
|
|
||||||
private readonly Container<DrawableCarouselItem> scrollableContent;
|
protected readonly Container<DrawableCarouselItem> ScrollableContent;
|
||||||
|
|
||||||
public Bindable<bool> RightClickScrollingEnabled = new Bindable<bool>();
|
public Bindable<bool> RightClickScrollingEnabled = new Bindable<bool>();
|
||||||
|
|
||||||
@ -151,7 +151,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
setPool,
|
setPool,
|
||||||
scrollableContent = new Container<DrawableCarouselItem>
|
ScrollableContent = new Container<DrawableCarouselItem>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
}
|
}
|
||||||
@ -595,7 +595,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
var toDisplay = visibleItems.GetRange(displayedRange.first, displayedRange.last - displayedRange.first);
|
var toDisplay = visibleItems.GetRange(displayedRange.first, displayedRange.last - displayedRange.first);
|
||||||
|
|
||||||
foreach (var panel in scrollableContent.Children)
|
foreach (var panel in ScrollableContent.Children)
|
||||||
{
|
{
|
||||||
if (toDisplay.Remove(panel.Item))
|
if (toDisplay.Remove(panel.Item))
|
||||||
{
|
{
|
||||||
@ -622,7 +622,7 @@ namespace osu.Game.Screens.Select
|
|||||||
panel.Depth = item.CarouselYPosition;
|
panel.Depth = item.CarouselYPosition;
|
||||||
panel.Y = item.CarouselYPosition;
|
panel.Y = item.CarouselYPosition;
|
||||||
|
|
||||||
scrollableContent.Add(panel);
|
ScrollableContent.Add(panel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,7 +630,7 @@ namespace osu.Game.Screens.Select
|
|||||||
// This is common if a selected/collapsed state has changed.
|
// This is common if a selected/collapsed state has changed.
|
||||||
if (revalidateItems)
|
if (revalidateItems)
|
||||||
{
|
{
|
||||||
foreach (DrawableCarouselItem panel in scrollableContent.Children)
|
foreach (DrawableCarouselItem panel in ScrollableContent.Children)
|
||||||
{
|
{
|
||||||
panel.MoveToY(panel.Item.CarouselYPosition, 800, Easing.OutQuint);
|
panel.MoveToY(panel.Item.CarouselYPosition, 800, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
@ -638,7 +638,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
// Update externally controlled state of currently visible items (e.g. x-offset and opacity).
|
// Update externally controlled state of currently visible items (e.g. x-offset and opacity).
|
||||||
// This is a per-frame update on all drawable panels.
|
// This is a per-frame update on all drawable panels.
|
||||||
foreach (DrawableCarouselItem item in scrollableContent.Children)
|
foreach (DrawableCarouselItem item in ScrollableContent.Children)
|
||||||
{
|
{
|
||||||
updateItem(item);
|
updateItem(item);
|
||||||
|
|
||||||
@ -786,7 +786,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentY += visibleHalfHeight;
|
currentY += visibleHalfHeight;
|
||||||
scrollableContent.Height = currentY;
|
ScrollableContent.Height = currentY;
|
||||||
|
|
||||||
if (BeatmapSetsLoaded && (selectedBeatmapSet == null || selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected))
|
if (BeatmapSetsLoaded && (selectedBeatmapSet == null || selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected))
|
||||||
{
|
{
|
||||||
@ -841,7 +841,7 @@ namespace osu.Game.Screens.Select
|
|||||||
/// <param name="parent">For nested items, the parent of the item to be updated.</param>
|
/// <param name="parent">For nested items, the parent of the item to be updated.</param>
|
||||||
private void updateItem(DrawableCarouselItem item, DrawableCarouselItem parent = null)
|
private void updateItem(DrawableCarouselItem item, DrawableCarouselItem parent = null)
|
||||||
{
|
{
|
||||||
Vector2 posInScroll = scrollableContent.ToLocalSpace(item.Header.ScreenSpaceDrawQuad.Centre);
|
Vector2 posInScroll = ScrollableContent.ToLocalSpace(item.Header.ScreenSpaceDrawQuad.Centre);
|
||||||
float itemDrawY = posInScroll.Y - visibleUpperBound;
|
float itemDrawY = posInScroll.Y - visibleUpperBound;
|
||||||
float dist = Math.Abs(1f - itemDrawY / visibleHalfHeight);
|
float dist = Math.Abs(1f - itemDrawY / visibleHalfHeight);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user