Skip to content

Commit

Permalink
Fix test failures on macOS/ARM.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Aug 14, 2024
1 parent a175d90 commit f94ab7b
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions Tests/TestCesiumGeoreference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@ public IEnumerator ChangingOriginAtRuntimeUpdatesGlobeAnchors()

yield return null;

Assert.That(goAnchored.transform.localPosition.x, Is.EqualTo(0.0f));
Assert.That(goAnchored.transform.localPosition.y, Is.EqualTo(0.0f));
Assert.That(goAnchored.transform.localPosition.z, Is.EqualTo(0.0f));
IEqualityComparer<double> epsilon8 = Comparers.Double(1e-8);
Assert.That(goAnchored.transform.localPosition.x, Is.EqualTo(0.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localPosition.y, Is.EqualTo(0.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localPosition.z, Is.EqualTo(0.0f).Using(epsilon8));

georeference.SetOriginLongitudeLatitudeHeight(-55.1, 54.9, 1001.0);

Assert.That(goAnchored.transform.localPosition.x, Is.Not.EqualTo(0.0f));
Assert.That(goAnchored.transform.localPosition.y, Is.Not.EqualTo(0.0f));
Assert.That(goAnchored.transform.localPosition.z, Is.Not.EqualTo(0.0f));
Assert.That(goAnchored.transform.localPosition.x, Is.Not.EqualTo(0.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localPosition.y, Is.Not.EqualTo(0.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localPosition.z, Is.Not.EqualTo(0.0f).Using(epsilon8));

yield return null;

Assert.That(goAnchored.transform.localPosition.x, Is.Not.EqualTo(0.0f));
Assert.That(goAnchored.transform.localPosition.y, Is.Not.EqualTo(0.0f));
Assert.That(goAnchored.transform.localPosition.z, Is.Not.EqualTo(0.0f));
Assert.That(goAnchored.transform.localPosition.x, Is.Not.EqualTo(0.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localPosition.y, Is.Not.EqualTo(0.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localPosition.z, Is.Not.EqualTo(0.0f).Using(epsilon8));
}

[UnityTest]
Expand All @@ -56,9 +57,10 @@ public IEnumerator ChangingParentTransformAndGeoreferenceMaintainsCorrectGlobePo

yield return null;

Assert.That(goAnchored.transform.localPosition.x, Is.EqualTo(0.0f));
Assert.That(goAnchored.transform.localPosition.y, Is.EqualTo(0.0f));
Assert.That(goAnchored.transform.localPosition.z, Is.EqualTo(0.0f));
IEqualityComparer<double> epsilon8 = Comparers.Double(1e-8);
Assert.That(goAnchored.transform.localPosition.x, Is.EqualTo(0.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localPosition.y, Is.EqualTo(0.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localPosition.z, Is.EqualTo(0.0f).Using(epsilon8));

// Change both the origin and the transform.
georeference.transform.localPosition = new Vector3(100.0f, 200.0f, 300.0f);
Expand All @@ -67,7 +69,6 @@ public IEnumerator ChangingParentTransformAndGeoreferenceMaintainsCorrectGlobePo
yield return null;

// The anchor should maintain its globe position.
IEqualityComparer<double> epsilon8 = Comparers.Double(1e-8);
Assert.That(anchor.longitudeLatitudeHeight.x, Is.EqualTo(-55.0).Using(epsilon8));
Assert.That(anchor.longitudeLatitudeHeight.y, Is.EqualTo(55.0).Using(epsilon8));
Assert.That(anchor.longitudeLatitudeHeight.z, Is.EqualTo(1000.0).Using(epsilon8));
Expand Down Expand Up @@ -97,16 +98,16 @@ public IEnumerator GeoreferenceScaleAffectsGlobeAnchors()

yield return null;

Assert.That(goAnchored.transform.localPosition.x, Is.EqualTo(1.0f));
Assert.That(goAnchored.transform.localPosition.y, Is.EqualTo(2.0f));
Assert.That(goAnchored.transform.localPosition.z, Is.EqualTo(3.0f));
IEqualityComparer<double> epsilon8 = Comparers.Double(1e-8);
Assert.That(goAnchored.transform.localPosition.x, Is.EqualTo(1.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localPosition.y, Is.EqualTo(2.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localPosition.z, Is.EqualTo(3.0f).Using(epsilon8));

Assert.That(goAnchored.transform.localScale.x, Is.EqualTo(4.0f));
Assert.That(goAnchored.transform.localScale.y, Is.EqualTo(5.0f));
Assert.That(goAnchored.transform.localScale.z, Is.EqualTo(6.0f));
Assert.That(goAnchored.transform.localScale.x, Is.EqualTo(4.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localScale.y, Is.EqualTo(5.0f).Using(epsilon8));
Assert.That(goAnchored.transform.localScale.z, Is.EqualTo(6.0f).Using(epsilon8));

// The globe anchor's scale initially matches the local scale.
IEqualityComparer<double> epsilon8 = Comparers.Double(1e-8);
Assert.That(anchor.scaleEastUpNorth.x, Is.EqualTo(4.0).Using(epsilon8));
Assert.That(anchor.scaleEastUpNorth.y, Is.EqualTo(5.0).Using(epsilon8));
Assert.That(anchor.scaleEastUpNorth.z, Is.EqualTo(6.0).Using(epsilon8));
Expand Down

0 comments on commit f94ab7b

Please sign in to comment.