Skip to content

Commit

Permalink
update dotnet and python annotation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fraguada committed Jul 17, 2024
1 parent ff7f86d commit d43ad7f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
27 changes: 22 additions & 5 deletions tests/dotnet/annotation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,35 @@ public void Annotation_ReadFromFile()
file3dm = File3dm.Read("../models/textEntities_r8.3dm");
}

//Console.WriteLine("Number of objects in file {0}", file3dm.Objects.Count);
Console.WriteLine("Number of objects in file {0}", file3dm.Objects.Count);

string[] textArray = {"Hello World!", "Hello Cruel World!"};
string[] textArray = {"Hello World!", "Hello Cruel World!", "WTF"};

foreach( var obj in file3dm.Objects){
TextEntity textEntity = obj.Geometry as TextEntity;

if(!textArray.Contains(textEntity.PlainText))
switch(obj.Geometry.ObjectType)
{
Assert.Fail("TextEntity Plain Text not found in textArray");
case Rhino.DocObjects.ObjectType.Annotation:
TextEntity textEntity = obj.Geometry as TextEntity;
if(!textArray.Contains(textEntity.PlainText))
{
Assert.Fail("TextEntity Plain Text not found in textArray");
}
break;

case Rhino.DocObjects.ObjectType.TextDot:
TextDot textDot = obj.Geometry as TextDot;
if(!textArray.Contains(textDot.Text))
{
Assert.Fail("TextDot Text not found in textArray");
}
break;

}




}

Assert.Pass();
Expand Down
19 changes: 10 additions & 9 deletions tests/python/test_Annotation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@ def test_readAnnotations(self):

model = rhino3dm.File3dm.Read('../models/textEntities_r8.3dm')
objects = model.Objects
plainText = ["Hello World!", "Hello Cruel World!"]
plainText = ["Hello World!", "Hello Cruel World!", "WTF"]
for obj in objects:
geo = obj.Geometry
#print(geo.ObjectType)
#print(geo.PlainText)
#print(geo.RichText)
#print(geo.PlainTextWithFields)
if not any(x in geo.PlainText for x in plainText):
self.fail("Annotation plain text not or not correct")

self.assertTrue(True)

match obj.Geometry.ObjectType:
case rhino3dm.ObjectType.Annotation:
if not any(x in geo.PlainText for x in plainText):
self.fail("Annotation plain text not or not correct")
case rhino3dm.ObjectType.TextDot:
if not any(x in geo.Text for x in plainText):
self.fail("TextDot text not or not correct")




Expand Down

0 comments on commit d43ad7f

Please sign in to comment.