Skip to content

Commit

Permalink
Merge pull request #888 from peppy/testing-improvements
Browse files Browse the repository at this point in the history
Testing improvements
  • Loading branch information
smoogipoo authored Jul 11, 2017
2 parents f4f16ff + bc43d20 commit 6f75282
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions osu.Framework.Testing/TestBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class TestBrowser : Screen

private DynamicClassCompiler backgroundCompiler;

private bool interactive;

public TestBrowser()
{
//we want to build the lists here because we're interested in the assembly we were *created* on.
Expand All @@ -45,8 +47,9 @@ public TestBrowser()
}

[BackgroundDependencyLoader]
private void load(Storage storage)
private void load(Storage storage, GameHost host)
{
interactive = host.Window != null;
config = new TestBrowserConfig(storage);

Children = new Drawable[]
Expand Down Expand Up @@ -184,7 +187,7 @@ public void LoadTest(Type testType = null, Action onCompletion = null)
if (testType != null)
{
testContentContainer.Add(CurrentTest = (TestCase)Activator.CreateInstance(testType));
CurrentTest.OnLoadComplete = d => ((TestCase)d).RunAllSteps(onCompletion);
if (!interactive) CurrentTest.OnLoadComplete = d => ((TestCase)d).RunAllSteps(onCompletion);
}

updateButtons();
Expand Down
4 changes: 2 additions & 2 deletions osu.Framework/MathUtils/Interpolation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public static double Damp(double start, double final, double smoothing, double d
{
if (smoothing < 0 || smoothing > 1)
throw new ArgumentOutOfRangeException($"{nameof(smoothing)} has to lie in [0,1], but is {smoothing}.", nameof(smoothing));
if (delta < 0)
if (!Precision.AlmostBigger(delta, 0))
throw new ArgumentOutOfRangeException($"{nameof(delta)} has to be bigger than 0, but is {delta}.", nameof(delta));

return Lerp(start, final, 1 - (float)Math.Pow(smoothing, delta));
return Lerp(start, final, 1 - (float)Math.Pow(smoothing, Math.Max(0, delta)));
}

public static Color4 ValueAt(double time, Color4 startColour, Color4 endColour, double startTime, double endTime, EasingTypes easing = EasingTypes.None)
Expand Down

0 comments on commit 6f75282

Please sign in to comment.