1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 15:42:54 +08:00
osu-lazer/osu.Desktop.Tests/Visual/TestCaseOnScreenDisplay.cs

47 lines
1.4 KiB
C#
Raw Normal View History

2017-05-16 11:53:50 +08:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Game.Overlays;
namespace osu.Desktop.Tests.Visual
2017-05-16 11:53:50 +08:00
{
internal class TestCaseOnScreenDisplay : OsuTestCase
2017-05-16 11:53:50 +08:00
{
private FrameworkConfigManager config;
private Bindable<FrameSync> frameSyncMode;
public override string Description => @"Make it easier to see setting changes";
protected override void LoadComplete()
2017-05-16 11:53:50 +08:00
{
base.LoadComplete();
2017-05-16 11:53:50 +08:00
Add(new OnScreenDisplay());
frameSyncMode = config.GetBindable<FrameSync>(FrameworkSetting.FrameSync);
FrameSync initial = frameSyncMode.Value;
AddRepeatStep(@"Change frame limiter", setNextMode, 3);
AddStep(@"Restore frame limiter", () => frameSyncMode.Value = initial);
}
private void setNextMode()
{
var nextMode = frameSyncMode.Value + 1;
if (nextMode > FrameSync.Unlimited)
nextMode = FrameSync.VSync;
frameSyncMode.Value = nextMode;
}
[BackgroundDependencyLoader]
private void load(FrameworkConfigManager config)
{
this.config = config;
}
}
}