Skip to content

Commit

Permalink
[monotouch-test] Fix the BaseEffectTest and EffectPropertyMaterialTes…
Browse files Browse the repository at this point in the history
…t tests. (#14243)

The [Culture ("en")] attribute means: only run this test if the culture is
"en". This usually meant not running this test (apparently we don't run often
with culture = "en"), leading to outdated tests that happened to fail when
actually run under culture = "en" (such as on older macOS bots).

So change these tests to actually change the culture to "en" (by using the
SetCulture attribute), and also fix them.
  • Loading branch information
rolfbjarne authored Feb 25, 2022
1 parent 2a1f24f commit 681b45b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
11 changes: 10 additions & 1 deletion tests/monotouch-test/GLKit/BaseEffectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,27 @@ namespace MonoTouchFixtures.GLKit {
public class BaseEffectTest {

[Test]
[Culture ("en")]
[SetCulture ("en")]
public void Properties ()
{
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);

var effect = new GLKBaseEffect ();
#if NET
Assert.That (effect.LightModelAmbientColor.ToString (), Is.EqualTo ("<0.2, 0.2, 0.2, 1>"), "LightModelAmbientColor");
Assert.That (effect.ConstantColor.ToString (), Is.EqualTo ("<1, 1, 1, 1>"), "ConstantColor");
#else
Assert.That (effect.LightModelAmbientColor.ToString (), Is.EqualTo ("(0.2, 0.2, 0.2, 1)"), "LightModelAmbientColor");
Assert.That (effect.ConstantColor.ToString (), Is.EqualTo ("(1, 1, 1, 1)"), "ConstantColor");
#endif

effect.Light0.Enabled = true;
effect.Light0.DiffuseColor = new Vector4 (1.0f, 0.4f, 0.4f, 1.0f);
#if NET
Assert.That (effect.Light0.DiffuseColor.ToString (), Is.EqualTo ("<1, 0.4, 0.4, 1>"), "Light0");
#else
Assert.That (effect.Light0.DiffuseColor.ToString (), Is.EqualTo ("(1, 0.4, 0.4, 1)"), "Light0");
#endif
}
}
}
Expand Down
16 changes: 15 additions & 1 deletion tests/monotouch-test/GLKit/EffectPropertyMaterialTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,36 @@ namespace MonoTouchFixtures.GLKit {
public class EffectPropertytMaterialTest {

[Test]
[Culture ("en")]
[SetCulture ("en")]
public void Properties ()
{
TestRuntime.AssertSystemVersion (ApplePlatform.MacOSX, 10, 8, throwIfOtherPlatform: false);

var material = new GLKEffectPropertyMaterial ();
#if NET
Assert.That (material.AmbientColor.ToString (), Is.EqualTo ("<0.2, 0.2, 0.2, 1>"), "AmbientColor");
Assert.That (material.DiffuseColor.ToString (), Is.EqualTo ("<0.8, 0.8, 0.8, 1>"), "DiffuseColor");
Assert.That (material.SpecularColor.ToString (), Is.EqualTo ("<0, 0, 0, 1>"), "SpecularColor");
Assert.That (material.EmissiveColor.ToString (), Is.EqualTo ("<0, 0, 0, 1>"), "EmissiveColor");
#else
Assert.That (material.AmbientColor.ToString (), Is.EqualTo ("(0.2, 0.2, 0.2, 1)"), "AmbientColor");
Assert.That (material.DiffuseColor.ToString (), Is.EqualTo ("(0.8, 0.8, 0.8, 1)"), "DiffuseColor");
Assert.That (material.SpecularColor.ToString (), Is.EqualTo ("(0, 0, 0, 1)"), "SpecularColor");
Assert.That (material.EmissiveColor.ToString (), Is.EqualTo ("(0, 0, 0, 1)"), "EmissiveColor");
#endif

material = new GLKBaseEffect ().Material;
#if NET
Assert.That (material.AmbientColor.ToString (), Is.EqualTo ("<0.2, 0.2, 0.2, 1>"), "AmbientColor");
Assert.That (material.DiffuseColor.ToString (), Is.EqualTo ("<0.8, 0.8, 0.8, 1>"), "DiffuseColor");
Assert.That (material.SpecularColor.ToString (), Is.EqualTo ("<0, 0, 0, 1>"), "SpecularColor");
Assert.That (material.EmissiveColor.ToString (), Is.EqualTo ("<0, 0, 0, 1>"), "EmissiveColor");
#else
Assert.That (material.AmbientColor.ToString (), Is.EqualTo ("(0.2, 0.2, 0.2, 1)"), "AmbientColor");
Assert.That (material.DiffuseColor.ToString (), Is.EqualTo ("(0.8, 0.8, 0.8, 1)"), "DiffuseColor");
Assert.That (material.SpecularColor.ToString (), Is.EqualTo ("(0, 0, 0, 1)"), "SpecularColor");
Assert.That (material.EmissiveColor.ToString (), Is.EqualTo ("(0, 0, 0, 1)"), "EmissiveColor");
#endif
}
}
}
Expand Down

3 comments on commit 681b45b

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff
View dotnet API diff
View dotnet legacy API diff
View dotnet iOS-MacCatalayst API diff

API Current PR diff

ℹ️ API Diff (from PR only) (please review changes)

View API diff
View dotnet API diff
View dotnet legacy API diff
View dotnet iOS-MacCatalayst API diff

Generator diff

Generator Diff (no change)

Packages generated

View packages

Test results

1 tests failed, 234 tests passed.

Failed tests

  • [NUnit] Mono Mac OS X BCL tests group 2/Mac Full/Debug: Failed (Test run failed.
    Tests run: 11943 Passed: 10499 Inconclusive: 0 Failed: 3 Ignored: 354)

Pipeline on Agent XAMBOT-1036.BigSur'
[monotouch-test] Fix the BaseEffectTest and EffectPropertyMaterialTest tests. (#14243)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Tests passed on macOS Mac Catalina (10.15) ✅

Tests passed

All tests on macOS X Mac Catalina (10.15) passed.

Pipeline on Agent
[monotouch-test] Fix the BaseEffectTest and EffectPropertyMaterialTest tests. (#14243)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Tests failed catastrophically on VSTS: device tests iOS (no summary found). 🔥

Result file D:\a\1\s\Reports\TestSummary-iOS64\TestSummary.md not found.

Pipeline on Agent
[monotouch-test] Fix the BaseEffectTest and EffectPropertyMaterialTest tests. (#14243)

Please sign in to comment.