mirror of
https://github.com/ppy/osu.git
synced 2026-05-13 19:54:15 +08:00
a996261304
It's been a while. Notes: - `SharpCompress` usages changed a bit. Manually adjusted these, mostly just renames or adjusted parameters. - nUnit 3 -> 4 migrated using https://gist.github.com/peppy/07994386d793a117350cb5f24b156585. there's a mode in this script to update to the newer `Assert.That` syntax but it requires fixes and couldn't really be bothered. - DeepEqual nuked as the only usage was on a disabled test. The reason it's disabled has been merged upstream, but it's failing for other (realm) reasons which I don't think is worthwhile to investigate for now. - This bumps Moq. I think the author is back in a sensible headspace and the new version has the stupid shit removed, so probably okay? Nice to be on a level playing field with packages for once in a long time. - Automapper is silly, but we've discussed this elsewhere. - `TestRealmKeyBindingStore` failures are a wildcard, but fixed by using a more standardised testing method. Dunno why, don't care. --------- Co-authored-by: Bartłomiej Dach <dach.bartlomiej@gmail.com>
47 lines
2.3 KiB
C#
47 lines
2.3 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
#nullable disable
|
|
|
|
using System;
|
|
using NUnit.Framework;
|
|
using NUnit.Framework.Legacy;
|
|
using osu.Game.Configuration;
|
|
using osu.Game.Online.API.Requests.Responses;
|
|
|
|
namespace osu.Game.Tests.NonVisual
|
|
{
|
|
[TestFixture]
|
|
public class SessionStaticsTest
|
|
{
|
|
private SessionStatics sessionStatics;
|
|
|
|
[Test]
|
|
public void TestSessionStaticsReset()
|
|
{
|
|
sessionStatics = new SessionStatics();
|
|
|
|
sessionStatics.SetValue(Static.LoginOverlayDisplayed, true);
|
|
sessionStatics.SetValue(Static.MutedAudioNotificationShownOnce, true);
|
|
sessionStatics.SetValue(Static.LowBatteryNotificationShownOnce, true);
|
|
sessionStatics.SetValue(Static.LastHoverSoundPlaybackTime, (double?)1d);
|
|
sessionStatics.SetValue(Static.SeasonalBackgrounds, new APISeasonalBackgrounds { EndDate = new DateTimeOffset(2022, 1, 1, 0, 0, 0, TimeSpan.Zero) });
|
|
|
|
ClassicAssert.False(sessionStatics.GetBindable<bool>(Static.LoginOverlayDisplayed).IsDefault);
|
|
ClassicAssert.False(sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce).IsDefault);
|
|
ClassicAssert.False(sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce).IsDefault);
|
|
ClassicAssert.False(sessionStatics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime).IsDefault);
|
|
ClassicAssert.False(sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds).IsDefault);
|
|
|
|
sessionStatics.ResetAfterInactivity();
|
|
|
|
ClassicAssert.True(sessionStatics.GetBindable<bool>(Static.LoginOverlayDisplayed).IsDefault);
|
|
ClassicAssert.True(sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce).IsDefault);
|
|
ClassicAssert.True(sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce).IsDefault);
|
|
// some statics should not reset despite inactivity.
|
|
ClassicAssert.False(sessionStatics.GetBindable<double?>(Static.LastHoverSoundPlaybackTime).IsDefault);
|
|
ClassicAssert.False(sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds).IsDefault);
|
|
}
|
|
}
|
|
}
|