def test_correct_material(self): """Test validation function on correct material.""" export_data = { 'material': 'Material', 'type': 'MATERIAL', } expected_result = (True, 'All materials have backface culling enabled!') double_sided.run_validation(export_data) test_result = double_sided.get_validation_result() self.assertTrue(test_result == expected_result)
def test_incorrect_material(self): """Test validation function on incorrect material.""" export_data = { 'material': 'Material.001', 'type': 'MATERIAL', } expected_result = ( False, 'Materials with backface culling disabled: Material.001', ) double_sided.run_validation(export_data) test_result = double_sided.get_validation_result() self.assertTrue(test_result == expected_result)
def test_incorrect_model(self): """Test validation function on incorrect model.""" export_data = { 'models': ['Thing', 'Sphere'], 'type': 'MODEL', } expected_result = ( False, 'Materials with backface culling disabled: Material.001, Material.002', ) double_sided.run_validation(export_data) test_result = double_sided.get_validation_result() self.assertTrue(test_result == expected_result)
def test_scene_and_fix(self): """Test validation function on incorrect scene and fix.""" export_data = { 'scene': 'Scene', 'type': 'SCENE', } expected_result = ( False, 'Materials with backface culling disabled: Material.002, Material.001', ) double_sided.run_validation(export_data) test_result = double_sided.get_validation_result() self.assertTrue(test_result == expected_result) # Run fix expected_result = (True, 'All materials have backface culling enabled!') double_sided.run_fix(export_data) double_sided.run_validation(export_data) test_result = double_sided.get_validation_result() self.assertTrue(test_result == expected_result)