Skip to content

Commit 6fbb5a1

Browse files
author
Roberto De Ioris
committed
added test for structs
1 parent 6ed5b8e commit 6fbb5a1

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

tests/test_structs.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import unittest
2+
import unreal_engine as ue
3+
from unreal_engine.structs import ColorMaterialInput
4+
5+
6+
class TestStructs(unittest.TestCase):
7+
8+
def test_new_struct(self):
9+
material_input = ColorMaterialInput()
10+
self.assertTrue('MaskR' in material_input.fields())
11+
12+
def test_new_struct_with_kwargs(self):
13+
material_input = ColorMaterialInput(Mask=1, MaskR=1, MaskG=1, MaskB=0, MaskA=1)
14+
self.assertEqual(material_input.Mask, 1)
15+
self.assertEqual(material_input.MaskR, 1)
16+
self.assertEqual(material_input.MaskG, 1)
17+
self.assertEqual(material_input.MaskB, 0)
18+
self.assertEqual(material_input.MaskA, 1)
19+
20+
21+
def test_struct_set(self):
22+
material_input = ColorMaterialInput()
23+
material_input.MaskG = 1
24+
self.assertEqual(material_input.MaskG, 1)
25+
26+
def test_struct_clone(self):
27+
material_input = ColorMaterialInput(Mask=1, MaskR=0, MaskG=1, MaskB=0, MaskA=1)
28+
material_input2 = material_input.clone()
29+
self.assertEqual(material_input2.Mask, 1)
30+
self.assertEqual(material_input2.MaskR, 0)
31+
self.assertEqual(material_input2.MaskG, 1)
32+
self.assertEqual(material_input2.MaskB, 0)
33+
self.assertEqual(material_input2.MaskA, 1)
34+
35+
36+
37+
38+

0 commit comments

Comments
 (0)