def test_init_version(self): # Arrange obj = bpy.data.objects.new('obj', None) # Act plugin.scene_update_post(bpy.context.scene) # Assert self.assertNotEqual(obj.xray.version, 0)
def test_init_root(self): # Arrange obj_mesh = bpy.data.objects.new('mesh', bpy.data.meshes.new('mesh')) obj_arma = bpy.data.objects.new('arma', bpy.data.armatures.new('arma')) obj_lamp = bpy.data.objects.new('lamp', bpy.data.lamps.new('lamp', 'POINT')) # Act plugin.scene_update_post(bpy.context.scene) # Assert self.assertEqual(obj_mesh.xray.root, True) self.assertEqual(obj_arma.xray.root, False) self.assertEqual(obj_lamp.xray.root, False)
def test_import_version_and_shaders(self): # Arrange version = utl.plugin_version_number() # Act bpy.ops.xray_import.object( directory=self.relpath(), files=[{'name': 'test_fmt.object'}], ) plugin.scene_update_post(bpy.context.scene) # Assert mat = bpy.data.materials[-1] self.assertEqual(mat.xray.version, version) self.assertEqual(mat.xray.eshader, 'models\\model') self.assertEqual(mat.xray.cshader, 'default') self.assertEqual(mat.xray.gamemtl, 'default')
def test_init_shaders_dynamic(self): # Arrange version = utl.plugin_version_number() obj = bpy.data.objects.new('', None) obj.xray.flags_custom_type = 'dy' bpy.context.scene.objects.link(obj) bpy.context.scene.objects.active = obj mat = bpy.data.materials.new('') # Act plugin.scene_update_post(bpy.context.scene) # Assert self.assertEqual(mat.xray.version, version) self.assertEqual(mat.xray.eshader, 'models\\model')
def test_init_version_and_shaders(self): # Arrange version = utl.plugin_version_number() obj = bpy.data.objects.new('', None) obj.xray.flags_custom_type = 'st' utils.link_object(obj) utils.set_active_object(obj) mat = bpy.data.materials.new('') # Act plugin.scene_update_post(bpy.context.scene) # Assert self.assertEqual(mat.xray.version, version) self.assertEqual(mat.xray.eshader, 'default')
def test_import_version_and_root(self): # Arrange version = utl.plugin_version_number() # Act bpy.ops.xray_import.object( directory=self.relpath(), files=[{'name': 'test_fmt.object'}], ) plugin.scene_update_post(bpy.context.scene) # Assert self.assertReportsNotContains('WARNING') obj = bpy.data.objects['test_fmt.object'] self.assertEqual(obj.type, 'MESH') self.assertEqual(obj.data.name, 'plobj') self.assertEqual(obj.xray.version, version) self.assertEqual(obj.xray.root, True)