Skip to content

Commit c470075

Browse files
committed
WIP - integration tests
1 parent f506a80 commit c470075

File tree

1 file changed

+45
-3
lines changed

1 file changed

+45
-3
lines changed

Scripts/UnitTests/TestVisualRecognition.cs

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,7 @@ private void OnGetCollections(GetCollections collections, string customData)
582582
Log.Debug("TestVisualRecognition", "Get Collections failed!");
583583
}
584584

585+
m_ListCollectionsTested = true;
585586
Test(collections != null);
586587
}
587588

@@ -599,6 +600,7 @@ private void OnCreateCollection(CreateCollection collection, string customData)
599600
Log.Debug("TestVisualRecognition", "Create Collection failed!");
600601
}
601602

603+
m_CreateCollectionTested = true;
602604
Test(collection != null);
603605
}
604606

@@ -609,6 +611,7 @@ private void OnDeleteCollection(bool success, string customData)
609611
else
610612
Log.Debug("TestVisualRecognition", "Delete Collection failed!");
611613

614+
m_DeleteCollectionTested = true;
612615
Test(success);
613616
}
614617

@@ -625,6 +628,7 @@ private void OnGetCollection(CreateCollection collection, string customData)
625628

626629
}
627630

631+
m_RetrieveCollectionDetailsTested = true;
628632
Test(collection != null);
629633
}
630634

@@ -641,6 +645,7 @@ private void OnGetCollections(GetCollectionImages collections, string customData
641645
Log.Debug("TestVisualRecognition", "Get Collections failed!");
642646
}
643647

648+
m_ListCollectionsTested = true;
644649
Test(collections != null);
645650
}
646651

@@ -658,31 +663,68 @@ private void OnAddImageToCollection(CollectionsConfig images, string customData)
658663
{
659664
Log.Debug("TestVisualRecognition", "Add image to collection failed!");
660665
}
666+
667+
Test(images != null);
661668
}
662669

663670
private void OnDeleteCollectionImage(bool success, string customData)
664671
{
672+
if (success)
673+
Log.Debug("TestVisualRecognition", "Delete collection image succeeded!");
674+
else
675+
Log.Debug("TestVisualRecognition", "Delete collection image failed!");
665676

666-
}
677+
Test(success);
678+
}
667679

668680
private void OnGetImage(GetCollectionsBrief image, string customData)
669681
{
682+
if(image != null)
683+
{
684+
Log.Debug("TestVisualRecognition", "GetImage succeeded!");
685+
Log.Debug("TestVisualRecognition", "imageID: {0} | created: {1} | image_file: {2} | metadata: {3}", image.image_id, image.created, image.image_file, image.metadata);
686+
}
687+
else
688+
{
689+
Log.Debug("TestVisualRecognition", "GetImage failed!");
690+
}
670691

692+
Test(image != null);
671693
}
672694

673695
private void OnDeleteMetadata(bool success, string customData)
674696
{
697+
if (success)
698+
Log.Debug("TestVisualRecognition", "Delete image metadata succeeded!");
699+
else
700+
Log.Debug("TestVisualRecognition", "Delete image metadata failed!");
675701

676-
}
702+
Test(success);
703+
}
677704

678705
private void OnGetMetadata(object responseObject, string customData)
679706
{
680-
Log.Debug("TestVisualRecognition", "ResponseObject: {0}", responseObject);
707+
if(responseObject != null)
708+
Log.Debug("TestVisualRecognition", "ResponseObject: {0}", responseObject);
709+
710+
Test(responseObject != null);
681711
}
682712

683713
private void OnFindSimilar(SimilarImagesConfig images, string customData)
684714
{
715+
if(images != null)
716+
{
717+
Log.Debug("TestVisualRecognition", "GetSimilar succeeded!");
718+
Log.Debug("TestVisualRecognition", "images processed: {0}", images.images_processed);
719+
foreach (SimilarImageConfig image in images.similar_images)
720+
Log.Debug("TestVisualRecognition", "image ID: {0} | image file: {1} | score: {2} | metadata: {3}", image.image_id, image.image_file, image.score, image.metadata.ToString());
721+
}
722+
else
723+
{
724+
Log.Debug("TestVisualRecognition", "GetSimilar failed!");
725+
}
685726

727+
Test(images != null);
686728
}
687729
}
688730
}

0 commit comments

Comments
 (0)