mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 10:03:05 +08:00
Merge branch 'master' into text-selection-sfx
This commit is contained in:
commit
764ab9f095
50
osu.Game.Tests/Visual/Gameplay/TestSceneModValidity.cs
Normal file
50
osu.Game.Tests/Visual/Gameplay/TestSceneModValidity.cs
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
[HeadlessTest]
|
||||||
|
public class TestSceneModValidity : TestSceneAllRulesetPlayers
|
||||||
|
{
|
||||||
|
protected override void AddCheckSteps()
|
||||||
|
{
|
||||||
|
AddStep("Check all mod acronyms are unique", () =>
|
||||||
|
{
|
||||||
|
var mods = Ruleset.Value.CreateInstance().AllMods;
|
||||||
|
|
||||||
|
IEnumerable<string> acronyms = mods.Select(m => m.Acronym);
|
||||||
|
|
||||||
|
Assert.That(acronyms, Is.Unique);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("Check all mods are two-way incompatible", () =>
|
||||||
|
{
|
||||||
|
var mods = Ruleset.Value.CreateInstance().AllMods;
|
||||||
|
|
||||||
|
IEnumerable<Mod> modInstances = mods.Select(mod => mod.CreateInstance());
|
||||||
|
|
||||||
|
foreach (var modToCheck in modInstances)
|
||||||
|
{
|
||||||
|
var incompatibleMods = modToCheck.IncompatibleMods;
|
||||||
|
|
||||||
|
foreach (var incompatible in incompatibleMods)
|
||||||
|
{
|
||||||
|
foreach (var incompatibleMod in modInstances.Where(m => incompatible.IsInstanceOfType(m)))
|
||||||
|
{
|
||||||
|
Assert.That(
|
||||||
|
incompatibleMod.IncompatibleMods.Any(m => m.IsInstanceOfType(modToCheck)),
|
||||||
|
$"{modToCheck} has {incompatibleMod} in it's incompatible mods, but {incompatibleMod} does not have {modToCheck} in it's incompatible mods."
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,27 +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.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using osu.Framework.Testing;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
|
||||||
{
|
|
||||||
[HeadlessTest]
|
|
||||||
public class TestSceneNoConflictingModAcronyms : TestSceneAllRulesetPlayers
|
|
||||||
{
|
|
||||||
protected override void AddCheckSteps()
|
|
||||||
{
|
|
||||||
AddStep("Check all mod acronyms are unique", () =>
|
|
||||||
{
|
|
||||||
var mods = Ruleset.Value.CreateInstance().AllMods;
|
|
||||||
|
|
||||||
IEnumerable<string> acronyms = mods.Select(m => m.Acronym);
|
|
||||||
|
|
||||||
Assert.That(acronyms, Is.Unique);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,7 +5,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
@ -39,8 +38,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
Dependencies.Cache(new RealmRulesetStore(Realm));
|
Dependencies.Cache(new RealmRulesetStore(Realm));
|
||||||
Dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, Realm, null, Audio, Resources, host, Beatmap.Default));
|
Dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, Realm, null, Audio, Resources, host, Beatmap.Default));
|
||||||
Dependencies.Cache(Realm);
|
Dependencies.Cache(Realm);
|
||||||
|
|
||||||
beatmapManager.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
@ -66,6 +63,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
beatmapSets.First().ToLive(Realm);
|
beatmapSets.First().ToLive(Realm);
|
||||||
|
|
||||||
|
// Ensure all the initial imports are present before running any tests.
|
||||||
|
Realm.Run(r => r.Refresh());
|
||||||
});
|
});
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -138,7 +138,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddStep("Add collection", () =>
|
AddStep("Add collection", () =>
|
||||||
{
|
{
|
||||||
Dependencies.Get<RealmAccess>().Write(r =>
|
Realm.Write(r =>
|
||||||
{
|
{
|
||||||
r.RemoveAll<BeatmapCollection>();
|
r.RemoveAll<BeatmapCollection>();
|
||||||
r.Add(new BeatmapCollection("wang"));
|
r.Add(new BeatmapCollection("wang"));
|
||||||
|
@ -75,7 +75,14 @@ namespace osu.Game.Collections
|
|||||||
// changes. It's not great but honestly the whole dropdown menu structure isn't great. This needs to be fixed, but I'll issue
|
// changes. It's not great but honestly the whole dropdown menu structure isn't great. This needs to be fixed, but I'll issue
|
||||||
// a warning that it's going to be a frustrating journey.
|
// a warning that it's going to be a frustrating journey.
|
||||||
Current.Value = allBeatmaps;
|
Current.Value = allBeatmaps;
|
||||||
Schedule(() => Current.Value = filters.SingleOrDefault(f => f.Collection != null && f.Collection.ID == selectedItem?.ID) ?? filters[0]);
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
// current may have changed before the scheduled call is run.
|
||||||
|
if (Current.Value != allBeatmaps)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Current.Value = filters.SingleOrDefault(f => f.Collection != null && f.Collection.ID == selectedItem?.ID) ?? filters[0];
|
||||||
|
});
|
||||||
|
|
||||||
// Trigger a re-filter if the current item was in the change set.
|
// Trigger a re-filter if the current item was in the change set.
|
||||||
if (selectedItem != null && changes != null)
|
if (selectedItem != null && changes != null)
|
||||||
|
@ -4,10 +4,8 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Configuration.Tracking;
|
using osu.Framework.Configuration.Tracking;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
@ -31,6 +29,12 @@ namespace osu.Game.Configuration
|
|||||||
[ExcludeFromDynamicCompile]
|
[ExcludeFromDynamicCompile]
|
||||||
public class OsuConfigManager : IniConfigManager<OsuSetting>
|
public class OsuConfigManager : IniConfigManager<OsuSetting>
|
||||||
{
|
{
|
||||||
|
public OsuConfigManager(Storage storage)
|
||||||
|
: base(storage)
|
||||||
|
{
|
||||||
|
Migrate();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void InitialiseDefaults()
|
protected override void InitialiseDefaults()
|
||||||
{
|
{
|
||||||
// UI/selection defaults
|
// UI/selection defaults
|
||||||
@ -172,12 +176,9 @@ namespace osu.Game.Configuration
|
|||||||
SetDefault(OsuSetting.LastProcessedMetadataId, -1);
|
SetDefault(OsuSetting.LastProcessedMetadataId, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDictionary<OsuSetting, string> GetLoggableState() =>
|
protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup)
|
||||||
new Dictionary<OsuSetting, string>(ConfigStore.Where(kvp => !keyContainsPrivateInformation(kvp.Key)).ToDictionary(kvp => kvp.Key, kvp => kvp.Value.ToString()));
|
|
||||||
|
|
||||||
private static bool keyContainsPrivateInformation(OsuSetting argKey)
|
|
||||||
{
|
{
|
||||||
switch (argKey)
|
switch (lookup)
|
||||||
{
|
{
|
||||||
case OsuSetting.Token:
|
case OsuSetting.Token:
|
||||||
return true;
|
return true;
|
||||||
@ -186,12 +187,6 @@ namespace osu.Game.Configuration
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OsuConfigManager(Storage storage)
|
|
||||||
: base(storage)
|
|
||||||
{
|
|
||||||
Migrate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Migrate()
|
public void Migrate()
|
||||||
{
|
{
|
||||||
// arrives as 2020.123.0
|
// arrives as 2020.123.0
|
||||||
|
@ -27,6 +27,12 @@ namespace osu.Game.Overlays.Music
|
|||||||
set => base.Padding = value;
|
set => base.Padding = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnItemsChanged()
|
||||||
|
{
|
||||||
|
base.OnItemsChanged();
|
||||||
|
Filter(currentCriteria);
|
||||||
|
}
|
||||||
|
|
||||||
public void Filter(FilterCriteria criteria)
|
public void Filter(FilterCriteria criteria)
|
||||||
{
|
{
|
||||||
var items = (SearchContainer<RearrangeableListItem<Live<BeatmapSetInfo>>>)ListContainer;
|
var items = (SearchContainer<RearrangeableListItem<Live<BeatmapSetInfo>>>)ListContainer;
|
||||||
@ -44,9 +50,9 @@ namespace osu.Game.Overlays.Music
|
|||||||
|
|
||||||
public Live<BeatmapSetInfo>? FirstVisibleSet => Items.FirstOrDefault(i => ((PlaylistItem)ItemMap[i]).MatchingFilter);
|
public Live<BeatmapSetInfo>? FirstVisibleSet => Items.FirstOrDefault(i => ((PlaylistItem)ItemMap[i]).MatchingFilter);
|
||||||
|
|
||||||
protected override OsuRearrangeableListItem<Live<BeatmapSetInfo>> CreateOsuDrawable(Live<BeatmapSetInfo> item) => new PlaylistItem(item)
|
protected override OsuRearrangeableListItem<Live<BeatmapSetInfo>> CreateOsuDrawable(Live<BeatmapSetInfo> item) =>
|
||||||
|
new PlaylistItem(item)
|
||||||
{
|
{
|
||||||
InSelectedCollection = currentCriteria.Collection?.PerformRead(c => item.Value.Beatmaps.Select(b => b.MD5Hash).Any(c.BeatmapMD5Hashes.Contains)) != false,
|
|
||||||
SelectedSet = { BindTarget = SelectedSet },
|
SelectedSet = { BindTarget = SelectedSet },
|
||||||
RequestSelection = set => RequestSelection?.Invoke(set)
|
RequestSelection = set => RequestSelection?.Invoke(set)
|
||||||
};
|
};
|
||||||
|
@ -9,6 +9,7 @@ using System.Net;
|
|||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Statistics;
|
using osu.Framework.Statistics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -112,8 +113,8 @@ namespace osu.Game.Utils
|
|||||||
|
|
||||||
scope.Contexts[@"config"] = new
|
scope.Contexts[@"config"] = new
|
||||||
{
|
{
|
||||||
Game = game.Dependencies.Get<OsuConfigManager>().GetLoggableState()
|
Game = game.Dependencies.Get<OsuConfigManager>().GetCurrentConfigurationForLogging(),
|
||||||
// TODO: add framework config here. needs some consideration on how to expose.
|
Framework = game.Dependencies.Get<FrameworkConfigManager>().GetCurrentConfigurationForLogging(),
|
||||||
};
|
};
|
||||||
|
|
||||||
game.Dependencies.Get<RealmAccess>().Run(realm =>
|
game.Dependencies.Get<RealmAccess>().Run(realm =>
|
||||||
|
Loading…
Reference in New Issue
Block a user