mirror of
https://github.com/osukey/osukey.git
synced 2025-05-19 20:47:24 +09:00
Create a test and a check if initial zoom value of ZoomableScrollContainer is in range
This commit is contained in:
parent
9d94343317
commit
c075d3de08
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
using System;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
@ -66,6 +67,18 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddUntilStep("Scroll container is loaded", () => scrollContainer.LoadState >= LoadState.Loaded);
|
AddUntilStep("Scroll container is loaded", () => scrollContainer.LoadState >= LoadState.Loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestInitialZoomOutOfRange()
|
||||||
|
{
|
||||||
|
AddStep("Invalid ZoomableScrollContainer throws ArgumentException", () =>
|
||||||
|
{
|
||||||
|
Assert.Throws<ArgumentException>(() =>
|
||||||
|
{
|
||||||
|
_ = new ZoomableScrollContainer(1, 60, 0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestWidthInitialization()
|
public void TestWidthInitialization()
|
||||||
{
|
{
|
||||||
|
@ -87,6 +87,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
if (minimum > maximum)
|
if (minimum > maximum)
|
||||||
throw new ArgumentException($"{nameof(minimum)} ({minimum}) must be less than {nameof(maximum)} ({maximum})");
|
throw new ArgumentException($"{nameof(minimum)} ({minimum}) must be less than {nameof(maximum)} ({maximum})");
|
||||||
|
|
||||||
|
if (initial < minimum || initial > maximum)
|
||||||
|
throw new ArgumentException($"{nameof(initial)} ({initial}) must be between {nameof(minimum)} ({minimum}) and {nameof(maximum)} ({maximum})");
|
||||||
|
|
||||||
minZoom = minimum;
|
minZoom = minimum;
|
||||||
maxZoom = maximum;
|
maxZoom = maximum;
|
||||||
CurrentZoom = zoomTarget = initial;
|
CurrentZoom = zoomTarget = initial;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user