Skip to content

Commit

Permalink
Expose created drawables in SkinnableTestScene
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Feb 17, 2020
1 parent a3e0f84 commit 28c8a9f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions osu.Game/Tests/Visual/SkinnableTestScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using osu.Framework.Allocation;
using osu.Framework.Audio;
Expand Down Expand Up @@ -40,18 +41,26 @@ private void load(AudioManager audio, SkinManager skinManager)
oldSkin = new TestLegacySkin(new SkinInfo { Name = "old-skin" }, new NamespacedResourceStore<byte[]>(dllStore, "Resources/old_skin"), audio, true);
}

private readonly List<Drawable> createdDrawables = new List<Drawable>();

public void SetContents(Func<Drawable> creationFunction)
{
createdDrawables.Clear();

Cell(0).Child = createProvider(null, creationFunction);
Cell(1).Child = createProvider(metricsSkin, creationFunction);
Cell(2).Child = createProvider(defaultSkin, creationFunction);
Cell(3).Child = createProvider(specialSkin, creationFunction);
Cell(4).Child = createProvider(oldSkin, creationFunction);
}

protected IEnumerable<Drawable> CreatedDrawables => createdDrawables;

private Drawable createProvider(Skin skin, Func<Drawable> creationFunction)
{
var created = creationFunction();
createdDrawables.Add(created);

var autoSize = created.RelativeSizeAxes == Axes.None;

var mainProvider = new SkinProvidingContainer(skin)
Expand Down

0 comments on commit 28c8a9f

Please sign in to comment.