Skip to content

Commit

Permalink
Add tileset load failure test.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Sep 27, 2024
1 parent e17c287 commit ba47a22
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Tests/TestCesium3DTileset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,21 @@ public IEnumerator SampleHeightMostDetailedIndicatesNotSampledForPositionOutside
Assert.AreEqual(result.longitudeLatitudeHeightPositions[0].y, -33.87100, 1e-12);
Assert.AreEqual(result.longitudeLatitudeHeightPositions[0].z, 1.0, 1e-12);
}

[UnityTest]
public IEnumerator SampleHeightMostDetailedFailsIfTilesetFailsToLoad()
{
GameObject go = new GameObject();
go.name = "Invalid";
Cesium3DTileset tileset = go.AddComponent<Cesium3DTileset>();
tileset.tilesetSource = CesiumDataSource.FromUrl;
tileset.url = "http://localhost/notgonnawork";

Task<CesiumSampleHeightResult> task = tileset.SampleHeightMostDetailed(new double3(151.20972, -33.87100, 1.0));

yield return new WaitForTask(task);

Assert.NotNull(task.Exception);
Assert.IsTrue(task.Exception.Message.Contains("failed to load"));
}
}

0 comments on commit ba47a22

Please sign in to comment.