A game framework written with osu! in mind.
at master 45 lines 1.2 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4using NUnit.Framework; 5using osu.Framework.Graphics; 6using osu.Framework.Testing; 7 8namespace osu.Framework.Tests.Platform 9{ 10 [TestFixture] 11 public class UserInputManagerTest 12 { 13 [Test] 14 public void IsAliveTest() 15 { 16 using (var client = new TestHeadlessGameHost(@"client", true)) 17 { 18 var testGame = new TestTestGame(); 19 client.Run(testGame); 20 Assert.IsTrue(testGame.IsRootAlive); 21 } 22 } 23 24 private class TestHeadlessGameHost : TestRunHeadlessGameHost 25 { 26 public Drawable CurrentRoot => Root; 27 28 public TestHeadlessGameHost(string hostname, bool bindIPC) 29 : base(hostname, bindIPC) 30 { 31 } 32 } 33 34 private class TestTestGame : TestGame 35 { 36 public bool IsRootAlive; 37 38 protected override void LoadComplete() 39 { 40 IsRootAlive = ((TestHeadlessGameHost)Host).CurrentRoot.IsAlive; 41 Exit(); 42 } 43 } 44 } 45}