|
3 | 3 | using System.Collections.Generic;
|
4 | 4 | using UnityEditor.Formats.Fbx.Exporter;
|
5 | 5 | using NUnit.Framework;
|
| 6 | +using UnityEditor.Presets; |
6 | 7 |
|
7 | 8 | namespace FbxExporter.UnitTests
|
8 | 9 | {
|
@@ -490,5 +491,36 @@ private void TestLocations(Dictionary<string,List<string>> data)
|
490 | 491 | }
|
491 | 492 | }
|
492 | 493 |
|
| 494 | + [Test] |
| 495 | + public void TestExportSettingsPresets() |
| 496 | + { |
| 497 | + // make sure that the export settings exist |
| 498 | + ExportSettings.instance.LoadDefaults(); |
| 499 | + |
| 500 | + var exportModelSettings = ExportSettings.instance.ExportModelSettings; |
| 501 | + var convertPrefabSettings = ExportSettings.instance.ConvertToPrefabSettings; |
| 502 | + |
| 503 | + // test ExportModelSettings preset |
| 504 | + exportModelSettings.info.SetExportFormat(ExportSettings.ExportFormat.Binary); |
| 505 | + Assert.That(exportModelSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.Binary)); |
| 506 | + |
| 507 | + var exportModelPreset = new Preset(exportModelSettings); |
| 508 | + exportModelSettings.info.SetExportFormat(ExportSettings.ExportFormat.ASCII); |
| 509 | + Assert.That(exportModelSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.ASCII)); |
| 510 | + |
| 511 | + exportModelPreset.ApplyTo(exportModelSettings); |
| 512 | + Assert.That(exportModelSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.Binary)); |
| 513 | + |
| 514 | + // test ConvertToPrefabSettings preset |
| 515 | + convertPrefabSettings.info.SetExportFormat(ExportSettings.ExportFormat.Binary); |
| 516 | + Assert.That(convertPrefabSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.Binary)); |
| 517 | + |
| 518 | + var convertPrefabPreset = new Preset(convertPrefabSettings); |
| 519 | + convertPrefabSettings.info.SetExportFormat(ExportSettings.ExportFormat.ASCII); |
| 520 | + Assert.That(convertPrefabSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.ASCII)); |
| 521 | + |
| 522 | + convertPrefabPreset.ApplyTo(convertPrefabSettings); |
| 523 | + Assert.That(convertPrefabSettings.info.ExportFormat, Is.EqualTo(ExportSettings.ExportFormat.Binary)); |
| 524 | + } |
493 | 525 | }
|
494 | 526 | }
|
0 commit comments