Skip to content

Commit

Permalink
add test for layers in python
Browse files Browse the repository at this point in the history
  • Loading branch information
fraguada committed Jul 9, 2024
1 parent 2a88c83 commit a6484a4
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/python/test_File3dm_LayerTable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import rhino3dm
import unittest

#objective: to test creating file with layers and reasing a file with layers
class TestFile3dmLayerTable(unittest.TestCase):
def test_createFileWithLayers(self):

file3dm = rhino3dm.File3dm()
file3dm.ApplicationName = 'python'
file3dm.ApplicationDetails = 'rhino3dm-tests'
file3dm.ApplicationUrl = 'https://rhino3d.com'

#create layers
layer1 = rhino3dm.Layer()
layer1.Name = 'layer1'
layer1.Color = (255,0,255,255)

layer2 = rhino3dm.Layer()
layer2.Name = 'layer2'

file3dm.Layers.Add(layer1)
file3dm.Layers.Add(layer2)

qtyLayers = len(file3dm.Layers)

file3dm.Write('test_createFileWithLayers.3dm')

file = rhino3dm.File3dm.Read('test_createFile.3dm')
qtyLayers2 = len(file.Layers)

self.assertTrue(qtyLayers == qtyLayers2)

if __name__ == '__main__':
print("running tests")
unittest.main()
print("tests complete")

0 comments on commit a6484a4

Please sign in to comment.