Merge remote tracking branch 'upstream/master' into archive-reader

This commit is contained in:
Alex Amadori
2017-03-07 08:41:44 +01:00
213 changed files with 2518 additions and 886 deletions

View File

@ -4,9 +4,9 @@
using osu.Framework.Screens.Testing;
using osu.Game.Screens.Select.Options;
namespace osu.Desktop.VisualTests
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseBeatmapOptionsOverlay : TestCase
internal class TestCaseBeatmapOptionsOverlay : TestCase
{
public override string Description => @"Beatmap options in song select";

View File

@ -8,7 +8,7 @@ using osu.Game.Overlays;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseChatDisplay : TestCase
internal class TestCaseChatDisplay : TestCase
{
private ScheduledDelegate messageRequest;
@ -18,7 +18,7 @@ namespace osu.Desktop.VisualTests.Tests
{
base.Reset();
Add(new ChatOverlay()
Add(new ChatOverlay
{
State = Visibility.Visible
});

View File

@ -8,11 +8,11 @@ using osu.Game.Overlays.Dialog;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseDialogOverlay : TestCase
internal class TestCaseDialogOverlay : TestCase
{
public override string Description => @"Display dialogs";
DialogOverlay overlay;
private DialogOverlay overlay;
public override void Reset()
{

View File

@ -2,23 +2,16 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Platform;
using osu.Framework.Screens.Testing;
using osu.Game.Screens.Tournament;
using osu.Game.Screens.Tournament.Teams;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseDrawings : TestCase
internal class TestCaseDrawings : TestCase
{
public override string Description => "Tournament drawings";
[BackgroundDependencyLoader]
private void load(Storage storage)
{
}
public override void Reset()
{
base.Reset();
@ -29,7 +22,7 @@ namespace osu.Desktop.VisualTests.Tests
});
}
class TestTeamList : ITeamList
private class TestTeamList : ITeamList
{
public IEnumerable<Team> Teams { get; } = new[]
{

View File

@ -18,7 +18,7 @@ using OpenTK;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseGamefield : TestCase
internal class TestCaseGamefield : TestCase
{
public override string Description => @"Showing hitobjects and what not.";
@ -31,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests
int time = 500;
for (int i = 0; i < 100; i++)
{
objects.Add(new HitCircle()
objects.Add(new HitCircle
{
StartTime = time,
Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384)),

View File

@ -17,12 +17,12 @@ using OpenTK.Graphics;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseHitObjects : TestCase
internal class TestCaseHitObjects : TestCase
{
private StopwatchClock rateAdjustClock;
private FramedClock framedClock;
bool auto = false;
private bool auto;
public TestCaseHitObjects()
{
@ -31,9 +31,9 @@ namespace osu.Desktop.VisualTests.Tests
playbackSpeed.ValueChanged += delegate { rateAdjustClock.Rate = playbackSpeed.Value; };
}
HitObjectType mode = HitObjectType.Slider;
private HitObjectType mode = HitObjectType.Slider;
BindableNumber<double> playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 };
private BindableNumber<double> playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 };
private Container playfieldContainer;
private Container approachContainer;
@ -61,7 +61,7 @@ namespace osu.Desktop.VisualTests.Tests
add(new DrawableSlider(new Slider
{
StartTime = framedClock.CurrentTime + 600,
ControlPoints = new List<Vector2>()
ControlPoints = new List<Vector2>
{
new Vector2(-200, 0),
new Vector2(400, 0),
@ -93,7 +93,7 @@ namespace osu.Desktop.VisualTests.Tests
AddButton(@"slider", () => load(HitObjectType.Slider));
AddButton(@"spinner", () => load(HitObjectType.Spinner));
AddToggle(@"auto", (state) => { auto = state; load(mode); });
AddToggle(@"auto", state => { auto = state; load(mode); });
ButtonsContainer.Add(new SpriteText { Text = "Playback Speed" });
ButtonsContainer.Add(new BasicSliderBar<double>
@ -122,8 +122,9 @@ namespace osu.Desktop.VisualTests.Tests
load(mode);
}
int depth;
void add(DrawableHitObject h)
private int depth;
private void add(DrawableHitObject h)
{
h.Anchor = Anchor.Centre;
h.Depth = depth++;

View File

@ -15,7 +15,7 @@ using osu.Game.Screens.Play;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseKeyCounter : TestCase
internal class TestCaseKeyCounter : TestCase
{
public override string Description => @"Tests key counter";

View File

@ -9,7 +9,7 @@ using OpenTK.Graphics;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseMenuButtonSystem : TestCase
internal class TestCaseMenuButtonSystem : TestCase
{
public override string Description => @"Main menu button system";

View File

@ -8,7 +8,7 @@ using osu.Game.Modes;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseModSelectOverlay : TestCase
internal class TestCaseModSelectOverlay : TestCase
{
public override string Description => @"Tests the mod select overlay";

View File

@ -9,7 +9,7 @@ using osu.Framework.Graphics.Containers;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseMusicController : TestCase
internal class TestCaseMusicController : TestCase
{
public override string Description => @"Tests music controller ui.";
@ -30,7 +30,7 @@ namespace osu.Desktop.VisualTests.Tests
Anchor = Anchor.Centre
};
Add(mc);
AddToggle(@"Show", (state) => mc.State = state ? Visibility.Visible : Visibility.Hidden);
AddToggle(@"Show", state => mc.State = state ? Visibility.Visible : Visibility.Hidden);
}
}
}

View File

@ -12,11 +12,11 @@ using osu.Framework.Graphics.Containers;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseNotificationManager : TestCase
internal class TestCaseNotificationManager : TestCase
{
public override string Description => @"I handle notifications";
NotificationManager manager;
private NotificationManager manager;
public override void Reset()
{
@ -30,7 +30,7 @@ namespace osu.Desktop.VisualTests.Tests
Origin = Anchor.TopRight,
});
AddToggle(@"show", (state) => manager.State = state ? Visibility.Visible : Visibility.Hidden);
AddToggle(@"show", state => manager.State = state ? Visibility.Visible : Visibility.Hidden);
AddButton(@"simple #1", sendNotification1);
AddButton(@"simple #2", sendNotification2);
@ -95,7 +95,7 @@ namespace osu.Desktop.VisualTests.Tests
progressingNotifications.Add(n);
}
List<ProgressNotification> progressingNotifications = new List<ProgressNotification>();
private List<ProgressNotification> progressingNotifications = new List<ProgressNotification>();
private void sendProgress1()
{

View File

@ -6,7 +6,7 @@ using osu.Game.Overlays;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseOptions : TestCase
internal class TestCaseOptions : TestCase
{
public override string Description => @"Tests the options overlay";

View File

@ -7,7 +7,7 @@ using osu.Game.Screens.Play;
namespace osu.Desktop.VisualTests.Tests
{
class TestCasePauseOverlay : TestCase
internal class TestCasePauseOverlay : TestCase
{
public override string Description => @"Tests the pause overlay";

View File

@ -11,7 +11,7 @@ using osu.Game.Screens.Select;
namespace osu.Desktop.VisualTests.Tests
{
class TestCasePlaySongSelect : TestCase
internal class TestCasePlaySongSelect : TestCase
{
private BeatmapDatabase db, oldDb;
private TestStorage storage;

View File

@ -18,24 +18,30 @@ using OpenTK.Graphics;
namespace osu.Desktop.VisualTests.Tests
{
class TestCasePlayer : TestCase
internal class TestCasePlayer : TestCase
{
private WorkingBeatmap beatmap;
protected Player Player;
private BeatmapDatabase db;
public override string Description => @"Showing everything to play the game.";
[BackgroundDependencyLoader]
private void load(BeatmapDatabase db)
{
var beatmapInfo = db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault();
if (beatmapInfo != null)
beatmap = db.GetWorkingBeatmap(beatmapInfo);
this.db = db;
}
public override void Reset()
{
base.Reset();
WorkingBeatmap beatmap = null;
var beatmapInfo = db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault();
if (beatmapInfo != null)
beatmap = db.GetWorkingBeatmap(beatmapInfo);
if (beatmap?.Track == null)
{
var objects = new List<HitObject>();
@ -43,7 +49,7 @@ namespace osu.Desktop.VisualTests.Tests
int time = 1500;
for (int i = 0; i < 50; i++)
{
objects.Add(new HitCircle()
objects.Add(new HitCircle
{
StartTime = time,
Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : 512,
@ -81,17 +87,21 @@ namespace osu.Desktop.VisualTests.Tests
Colour = Color4.Black,
});
Add(new PlayerLoader(new Player
{
PreferredPlayMode = PlayMode.Osu,
Beatmap = beatmap
})
Add(new PlayerLoader(Player = CreatePlayer(beatmap))
{
Beatmap = beatmap
});
}
class TestWorkingBeatmap : WorkingBeatmap
protected virtual Player CreatePlayer(WorkingBeatmap beatmap)
{
return new Player
{
Beatmap = beatmap
};
}
private class TestWorkingBeatmap : WorkingBeatmap
{
public TestWorkingBeatmap(Beatmap beatmap)
: base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet)

View File

@ -0,0 +1,40 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Input.Handlers;
using osu.Framework.Platform;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Modes;
using osu.Game.Screens.Play;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseReplay : TestCasePlayer
{
private WorkingBeatmap beatmap;
private InputHandler replay;
private Func<Stream> getReplayStream;
private ScoreDatabase scoreDatabase;
public override string Description => @"Testing replay playback.";
[BackgroundDependencyLoader]
private void load(Storage storage)
{
scoreDatabase = new ScoreDatabase(storage);
}
protected override Player CreatePlayer(WorkingBeatmap beatmap)
{
var player = base.CreatePlayer(beatmap);
player.ReplayInputHandler = Ruleset.GetRuleset(beatmap.PlayMode).CreateAutoplayScore(beatmap.Beatmap)?.Replay?.GetInputHandler();
return player;
}
}
}

View File

@ -18,7 +18,7 @@ using osu.Framework.Graphics.Primitives;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseScoreCounter : TestCase
internal class TestCaseScoreCounter : TestCase
{
public override string Description => @"Tests multiple counters";

View File

@ -12,7 +12,7 @@ using OpenTK.Graphics;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseTextAwesome : TestCase
internal class TestCaseTextAwesome : TestCase
{
public override string Description => @"Tests display of icons";
@ -22,7 +22,7 @@ namespace osu.Desktop.VisualTests.Tests
FillFlowContainer flow;
Add(flow = new FillFlowContainer()
Add(flow = new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.5f),

View File

@ -7,7 +7,7 @@ using osu.Game.Screens.Play;
namespace osu.Desktop.VisualTests.Tests
{
class TestCaseTwoLayerButton : TestCase
internal class TestCaseTwoLayerButton : TestCase
{
public override string Description => @"Back and skip and what not";