mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-15 03:20:30 +00:00
Add failing test
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
// 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.
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
|
||||
namespace osu.Framework.Tests.Input.HandleInputCache
|
||||
{
|
||||
public partial class HandleInputCacheTest
|
||||
{
|
||||
[Test]
|
||||
public void TestNonPartialLeafClass()
|
||||
{
|
||||
var d = new NonPartialLeafClass();
|
||||
|
||||
Assert.That(Drawable.HandleInputCache.RequestsPositionalInput(d));
|
||||
Assert.That(Drawable.HandleInputCache.RequestsNonPositionalInput(d));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPartialLeafClass()
|
||||
{
|
||||
var d = new PartialLeafClass();
|
||||
|
||||
Assert.That(Drawable.HandleInputCache.RequestsPositionalInput(d));
|
||||
Assert.That(Drawable.HandleInputCache.RequestsNonPositionalInput(d));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPartialLeafClassWithNonPartialIntermediateClass()
|
||||
{
|
||||
var d = new PartialLeafClassWithIntermediateNonPartial();
|
||||
|
||||
Assert.That(Drawable.HandleInputCache.RequestsPositionalInput(d));
|
||||
Assert.That(Drawable.HandleInputCache.RequestsNonPositionalInput(d));
|
||||
}
|
||||
|
||||
#pragma warning disable OFSG001
|
||||
private sealed class NonPartialLeafClass : Drawable
|
||||
{
|
||||
protected override bool Handle(UIEvent e) => true;
|
||||
}
|
||||
#pragma warning restore OFSG001
|
||||
|
||||
private partial class PartialLeafClass : Drawable
|
||||
{
|
||||
protected override bool Handle(UIEvent e) => true;
|
||||
}
|
||||
|
||||
#pragma warning disable OFSG001
|
||||
private class IntermediateNonPartialClass : Drawable
|
||||
{
|
||||
protected override bool Handle(UIEvent e) => true;
|
||||
}
|
||||
#pragma warning restore OFSG001
|
||||
|
||||
private partial class PartialLeafClassWithIntermediateNonPartial : IntermediateNonPartialClass
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@ namespace osu.Framework.Graphics
|
||||
/// <summary>
|
||||
/// Nested class which is used for caching <see cref="HandleNonPositionalInput"/>, <see cref="HandlePositionalInput"/> values.
|
||||
/// </summary>
|
||||
private static class HandleInputCache
|
||||
internal static class HandleInputCache
|
||||
{
|
||||
private static readonly ConcurrentDictionary<Type, bool> positional_cached_values = new ConcurrentDictionary<Type, bool>();
|
||||
private static readonly ConcurrentDictionary<Type, bool> non_positional_cached_values = new ConcurrentDictionary<Type, bool>();
|
||||
|
||||
Reference in New Issue
Block a user