比较提交

...
此合并请求有变更与目标分支冲突。
/com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetCaptureTests.cs
/com.unity.perception/Tests/Runtime/GroundTruthTests/GroundTruthTestBase.cs
/com.unity.perception/Tests/Runtime/GroundTruthTests/PerceptionCameraIntegrationTests.cs
/com.unity.perception/Tests/Runtime/GroundTruthTests/RenderedObjectInfoTests.cs
/com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationGroundTruthTests.cs
/com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs
/com.unity.perception/Tests/Runtime/GroundTruthTests/VisualizationTests.cs
/com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetCaptureSensorSchedulingTests.cs
/com.unity.perception/Runtime/GroundTruth/DatasetCapture.cs

5 次代码提交

共有 11 个文件被更改,包括 159 次插入4 次删除
  1. 8
      com.unity.perception/Tests/Runtime/Unity.Perception.Runtime.Tests.asmdef
  2. 1
      com.unity.perception/Tests/Runtime/GroundTruthTests/GroundTruthTestBase.cs
  3. 72
      com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetCaptureTests.cs
  4. 10
      com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs
  5. 6
      com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountLabelerTests.cs
  6. 6
      com.unity.perception/Tests/Runtime/GroundTruthTests/PerceptionCameraIntegrationTests.cs
  7. 3
      com.unity.perception/Tests/Runtime/GroundTruthTests/RenderedObjectInfoTests.cs
  8. 15
      com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationGroundTruthTests.cs
  9. 11
      com.unity.perception/Tests/Runtime/GroundTruthTests/VisualizationTests.cs
  10. 30
      com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetCaptureSensorSchedulingTests.cs
  11. 1
      com.unity.perception/Runtime/GroundTruth/DatasetCapture.cs

8
com.unity.perception/Tests/Runtime/Unity.Perception.Runtime.Tests.asmdef


"Unity.Perception.Editor",
"Unity.Simulation.Core",
"Unity.RenderPipelines.HighDefinition.Runtime",
"Unity.RenderPipelines.Universal.Runtime"
"Unity.RenderPipelines.Universal.Runtime",
"com.unity.simulation.tools"
],
"includePlatforms": [],
"excludePlatforms": [],

"name": "com.unity.render-pipelines.high-definition",
"expression": "",
"define": "HDRP_PRESENT"
},
{
"name": "com.unity.simulation.tools",
"expression": "",
"define": "SIMULATION_TOOLS_PRESENT"
}
],
"noEngineReferences": false

1
com.unity.perception/Tests/Runtime/GroundTruthTests/GroundTruthTestBase.cs


[TearDown]
public void TearDown()
{
Debug.Log("Teardown called!");
foreach (var o in m_ObjectsToDestroy)
Object.DestroyImmediate(o);

72
com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetCaptureTests.cs


public class DatasetCaptureTests
{
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void RegisterSensor_ReportsProperJson()
{
var egoDescription = @"the main car driving in simulation";

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void ReportCapture_ReportsProperJson()
{
var filename = "my/file.png";

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator StartNewSequence_ProperlyIncrementsSequence()
{
var timingsExpected = new(int step, int timestamp, bool expectNewSequence)[]

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void ReportAnnotation_AddsProperJsonToCapture()
{
var filename = "my/file.png";

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void ReportAnnotationValues_ReportsProperJson()
{
var values = new[]

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void ReportAnnotationFile_WhenCaptureNotExpected_Throws()
{
var ego = DatasetCapture.RegisterEgo("");

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void ReportAnnotationValues_WhenCaptureNotExpected_Throws()
{
var ego = DatasetCapture.RegisterEgo("");

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void ReportAnnotationAsync_WhenCaptureNotExpected_Throws()
{
var ego = DatasetCapture.RegisterEgo("");

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void ResetSimulation_WithUnreportedAnnotationAsync_LogsError()
{
var ego = DatasetCapture.RegisterEgo("");

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void ResetSimulation_CallsSimulationEnding()
{
int timesCalled = 0;

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void AnnotationAsyncIsValid_ReturnsProperValue()
{
LogAssert.ignoreFailingMessages = true; //we aren't worried about "Simulation ended with pending..."

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void AnnotationAsyncReportFile_ReportsProperJson()
{
var expectedAnnotation = $@" ""annotations"": [

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void AnnotationAsyncReportValues_ReportsProperJson()
{
var values = new[]

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void CreateAnnotation_MultipleTimes_WritesProperTypeOnce()
{
var annotationDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void CreateAnnotation_MultipleTimesWithDifferentParameters_WritesProperTypes()
{
var annotationDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void ReportMetricValues_WhenCaptureNotExpected_Throws()
{
var ego = DatasetCapture.RegisterEgo("");

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void ReportMetricAsync_WhenCaptureNotExpected_Throws()
{
var ego = DatasetCapture.RegisterEgo("");

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void ResetSimulation_WithUnreportedMetricAsync_LogsError()
{
var ego = DatasetCapture.RegisterEgo("");

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void MetricAsyncIsValid_ReturnsProperValue()
{
LogAssert.ignoreFailingMessages = true; //we aren't worried about "Simulation ended with pending..."

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator MetricReportValues_WithNoReportsInFrames_DoesNotIncrementStep()
{
var values = new[] { 1 };

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator SensorHandleReportMetric_BeforeReportCapture_ReportsProperJson()
{
var values = new[] { 1 };

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void MetricAsyncReportValues_ReportsProperJson(
[Values(MetricTarget.Global, MetricTarget.Capture, MetricTarget.Annotation)] MetricTarget metricTarget,
[Values(true, false)] bool async,

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void CreateMetric_MultipleTimesWithDifferentParameters_WritesProperTypes()
{
var metricDefinitionGuid = new Guid(10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void CreateAnnotationOrMetric_WithSpecValues_WritesProperTypes(
[Values(AdditionalInfoKind.Annotation, AdditionalInfoKind.Metric)] AdditionalInfoKind additionalInfoKind)
{

10
com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetJsonUtilityTests.cs


""NaN"",
""Infinity""
]")]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void Vector3ToJToken_ReturnsArrayFormat(float x, float y, float z, string jsonExpected)
{
var jsonActual = DatasetJsonUtility.ToJToken(new Vector3(x, y, z));

""Infinity"",
""NaN""
]")]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void QuaternionToJToken_ReturnsArrayFormat(float x, float y, float z, float w, string jsonExpected)
{
var jsonActual = DatasetJsonUtility.ToJToken(new Quaternion(x, y, z, w)).ToString();

Assert.AreEqual(TestHelper.NormalizeJson(jsonExpected), TestHelper.NormalizeJson(jsonActual));
}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void Primitive_ReturnsValue(object o, string jsonExpected)
{
var jsonActual = DatasetJsonUtility.ToJToken(o).ToString();

6
com.unity.perception/Tests/Runtime/GroundTruthTests/ObjectCountLabelerTests.cs


class ObjectCountLabelerTests : GroundTruthTestBase
{
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void NullLabelingConfiguration_ProducesInvalidOperationException()
{
// ReSharper disable once ObjectCreationAsStatement

#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator ProducesCorrectValuesWithChangingObjects()
{
var label = "label";

6
com.unity.perception/Tests/Runtime/GroundTruthTests/PerceptionCameraIntegrationTests.cs


{
[UnityTest]
[UnityPlatform(RuntimePlatform.LinuxPlayer, RuntimePlatform.WindowsPlayer)]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator EnableBoundingBoxes_GeneratesCorrectDataset()
{
//set resolution to ensure we don't have rounding in rendering leading to bounding boxes to change height/width

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator Disabled_GeneratesCorrectDataset()
{
SetupCamera(pc =>

3
com.unity.perception/Tests/Runtime/GroundTruthTests/RenderedObjectInfoTests.cs


}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator ProducesCorrectBoundingBoxes([ValueSource(nameof(ProducesCorrectBoundingBoxesTestCases))] ProducesCorrectObjectInfoData producesCorrectObjectInfoData)
{
var label = "label";

15
com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationGroundTruthTests.cs


// A UnityTest behaves like a coroutine in Play Mode. In Edit Mode you can use
// `yield return null;` to skip a frame.
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator SegmentationPassTestsWithEnumeratorPasses(
[Values(false, true)] bool useSkinnedMeshRenderer,
[Values(SegmentationKind.Instance, SegmentationKind.Semantic)] SegmentationKind segmentationKind)

#endif // ! HDRP_PRESENT || URP_PRESENT
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator SemanticSegmentationPass_WithLabeledButNotMatchingObject_ProducesBlack()
{
int timesSegmentationImageReceived = 0;

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator SemanticSegmentationPass_WithEmptyFrame_ProducesBlack([Values(false, true)] bool showVisualizations)
{
int timesSegmentationImageReceived = 0;

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator SemanticSegmentationPass_WithTextureOverride_RendersToOverride([Values(true, false)] bool showVisualizations)
{
var expectedPixelValue = new Color32(0, 0, 255, 255);

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator SegmentationPassProducesCorrectValuesEachFrame(
[Values(SegmentationKind.Instance, SegmentationKind.Semantic)] SegmentationKind segmentationKind)
{

11
com.unity.perception/Tests/Runtime/GroundTruthTests/VisualizationTests.cs


}
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
[UnityTest]
public IEnumerator VisualizedCamera_SetsUpCanvas()
{

Assert.IsNotNull(GameObject.Find(nameof(VisualizedCamera_SetsUpCanvas) + "_segmentation_canvas"));
}
[Test]
public void TwoCamerasVisualizing_CausesWarningAndDisablesVisualization()
{

object2.SetActive(true);
}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator DestroyCamera_RemovesVisualization()
{
var object1 = SetupCameraSemanticSegmentation(nameof(DestroyCamera_RemovesVisualization));

yield return null;
Assert.IsNull(GameObject.Find(nameof(DestroyCamera_RemovesVisualization) + "_segmentation_canvas"));
}
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
[UnityTest]
public IEnumerator DestroyAndRecreateCamera_ProperlyVisualizes()
{

30
com.unity.perception/Tests/Runtime/GroundTruthTests/DatasetCaptureSensorSchedulingTests.cs


using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using NUnit.Framework;

{
// Provides accessors and invocation methods for members of SimulationState that would otherwise be in-accessible
// due to protection level - use only when testing protected logic is critical
class SimulationStateTestHelper
class SimulationStateTestHelper : GroundTruthTestBase
{
SimulationState m_State => DatasetCapture.SimulationState;
Dictionary<SensorHandle, SimulationState.SensorData> m_SensorsReference;

m_TestHelper = new SimulationStateTestHelper();
}
[TearDown]
public void TearDown()
[UnityTearDown]
public IEnumerator TearDown()
yield return new WaitForSeconds(2);
Debug.Log("Simulation Reset and finished all async requests!");
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator SequenceTimeOfNextCapture_ReportsCorrectTime()
{
var ego = DatasetCapture.RegisterEgo("ego");

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator FramesScheduled_WithTimeScale_ResultsInProperDeltaTime()
{
var ego = DatasetCapture.RegisterEgo("ego");

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator ChangingTimeScale_CausesDebugError()
{
var ego = DatasetCapture.RegisterEgo("ego");

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator ChangingTimeScale_DuringStartNewSequence_Succeeds()
{
var ego = DatasetCapture.RegisterEgo("ego");

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator ResetSimulation_ResetsCaptureDeltaTime()
{
var ego = DatasetCapture.RegisterEgo("ego");

}
[UnityTest]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public IEnumerator ShouldCaptureThisFrame_ReturnsTrueOnProperFrames()
{
var ego = DatasetCapture.RegisterEgo("ego");

}
[Test]
#if SIMULATION_TOOLS_PRESENT
[Unity.Simulation.Tools.CloudTest]
#endif
public void Enabled_StartsTrue()
{
var sensor1 = DatasetCapture.RegisterSensor(DatasetCapture.RegisterEgo(""), "cam", "1", 1, 1);

1
com.unity.perception/Runtime/GroundTruth/DatasetCapture.cs


var oldSimulationState = SimulationState;
SimulationState = CreateSimulationData();
oldSimulationState.End();
//Manager.Instance.CompleteAllTrackedRequests();
}
}

正在加载...
取消
保存