Skip to content

Commit e0499b5

Browse files
committed
test light shadows and rotation
- testing rotation to make sure that light doesn't get imported with +90 rotation along x (the FBX default light orientation)
1 parent 8693c9d commit e0499b5

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

Assets/FbxExporters/Editor/UnitTests/ModelExporterTest.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ public void TestExportCamera(){
361361
/// <param name="filename">Filename.</param>
362362
/// <param name="cameraObj">Camera object.</param>
363363
private Camera ExportCamera(string filename, GameObject cameraObj){
364-
ExportComponent<Camera> (filename, cameraObj);
364+
return ExportComponent<Camera> (filename, cameraObj);
365365
}
366366

367367
/// <summary>
@@ -405,6 +405,16 @@ public void TestExportLight()
405405
string filename = GetRandomFbxFilePath ();
406406
var fbxLight = ExportComponent<Light> (filename, lightObj);
407407
CompareLightValues (light, fbxLight);
408+
409+
light.type = LightType.Point;
410+
light.color = Color.red;
411+
light.intensity = 0.4f;
412+
light.range = 120;
413+
light.shadows = LightShadows.Hard;
414+
415+
filename = GetRandomFbxFilePath ();
416+
fbxLight = ExportComponent<Light> (filename, lightObj);
417+
CompareLightValues (light, fbxLight);
408418
}
409419

410420
private void CompareLightValues(Light light, Light fbxLight, float delta=0.001f){
@@ -415,7 +425,16 @@ private void CompareLightValues(Light light, Light fbxLight, float delta=0.001f)
415425
Assert.AreEqual (light.color, fbxLight.color);
416426
Assert.AreEqual (light.intensity, fbxLight.intensity, delta);
417427
Assert.AreEqual (light.range, fbxLight.range, delta);
428+
418429
// compare shadows
430+
// make sure that if we exported without shadows, don't import with shadows
431+
if (light.shadows == LightShadows.None) {
432+
Assert.AreEqual (LightShadows.None, fbxLight.shadows);
433+
} else {
434+
Assert.AreNotEqual (LightShadows.None, fbxLight.shadows);
435+
}
436+
437+
Assert.IsTrue (light.transform.rotation == fbxLight.transform.rotation);
419438
}
420439
}
421440
}

0 commit comments

Comments
 (0)