浏览代码

replaced new with ScriptableObject.CreateInstance<T>()

/0.5.0-staging-2020.1
Steven Leal 4 年前
当前提交
e755c59a
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 9
      com.unity.perception/Tests/Runtime/GroundTruthTests/LabelEntryMatchCacheTests.cs

9
com.unity.perception/Tests/Runtime/GroundTruthTests/LabelEntryMatchCacheTests.cs


using System.Collections;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.Perception.GroundTruth;
using UnityEngine.TestTools;

[Test]
public void TryGet_ReturnsFalse_ForInvalidInstanceId()
{
var config = new IdLabelConfig();
var config = ScriptableObject.CreateInstance<IdLabelConfig>();
using (var cache = new LabelEntryMatchCache(config))
{
Assert.IsFalse(cache.TryGetLabelEntryFromInstanceId(100, out var labelEntry, out var index));

var label = "label";
var labeledPlane = TestHelper.CreateLabeledPlane(label: label);
AddTestObjectForCleanup(labeledPlane);
var config = new IdLabelConfig();
var config = ScriptableObject.CreateInstance<IdLabelConfig>();
config.Init(new[]
{
new IdLabelEntry()

var label = "label";
var labeledPlane = TestHelper.CreateLabeledPlane(label: label);
AddTestObjectForCleanup(labeledPlane);
var config = new IdLabelConfig();
var config = ScriptableObject.CreateInstance<IdLabelConfig>();
using (var cache = new LabelEntryMatchCache(config))
{
//allow label to be registered

yield return null;
var labeledPlane2 = TestHelper.CreateLabeledPlane(label: label);
AddTestObjectForCleanup(labeledPlane2);
var config = new IdLabelConfig();
var config = ScriptableObject.CreateInstance<IdLabelConfig>();
config.Init(new[]
{
new IdLabelEntry()

正在加载...
取消
保存