mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 14:17:06 +09:00
Merge branch 'master' into hold-for-menu-back
This commit is contained in:
@ -5,7 +5,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Screens.Edit.Screens.Compose;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
|
123
osu.Game.Tests/Visual/TestCaseChannelTabControl.cs
Normal file
123
osu.Game.Tests/Visual/TestCaseChannelTabControl.cs
Normal file
@ -0,0 +1,123 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays.Chat.Tabs;
|
||||
using osu.Game.Users;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public class TestCaseChannelTabControl : OsuTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(ChannelTabControl),
|
||||
};
|
||||
|
||||
private readonly ChannelTabControl channelTabControl;
|
||||
|
||||
public TestCaseChannelTabControl()
|
||||
{
|
||||
SpriteText currentText;
|
||||
Add(new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
channelTabControl = new ChannelTabControl
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Height = 50
|
||||
},
|
||||
new Box
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0.1f),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 50,
|
||||
Depth = -1,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Add(new Container
|
||||
{
|
||||
Origin = Anchor.TopLeft,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
currentText = new SpriteText
|
||||
{
|
||||
Text = "Currently selected channel:"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
channelTabControl.OnRequestLeave += channel => channelTabControl.RemoveChannel(channel);
|
||||
channelTabControl.Current.ValueChanged += channel => currentText.Text = "Currently selected channel: " + channel.ToString();
|
||||
|
||||
AddStep("Add random private channel", addRandomUser);
|
||||
AddAssert("There is only one channels", () => channelTabControl.Items.Count() == 2);
|
||||
AddRepeatStep("Add 3 random private channels", addRandomUser, 3);
|
||||
AddAssert("There are four channels", () => channelTabControl.Items.Count() == 5);
|
||||
AddStep("Add random public channel", () => addChannel(RNG.Next().ToString()));
|
||||
|
||||
AddRepeatStep("Select a random channel", () => channelTabControl.Current.Value = channelTabControl.Items.ElementAt(RNG.Next(channelTabControl.Items.Count())), 20);
|
||||
}
|
||||
|
||||
private List<User> users;
|
||||
|
||||
private void addRandomUser()
|
||||
{
|
||||
channelTabControl.AddChannel(new Channel
|
||||
{
|
||||
Users =
|
||||
{
|
||||
users?.Count > 0
|
||||
? users[RNG.Next(0, users.Count - 1)]
|
||||
: new User
|
||||
{
|
||||
Id = RNG.Next(),
|
||||
Username = "testuser" + RNG.Next(1000)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addChannel(string name)
|
||||
{
|
||||
channelTabControl.AddChannel(new Channel
|
||||
{
|
||||
Type = ChannelType.Public,
|
||||
Name = name
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(IAPIProvider api)
|
||||
{
|
||||
GetUsersRequest req = new GetUsersRequest();
|
||||
req.Success += list => users = list.Select(e => e.User).ToList();
|
||||
|
||||
api.Queue(req);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +1,45 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Chat;
|
||||
using osu.Game.Overlays.Chat.Tabs;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
[Description("Testing chat api and overlay")]
|
||||
public class TestCaseChatDisplay : OsuTestCase
|
||||
{
|
||||
public TestCaseChatDisplay()
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
Add(new ChatOverlay
|
||||
typeof(ChatOverlay),
|
||||
typeof(ChatLine),
|
||||
typeof(DrawableChannel),
|
||||
typeof(ChannelSelectorTabItem),
|
||||
typeof(ChannelTabControl),
|
||||
typeof(ChannelTabItem),
|
||||
typeof(PrivateChannelTabItem),
|
||||
typeof(TabCloseButton)
|
||||
};
|
||||
|
||||
[Cached]
|
||||
private readonly ChannelManager channelManager = new ChannelManager();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
State = Visibility.Visible
|
||||
});
|
||||
channelManager,
|
||||
new ChatOverlay { State = Visibility.Visible }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -50,14 +50,13 @@ namespace osu.Game.Tests.Visual
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
linkColour = colours.Blue;
|
||||
Dependencies.Cache(new ChatOverlay
|
||||
{
|
||||
AvailableChannels =
|
||||
{
|
||||
new Channel { Name = "#english" },
|
||||
new Channel { Name = "#japanese" }
|
||||
}
|
||||
});
|
||||
|
||||
var chatManager = new ChannelManager();
|
||||
chatManager.AvailableChannels.Add(new Channel { Name = "#english"});
|
||||
chatManager.AvailableChannels.Add(new Channel { Name = "#japanese" });
|
||||
Dependencies.Cache(chatManager);
|
||||
|
||||
Dependencies.Cache(new ChatOverlay());
|
||||
|
||||
testLinksGeneral();
|
||||
testEcho();
|
||||
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Edit.Screens.Compose;
|
||||
using osu.Game.Screens.Edit.Compose;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
@ -14,13 +14,13 @@ namespace osu.Game.Tests.Visual
|
||||
[TestFixture]
|
||||
public class TestCaseEditorCompose : EditorClockTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Compose) };
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ComposeScreen) };
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||
Child = new Compose();
|
||||
Child = new ComposeScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Screens.Edit.Screens.Compose.RadioButtons;
|
||||
using osu.Game.Screens.Edit.Components.RadioButtons;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
|
||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
|
@ -8,7 +8,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Edit.Menus;
|
||||
using osu.Game.Screens.Edit.Components.Menus;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
|
@ -11,13 +11,14 @@ using OpenTK;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Edit;
|
||||
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks;
|
||||
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircleMasks.Components;
|
||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Screens.Edit.Screens.Compose;
|
||||
using osu.Game.Screens.Edit.Screens.Compose.Layers;
|
||||
using osu.Game.Screens.Edit.Compose;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
@ -28,15 +29,15 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(MaskSelection),
|
||||
typeof(DragLayer),
|
||||
typeof(SelectionBox),
|
||||
typeof(DragBox),
|
||||
typeof(HitObjectComposer),
|
||||
typeof(OsuHitObjectComposer),
|
||||
typeof(HitObjectMaskLayer),
|
||||
typeof(BlueprintContainer),
|
||||
typeof(NotNullAttribute),
|
||||
typeof(HitCirclePiece),
|
||||
typeof(HitCircleSelectionMask),
|
||||
typeof(HitCirclePlacementMask),
|
||||
typeof(HitCircleSelectionBlueprint),
|
||||
typeof(HitCirclePlacementBlueprint),
|
||||
};
|
||||
|
||||
private HitObjectComposer composer;
|
||||
@ -53,12 +54,11 @@ namespace osu.Game.Tests.Visual
|
||||
new Slider
|
||||
{
|
||||
Position = new Vector2(128, 256),
|
||||
ControlPoints = new[]
|
||||
Path = new SliderPath(PathType.Linear, new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
new Vector2(216, 0),
|
||||
},
|
||||
Distance = 216,
|
||||
}),
|
||||
Scale = 0.5f,
|
||||
}
|
||||
},
|
||||
|
@ -5,9 +5,9 @@ using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Screens.Edit.Setup.Components.LabelledComponents;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
|
@ -9,6 +9,7 @@ using OpenTK;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Timing;
|
||||
@ -22,6 +23,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Playfield) };
|
||||
|
||||
private readonly ScrollingTestContainer[] scrollContainers = new ScrollingTestContainer[4];
|
||||
private readonly TestPlayfield[] playfields = new TestPlayfield[4];
|
||||
|
||||
public TestCaseScrollingHitObjects()
|
||||
@ -33,18 +35,38 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
playfields[0] = new TestPlayfield(ScrollingDirection.Up),
|
||||
playfields[1] = new TestPlayfield(ScrollingDirection.Down)
|
||||
scrollContainers[0] = new ScrollingTestContainer(ScrollingDirection.Up)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = playfields[0] = new TestPlayfield()
|
||||
},
|
||||
scrollContainers[1] = new ScrollingTestContainer(ScrollingDirection.Up)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = playfields[1] = new TestPlayfield()
|
||||
},
|
||||
},
|
||||
new Drawable[]
|
||||
{
|
||||
playfields[2] = new TestPlayfield(ScrollingDirection.Left),
|
||||
playfields[3] = new TestPlayfield(ScrollingDirection.Right)
|
||||
scrollContainers[2] = new ScrollingTestContainer(ScrollingDirection.Up)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = playfields[2] = new TestPlayfield()
|
||||
},
|
||||
scrollContainers[3] = new ScrollingTestContainer(ScrollingDirection.Up)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = playfields[3] = new TestPlayfield()
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AddSliderStep("Time range", 100, 10000, 5000, v => playfields.ForEach(p => p.VisibleTimeRange.Value = v));
|
||||
AddStep("Constant scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Constant));
|
||||
AddStep("Overlapping scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Overlapping));
|
||||
AddStep("Sequential scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Sequential));
|
||||
|
||||
AddSliderStep("Time range", 100, 10000, 5000, v => scrollContainers.ForEach(c => c.TimeRange = v));
|
||||
AddStep("Add control point", () => addControlPoint(Time.Current + 5000));
|
||||
}
|
||||
|
||||
@ -52,7 +74,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
playfields.ForEach(p => p.HitObjects.AddControlPoint(new MultiplierControlPoint(0)));
|
||||
scrollContainers.ForEach(c => c.ControlPoints.Add(new MultiplierControlPoint(0)));
|
||||
|
||||
for (int i = 0; i <= 5000; i += 1000)
|
||||
addHitObject(Time.Current + i);
|
||||
@ -73,12 +95,15 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
private void addControlPoint(double time)
|
||||
{
|
||||
scrollContainers.ForEach(c =>
|
||||
{
|
||||
c.ControlPoints.Add(new MultiplierControlPoint(time) { DifficultyPoint = { SpeedMultiplier = 3 } });
|
||||
c.ControlPoints.Add(new MultiplierControlPoint(time + 2000) { DifficultyPoint = { SpeedMultiplier = 2 } });
|
||||
c.ControlPoints.Add(new MultiplierControlPoint(time + 3000) { DifficultyPoint = { SpeedMultiplier = 1 } });
|
||||
});
|
||||
|
||||
playfields.ForEach(p =>
|
||||
{
|
||||
p.HitObjects.AddControlPoint(new MultiplierControlPoint(time) { DifficultyPoint = { SpeedMultiplier = 3 } });
|
||||
p.HitObjects.AddControlPoint(new MultiplierControlPoint(time + 2000) { DifficultyPoint = { SpeedMultiplier = 2 } });
|
||||
p.HitObjects.AddControlPoint(new MultiplierControlPoint(time + 3000) { DifficultyPoint = { SpeedMultiplier = 1 } });
|
||||
|
||||
TestDrawableControlPoint createDrawablePoint(double t)
|
||||
{
|
||||
var obj = new TestDrawableControlPoint(p.Direction, t);
|
||||
@ -111,15 +136,14 @@ namespace osu.Game.Tests.Visual
|
||||
}
|
||||
}
|
||||
|
||||
private void setScrollAlgorithm(ScrollVisualisationMethod algorithm) => scrollContainers.ForEach(c => c.ScrollAlgorithm = algorithm);
|
||||
|
||||
private class TestPlayfield : ScrollingPlayfield
|
||||
{
|
||||
public new readonly ScrollingDirection Direction;
|
||||
public new ScrollingDirection Direction => base.Direction.Value;
|
||||
|
||||
public TestPlayfield(ScrollingDirection direction)
|
||||
public TestPlayfield()
|
||||
{
|
||||
Direction = direction;
|
||||
|
||||
Padding = new MarginPadding(2);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
|
@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
|
||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
|
Reference in New Issue
Block a user