浏览代码

Adding tests for new edit mode checks. Changing exception type.

/main
Jon Hogins 5 年前
当前提交
8e109a73
共有 3 个文件被更改,包括 29 次插入1 次删除
  1. 2
      com.unity.perception/Runtime/GroundTruth/SimulationState.cs
  2. 25
      com.unity.perception/Tests/Editor/SimulationManagerEditorTests.cs
  3. 3
      com.unity.perception/Tests/Editor/SimulationManagerEditorTests.cs.meta

2
com.unity.perception/Runtime/GroundTruth/SimulationState.cs


{
if (!Application.isPlaying)
{
throw new NotSupportedException("Dataset generation is only supported in play mode.");
throw new InvalidOperationException("Dataset generation is only supported in play mode.");
}
}

25
com.unity.perception/Tests/Editor/SimulationManagerEditorTests.cs


using System;
using NUnit.Framework;
using UnityEngine.Perception.GroundTruth;
namespace GroundTruth
{
public class SimulationManagerEditorTests
{
[Test]
public void RegisterEgo_InEditMode_Throws()
{
Assert.Throws<InvalidOperationException>(() => SimulationManager.RegisterEgo(""));
}
[Test]
public void RegisterAnnotationDefinition_InEditMode_Throws()
{
Assert.Throws<InvalidOperationException>(() => SimulationManager.RegisterAnnotationDefinition(""));
}
[Test]
public void RegisterMetricDefinition_InEditMode_Throws()
{
Assert.Throws<InvalidOperationException>(() => SimulationManager.RegisterMetricDefinition(""));
}
}
}

3
com.unity.perception/Tests/Editor/SimulationManagerEditorTests.cs.meta


fileFormatVersion: 2
guid: d5f343d2138c4cba865d1094f6b80bff
timeCreated: 1589923850
正在加载...
取消
保存