-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Framework which provides a test runner with resources from the te…
…st project.
- Loading branch information
1 parent
365587b
commit 7e607bb
Showing
7 changed files
with
33 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright (c) karaoke.dev <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using osu.Framework.Allocation; | ||
using osu.Framework.IO.Stores; | ||
using osu.Framework.Testing; | ||
|
||
namespace osu.Framework.Font.Tests.Visual; | ||
|
||
/// <summary> | ||
/// All the test scene with resource should inherit this class. | ||
/// </summary> | ||
public abstract partial class FrameworkTestScene : TestScene | ||
{ | ||
protected override ITestSceneTestRunner CreateRunner() => new FrameworkTestSceneTestRunner(); | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(Game game) | ||
{ | ||
// add store from main project | ||
game.Resources.AddStore(new NamespacedResourceStore<byte[]>(new ShaderResourceStore(), "Resources")); | ||
} | ||
} |
11 changes: 4 additions & 7 deletions
11
osu.Framework.Font.Tests/TestGame.cs → ...ts/Visual/FrameworkTestSceneTestRunner.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
// Copyright (c) karaoke.dev <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Reflection; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.IO.Stores; | ||
using osu.Framework.Testing; | ||
|
||
namespace osu.Framework.Font.Tests; | ||
namespace osu.Framework.Font.Tests.Visual; | ||
|
||
internal partial class TestGame : Game | ||
public partial class FrameworkTestSceneTestRunner : TestSceneTestRunner | ||
{ | ||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
// add store from osu.game.resources | ||
Resources.AddStore(new DllResourceStore(@"osu.Game.Resources.dll")); | ||
|
||
// add store from main project | ||
Resources.AddStore(new NamespacedResourceStore<byte[]>(new ShaderResourceStore(), "Resources")); | ||
|
||
// add store from test project | ||
Resources.AddStore(new NamespacedResourceStore<byte[]>(new DllResourceStore(Assembly.GetExecutingAssembly().Location), "Resources")); | ||
Resources.AddStore(new NamespacedResourceStore<byte[]>(new DllResourceStore(typeof(FrameworkTestScene).Assembly), "Resources")); | ||
|
||
// Add font resource | ||
AddFont(Resources, @"Fonts/osuFont"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters