Added a test for comparison of all xna and anx enums and fixed some wrong enum basetypes
This commit is contained in:
parent
e74616755c
commit
1aa7d3fe37
@ -63,6 +63,7 @@
|
||||
<Compile Include="ReflectionLearningTests.cs" />
|
||||
<Compile Include="Strukturen\CurveKeyCollectionTest.cs" />
|
||||
<Compile Include="Strukturen\CurveKeyTest.cs" />
|
||||
<Compile Include="Strukturen\EnumValidationTest.cs" />
|
||||
<Compile Include="Strukturen\EventArgsTest.cs" />
|
||||
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
|
||||
|
@ -63,6 +63,7 @@
|
||||
<Compile Include="ReflectionLearningTests.cs" />
|
||||
<Compile Include="Strukturen\CurveKeyCollectionTest.cs" />
|
||||
<Compile Include="Strukturen\CurveKeyTest.cs" />
|
||||
<Compile Include="Strukturen\EnumValidationTest.cs" />
|
||||
<Compile Include="Strukturen\EventArgsTest.cs" />
|
||||
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
|
||||
|
@ -64,6 +64,7 @@
|
||||
<Compile Include="ReflectionLearningTests.cs" />
|
||||
<Compile Include="Strukturen\CurveKeyCollectionTest.cs" />
|
||||
<Compile Include="Strukturen\CurveKeyTest.cs" />
|
||||
<Compile Include="Strukturen\EnumValidationTest.cs" />
|
||||
<Compile Include="Strukturen\EventArgsTest.cs" />
|
||||
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
|
||||
|
@ -65,6 +65,7 @@
|
||||
<Compile Include="ReflectionLearningTests.cs" />
|
||||
<Compile Include="Strukturen\CurveKeyCollectionTest.cs" />
|
||||
<Compile Include="Strukturen\CurveKeyTest.cs" />
|
||||
<Compile Include="Strukturen\EnumValidationTest.cs" />
|
||||
<Compile Include="Strukturen\EventArgsTest.cs" />
|
||||
<Compile Include="Strukturen\GameServiceContainerTest.cs" />
|
||||
<Compile Include="Strukturen\Graphics\PackedVector\Alpha8Test.cs" />
|
||||
|
89
ANX.Framework.TestCenter/Strukturen/EnumValidationTest.cs
Normal file
89
ANX.Framework.TestCenter/Strukturen/EnumValidationTest.cs
Normal file
@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using ANX.Framework.Audio;
|
||||
using ANX.Framework.Graphics;
|
||||
using NUnit.Framework;
|
||||
using ANX.Framework.Input;
|
||||
using ANX.Framework.Media;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
// For details see: http://anxframework.codeplex.com/license
|
||||
|
||||
namespace ANX.Framework.TestCenter.Strukturen
|
||||
{
|
||||
class EnumValidationTest
|
||||
{
|
||||
private static readonly object[] EnumPairs =
|
||||
{
|
||||
new object[] { typeof(Microsoft.Xna.Framework.ContainmentType), typeof(ContainmentType) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.CurveContinuity), typeof(CurveContinuity) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.CurveLoopType), typeof(CurveLoopType) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.CurveTangent), typeof(CurveTangent) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.DisplayOrientation), typeof(DisplayOrientation) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.PlaneIntersectionType), typeof(PlaneIntersectionType) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.PlayerIndex), typeof(PlayerIndex) },
|
||||
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Audio.AudioChannels), typeof(AudioChannels) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Audio.MicrophoneState), typeof(MicrophoneState) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Audio.SoundState), typeof(SoundState) },
|
||||
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.Blend), typeof(Blend) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.BlendFunction), typeof(BlendFunction) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.BufferUsage), typeof(BufferUsage) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.ClearOptions), typeof(ClearOptions) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.ColorWriteChannels), typeof(ColorWriteChannels) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.CompareFunction), typeof(CompareFunction) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.CubeMapFace), typeof(CubeMapFace) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.CullMode), typeof(CullMode) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.DepthFormat), typeof(DepthFormat) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.EffectParameterClass), typeof(EffectParameterClass) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.EffectParameterType), typeof(EffectParameterType) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.FillMode), typeof(FillMode) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.GraphicsDeviceStatus), typeof(GraphicsDeviceStatus) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.GraphicsProfile), typeof(GraphicsProfile) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.IndexElementSize), typeof(IndexElementSize) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.PresentInterval), typeof(PresentInterval) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.PrimitiveType), typeof(PrimitiveType) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.RenderTargetUsage), typeof(RenderTargetUsage) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.SetDataOptions), typeof(SetDataOptions) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.SpriteEffects), typeof(SpriteEffects) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.SpriteSortMode), typeof(SpriteSortMode) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.StencilOperation), typeof(StencilOperation) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.SurfaceFormat), typeof(SurfaceFormat) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.TextureAddressMode), typeof(TextureAddressMode) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.TextureFilter), typeof(TextureFilter) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.VertexElementFormat), typeof(VertexElementFormat) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Graphics.VertexElementUsage), typeof(VertexElementUsage) },
|
||||
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Input.ButtonState), typeof(ButtonState) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Input.Buttons), typeof(Buttons) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Input.GamePadType), typeof(GamePadType) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Input.KeyState), typeof(KeyState) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Input.Keys), typeof(Keys) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Media.MediaSourceType), typeof(MediaSourceType) },
|
||||
new object[] { typeof(Microsoft.Xna.Framework.Media.MediaState), typeof(MediaState) },
|
||||
};
|
||||
|
||||
[TestCaseSource("EnumPairs")]
|
||||
public void CompareEnums(Type first, Type second)
|
||||
{
|
||||
string[] xnaNames = Enum.GetNames(first);
|
||||
string[] anxNames = Enum.GetNames(second);
|
||||
|
||||
for(int index = 0; index < xnaNames.Length; index++)
|
||||
{
|
||||
Assert.AreEqual(xnaNames[index], anxNames[index]);
|
||||
Type xnaUnderlyingType = Enum.GetUnderlyingType(first);
|
||||
Type anxUnderlyingType = Enum.GetUnderlyingType(second);
|
||||
Assert.AreEqual(xnaUnderlyingType, anxUnderlyingType);
|
||||
|
||||
object xnaValue = Enum.Parse(first, xnaNames[index]);
|
||||
object anxValue = Enum.Parse(second, anxNames[index]);
|
||||
if (xnaUnderlyingType == typeof(byte))
|
||||
Assert.AreEqual((byte)xnaValue, (byte)anxValue);
|
||||
else
|
||||
Assert.AreEqual((int)xnaValue, (int)anxValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -490,7 +490,7 @@ namespace ANX.Framework
|
||||
#region IEquatable implementation
|
||||
public override bool Equals(Object obj)
|
||||
{
|
||||
return (obj is BoundingBox) ? this.Equals((BoundingBox)obj) : false;
|
||||
return obj is BoundingBox && Equals((BoundingBox)obj);
|
||||
}
|
||||
public bool Equals(BoundingBox other)
|
||||
{
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System;
|
||||
using ANX.Framework.NonXNA.Development;
|
||||
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
@ -756,19 +755,12 @@ namespace ANX.Framework
|
||||
public override bool Equals(Object obj)
|
||||
{
|
||||
var frustum = obj as BoundingFrustum;
|
||||
if (frustum != null)
|
||||
{
|
||||
return this.Matrix == frustum.Matrix;
|
||||
}
|
||||
return false;
|
||||
return frustum != null && this.Matrix == frustum.Matrix;
|
||||
}
|
||||
|
||||
public bool Equals(BoundingFrustum other)
|
||||
{
|
||||
if (other != null)
|
||||
{
|
||||
return this.Matrix == other.Matrix;
|
||||
}
|
||||
return false;
|
||||
return other != null && this.Matrix == other.Matrix;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -428,7 +428,7 @@ namespace ANX.Framework
|
||||
#region IEquatable implementation
|
||||
public override bool Equals(Object obj)
|
||||
{
|
||||
return (obj is BoundingSphere) ? this.Equals((BoundingSphere)obj) : false;
|
||||
return obj is BoundingSphere && Equals((BoundingSphere)obj);
|
||||
}
|
||||
public bool Equals(BoundingSphere other)
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum Blend
|
||||
{
|
||||
One,
|
||||
|
@ -7,7 +7,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum BlendFunction
|
||||
{
|
||||
Add,
|
||||
|
@ -10,7 +10,7 @@ namespace ANX.Framework.Graphics
|
||||
[Flags]
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum BufferUsage
|
||||
{
|
||||
None,
|
||||
|
@ -10,7 +10,7 @@ namespace ANX.Framework.Graphics
|
||||
[Flags]
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum ClearOptions
|
||||
{
|
||||
DepthBuffer = 2,
|
||||
|
@ -10,7 +10,7 @@ namespace ANX.Framework.Graphics
|
||||
[Flags]
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum ColorWriteChannels
|
||||
{
|
||||
All = 15,
|
||||
|
@ -7,7 +7,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum CompareFunction
|
||||
{
|
||||
Always,
|
||||
|
@ -7,7 +7,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum CubeMapFace
|
||||
{
|
||||
PositiveX,
|
||||
|
@ -7,7 +7,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum CullMode
|
||||
{
|
||||
None,
|
||||
|
@ -7,7 +7,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum DepthFormat
|
||||
{
|
||||
None,
|
||||
|
@ -7,7 +7,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum EffectParameterType
|
||||
{
|
||||
Void,
|
||||
|
@ -7,7 +7,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum FillMode
|
||||
{
|
||||
Solid,
|
||||
|
@ -7,7 +7,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum GraphicsDeviceStatus
|
||||
{
|
||||
Normal,
|
||||
|
@ -7,7 +7,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum GraphicsProfile
|
||||
{
|
||||
Reach,
|
||||
|
@ -7,7 +7,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("Glatzemann")]
|
||||
[TestState(TestStateAttribute.TestState.Untested)]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum IndexElementSize
|
||||
{
|
||||
SixteenBits,
|
||||
|
@ -7,6 +7,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum RenderTargetUsage
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum SetDataOptions
|
||||
{
|
||||
|
@ -9,6 +9,7 @@ namespace ANX.Framework.Graphics
|
||||
{
|
||||
[Flags]
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum SpriteEffects
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum SpriteSortMode
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum StencilOperation
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum SurfaceFormat
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum TextureAddressMode
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum TextureFilter
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum VertexElementFormat
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Graphics
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum VertexElementUsage
|
||||
{
|
||||
|
@ -7,8 +7,9 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Input
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum ButtonState : byte
|
||||
public enum ButtonState
|
||||
{
|
||||
Released,
|
||||
Pressed
|
||||
|
@ -8,6 +8,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Input
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
[Flags]
|
||||
public enum Buttons
|
||||
|
@ -7,8 +7,9 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Input
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum GamePadType : short
|
||||
public enum GamePadType
|
||||
{
|
||||
Unknown,
|
||||
GamePad,
|
||||
|
@ -7,6 +7,7 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Input
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum KeyState
|
||||
{
|
||||
|
@ -7,8 +7,9 @@ using ANX.Framework.NonXNA.Development;
|
||||
namespace ANX.Framework.Input
|
||||
{
|
||||
[PercentageComplete(100)]
|
||||
[Developer("AstrorEnales")]
|
||||
[TestState(TestStateAttribute.TestState.Tested)]
|
||||
public enum Keys : byte
|
||||
public enum Keys
|
||||
{
|
||||
None = 0,
|
||||
Back = 8,
|
||||
|
Loading…
x
Reference in New Issue
Block a user