-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix initial skin state being stored wrong to undo history #30060
base: master
Are you sure you want to change the base?
Conversation
So I was like "alright this appears to work, but it's a schedule fix, so I'm not going to let it pass review without tests". So I wrote one, using a slightly different scenario to what I was testing with, and... the issue is still there... diff --git a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs
index 5267a57a05..88dffc9979 100644
--- a/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs
+++ b/osu.Game.Tests/Visual/Navigation/TestSceneSkinEditorNavigation.cs
@@ -5,6 +5,7 @@
using System;
using System.Linq;
+using Newtonsoft.Json;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Extensions;
@@ -23,6 +24,7 @@
using osu.Game.Rulesets.Osu.Mods;
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.Skinning;
using osu.Game.Tests.Beatmaps.IO;
@@ -101,6 +103,36 @@ public void TestMutateProtectedSkinDuringGameplay()
AddUntilStep("current skin is mutable", () => !Game.Dependencies.Get<SkinManager>().CurrentSkin.Value.SkinInfo.Value.Protected);
}
+ [Test]
+ public void TestMutateProtectedSkinInitialStateIsCorrect()
+ {
+ AddStep("set default skin", () => Game.Dependencies.Get<SkinManager>().CurrentSkinInfo.SetDefault());
+ AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
+
+ openSkinEditor();
+ AddUntilStep("current skin is mutable", () => !Game.Dependencies.Get<SkinManager>().CurrentSkin.Value.SkinInfo.Value.Protected);
+
+ AddUntilStep("wait for player", () =>
+ {
+ DismissAnyNotifications();
+ return Game.ScreenStack.CurrentScreen is Player;
+ });
+
+ string state = string.Empty;
+
+ AddStep("dump state of accuracy meter", () => JsonConvert.SerializeObject(Game.ChildrenOfType<ArgonAccuracyCounter>().First().CreateSerialisedInfo()));
+ AddStep("add any component", () => Game.ChildrenOfType<SkinComponentToolbox.ToolboxComponentButton>().First().TriggerClick());
+ AddStep("undo", () =>
+ {
+ InputManager.PressKey(Key.ControlLeft);
+ InputManager.Key(Key.Z);
+ InputManager.ReleaseKey(Key.ControlLeft);
+ });
+ AddAssert("accuracy meter state unchanged",
+ () => JsonConvert.SerializeObject(Game.ChildrenOfType<ArgonAccuracyCounter>().First().CreateSerialisedInfo()),
+ () => Is.EqualTo(state));
+ }
+
[Test]
public void TestComponentsDeselectedOnSkinEditorHide()
{
It appears that for whatever reason it matters whether you open skin editor from an existing gameplay session (fix works then), or whether you open it at main menu, which will open gameplay for you (fix is broken then)... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above
I tried to revive this and I think I got a bit closer to fixing the remaining issues but the tests I added still fail sometimes and I'm not sure why, so I'm gonna leave this for another day and see if I can power through. |
Closes #29429.
Scheduler fixes are always bad, but I don't see a better way to handle this.