|
|
|
|
|
|
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() |
|
|
|