test_indexed_attributes.py 937 Bytes
Newer Older
Dario Seyb's avatar
Dario Seyb committed
1 2 3 4 5 6
import unittest
import meshvis

class IndexedAttributes(unittest.TestCase):
    
    quad_verts = [[0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0]]
7
    quad_faces_tri = [[0, 1, 2], [0, 2, 3]]
Dario Seyb's avatar
Dario Seyb committed
8

9 10 11
    def point_attribute_tri(self):
        attrib = meshvis.PointAttribute(['a', 'b', 'c', 'd'])
        resolved_attrib = meshvis.resolve_attributes(self.quad_faces_tri, [attrib])[0]
Dario Seyb's avatar
Dario Seyb committed
12 13 14
        self.assertEqual(len(resolved_attrib), 6)
        self.assertListEqual(resolved_attrib, ['a', 'b', 'c', 'a', 'c', 'd'])

15 16 17 18 19 20
    def face_attribute_tri(self):
        attrib = meshvis.FaceAttribute(['a', 'b'])
        resolved_attrib = meshvis.resolve_attributes(self.quad_faces_tri, [attrib])[0]
        self.assertEqual(len(resolved_attrib), 2)
        self.assertListEqual(resolved_attrib, ['a', 'b'])

Dario Seyb's avatar
Dario Seyb committed
21 22 23 24

if __name__ == '__main__':
    suite = unittest.TestLoader().loadTestsFromTestCase(IndexedAttributes)
    unittest.TextTestRunner(verbosity=2).run(suite)