2018-01-05 11:21:19 +00:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-09-18 13:32:49 +00:00
|
|
|
|
// 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.Game.Tests.Visual
|
|
|
|
|
{
|
2017-12-20 12:47:45 +00:00
|
|
|
|
public class TestCaseOnScreenDisplay : OsuTestCase
|
2017-09-18 13:32:49 +00:00
|
|
|
|
{
|
|
|
|
|
private FrameworkConfigManager config;
|
|
|
|
|
private Bindable<FrameSync> frameSyncMode;
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|