[tests] Fix a few GLKit tests to not be unnecessarily culture sensitive.

This commit is contained in:
Rolf Bjarne Kvinge 2022-06-28 22:19:17 +02:00
Родитель 9b991f2c0b
Коммит 99672cd028
3 изменённых файлов: 18 добавлений и 32 удалений

Просмотреть файл

@ -124,6 +124,14 @@ public static class Asserts
Assert.AreEqual (expected.W, actual.W, $"{message} (W) expected: {expected} actual: {actual}");
}
public static void AreEqual (float expectedX, float expectedY, float expectedZ, float expectedW, Vector4 actual, string message)
{
Assert.AreEqual (expectedX, actual.X, $"{message} (X) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
Assert.AreEqual (expectedY, actual.Y, $"{message} (Y) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
Assert.AreEqual (expectedZ, actual.Z, $"{message} (Z) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
Assert.AreEqual (expectedW, actual.W, $"{message} (W) expected: {new Vector4 (expectedX, expectedY, expectedZ, expectedW)} actual: {actual}");
}
public static void AreEqual (Vector4 expected, Vector4 actual, float delta, string message)
{
Assert.AreEqual (expected.X, actual.X, delta, $"{message} (X) expected: {expected} actual: {actual}");

Просмотреть файл

@ -22,18 +22,10 @@ namespace MonoTouchFixtures.GLKit {
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
var fog = new GLKEffectPropertyFog ();
#if NET
Assert.That (fog.Color.ToString (), Is.EqualTo ("<0, 0, 0, 0>"), "Color");
#else
Assert.That (fog.Color.ToString (), Is.EqualTo ("(0, 0, 0, 0)"), "Color");
#endif
Asserts.AreEqual (0, 0, 0, 0, fog.Color, "Color");
fog = new GLKBaseEffect ().Fog;
#if NET
Assert.That (fog.Color.ToString (), Is.EqualTo ("<0, 0, 0, 0>"), "Color");
#else
Assert.That (fog.Color.ToString (), Is.EqualTo ("(0, 0, 0, 0)"), "Color");
#endif
Asserts.AreEqual (0, 0, 0, 0, fog.Color, "Color 2");
}
}
}

Просмотреть файл

@ -22,30 +22,16 @@ namespace MonoTouchFixtures.GLKit {
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);
var light = new GLKEffectPropertyLight ();
#if NET
Assert.That (light.AmbientColor.ToString (), Is.EqualTo ("<0, 0, 0, 0>"), "AmbientColor");
Assert.That (light.DiffuseColor.ToString (), Is.EqualTo ("<0, 0, 0, 0>"), "DiffuseColor");
Assert.That (light.SpecularColor.ToString (), Is.EqualTo ("<0, 0, 0, 0>"), "SpecularColor");
Assert.That (light.Position.ToString (), Is.EqualTo ("<0, 0, 0, 0>"), "Position");
#else
Assert.That (light.AmbientColor.ToString (), Is.EqualTo ("(0, 0, 0, 0)"), "AmbientColor");
Assert.That (light.DiffuseColor.ToString (), Is.EqualTo ("(0, 0, 0, 0)"), "DiffuseColor");
Assert.That (light.SpecularColor.ToString (), Is.EqualTo ("(0, 0, 0, 0)"), "SpecularColor");
Assert.That (light.Position.ToString (), Is.EqualTo ("(0, 0, 0, 0)"), "Position");
#endif
Asserts.AreEqual (0, 0, 0, 0, light.AmbientColor, "AmbientColor");
Asserts.AreEqual (0, 0, 0, 0, light.DiffuseColor, "DiffuseColor");
Asserts.AreEqual (0, 0, 0, 0, light.SpecularColor, "SpecularColor");
Asserts.AreEqual (0, 0, 0, 0, light.Position, "Position");
light = new GLKBaseEffect ().Light0;
#if NET
Assert.That (light.AmbientColor.ToString (), Is.EqualTo ("<0, 0, 0, 1>"), "AmbientColor");
Assert.That (light.DiffuseColor.ToString (), Is.EqualTo ("<1, 1, 1, 1>"), "DiffuseColor");
Assert.That (light.SpecularColor.ToString (), Is.EqualTo ("<1, 1, 1, 1>"), "SpecularColor");
Assert.That (light.Position.ToString (), Is.EqualTo ("<0, 0, 1, 0>"), "Position");
#else
Assert.That (light.AmbientColor.ToString (), Is.EqualTo ("(0, 0, 0, 1)"), "AmbientColor");
Assert.That (light.DiffuseColor.ToString (), Is.EqualTo ("(1, 1, 1, 1)"), "DiffuseColor");
Assert.That (light.SpecularColor.ToString (), Is.EqualTo ("(1, 1, 1, 1)"), "SpecularColor");
Assert.That (light.Position.ToString (), Is.EqualTo ("(0, 0, 1, 0)"), "Position");
#endif
Asserts.AreEqual (0, 0, 0, 1, light.AmbientColor, "AmbientColor");
Asserts.AreEqual (1, 1, 1, 1, light.DiffuseColor, "DiffuseColor");
Asserts.AreEqual (1, 1, 1, 1, light.SpecularColor, "SpecularColor");
Asserts.AreEqual (0, 0, 1, 0, light.Position, "Position");
}
}
}