Permalink
Browse files

Adds a testing harness and XNA conformance tests.

On Windows, the Tests solution contains a version of the tests which can
be run against XNA as well as a version that can be run against
MonoGame.  These are standard NUnit test assemblies, and should be run
as normal with NUnit.

For Mac and Linux, the state of NUnit is trickier.  Mono/MonoDevelop
ship with quite an old version, so a custom runner is used.  So, rather
than using NUnit or MonoDevelop's built-in runner, a custom runner is
provided that executes the tests using the version of NUnit in
ThirdParty/Libs.  After the tests have completed, the default browser is
invoked to view the HTML version of the results.

GameTest
- Collects various tests that make assertions about the contract of the
  Game class in XNA vs the current contract in MonoGame.

GameTest+Properties
- Makes assertions about the Game class's properties.
- Tests for default values, read-only or read-write status, availability
  during the lifetime of the Game, etc.

CommandLineInterface
- Wraps the core logic for invoking NUnit into an opaque wrapper that
  can be easily invoked from different platforms.
- Currently writes NUnit results in an abbreviated format to stdout, the
  standard NUnit xml format as test_results.xml, and an xsl-transformed
  test_results.html for easy viewing.

Game
- Added InactiveSleepTime as a to-be-implemented property.

MonoGame.Tests/Resources
- Houses the xsl used by CommandLineInterface, as well as sample data
  and a Makefile for easy development (well, easy on Mac, anyway).
  • Loading branch information...
1 parent d83c072 commit cc28c98b448d83ad8b86b6a31c7a6251d305b65e Christopher Chambers committed Jan 22, 2012
View
@@ -1,5 +1,5 @@
Microsoft Public License (Ms-PL)
-MonoGame - Copyright © 2009-2011 The MonoGame Team
+MonoGame - Copyright © 2009-2012 The MonoGame Team
All rights reserved.
@@ -187,6 +187,12 @@ public GameComponentCollection Components
get { return _components; }
}
+ public TimeSpan InactiveSleepTime
+ {
+ get { throw new NotImplementedException(); }
+ set { throw new NotImplementedException(); }
+ }
+
public bool IsActive
{
get { return _platform.IsActive; }
@@ -1,7 +1,7 @@
-#region License
+#region License
/*
Microsoft Public License (Ms-PL)
-MonoGame - Copyright © 2009-2011 The MonoGame Team
+MonoGame - Copyright © 2009-2012 The MonoGame Team
All rights reserved.
@@ -84,7 +84,7 @@ public LinuxGamePlatform(Game game)
public override GameRunBehavior DefaultRunBehavior
{
- get { return GameRunBehavior.Asynchronous; }
+ get { return GameRunBehavior.Synchronous; }
}
public override void Exit()
@@ -99,13 +99,13 @@ public override void Exit()
public override void RunLoop()
{
- throw new NotImplementedException();
+ ResetWindowBounds(false);
+ Window.Run(1 / Game.TargetElapsedTime.TotalSeconds);
}
public override void StartRunLoop()
{
- ResetWindowBounds(false);
- Window.Run(1 / Game.TargetElapsedTime.TotalSeconds);
+ throw new NotImplementedException("Asynchronous Game loops are not supported on this platform.");
}
public override bool BeforeUpdate(GameTime gameTime)
@@ -221,10 +221,10 @@ public override bool BeforeRun()
public override void Exit()
{
- if (_state != RunState.Running)
+ if (State != RunState.Running)
return;
- _state = RunState.Exiting;
+ State = RunState.Exiting;
if (_mainWindow != null)
{
@@ -480,9 +480,5 @@ public override void WillClose(NSNotification notification)
_owner.State = MacGamePlatform.RunState.Exited);
}
}
-
- #region _mainWindow Event Handlers
-
- #endregion _mainWindow Event Handlers
}
}
@@ -334,11 +334,12 @@
<Compile Include="Desktop\Input\GamePad.cs" />
<Compile Include="Desktop\Input\Mouse.cs" />
<Compile Include="Desktop\Input\MouseState.cs" />
+ <Compile Include="LaunchParameters.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ThirdParty\Lidgren.Network\Lidgren.Network.Linux.csproj">
<Project>{AE483C29-042E-4226-BA52-D247CE7676DA}</Project>
<Name>Lidgren.Network.Linux</Name>
</ProjectReference>
</ItemGroup>
-</Project>
+</Project>
@@ -8,7 +8,7 @@
<ProjectGuid>{36C538E6-C32A-4A8D-A39C-566173D7118E}</ProjectGuid>
<ProjectTypeGuids>{948B3504-5B70-4649-8FE4-BDE1FB46EC69};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
- <RootNamespace>Microsoft.Xna.Framework.GamerServices</RootNamespace>
+ <RootNamespace>Microsoft.Xna.Framework</RootNamespace>
<AssemblyName>MonoGame.Framework.MacOS</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -353,8 +353,8 @@
<Compile Include="MacOS\Audio\OpenALSupport.cs" />
<Compile Include="MacOS\Audio\SoundEffect.cs" />
<Compile Include="MacOS\Audio\SoundEffectInstance.cs" />
- <Compile Include="MacOS\MacGamePlatform+Synchronous.cs" />
<Compile Include="LaunchParameters.cs" />
+ <Compile Include="MacOS\MacGamePlatform+Synchronous.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="MacOS\" />
@@ -380,4 +380,4 @@
<Name>Lidgren.Network.MacOS</Name>
</ProjectReference>
</ItemGroup>
-</Project>
+</Project>
Oops, something went wrong.

0 comments on commit cc28c98

Please sign in to comment.