11using MeshIO . Entities . Geometries ;
22using MeshIO . Entities . Primitives ;
3+ using MeshIO . Formats ;
34using MeshIO . Formats . Fbx ;
45using MeshIO . Tests . Common ;
6+ using MeshIO . Tests . TestModels ;
7+ using System ;
58using System . IO ;
69using Xunit ;
710using Xunit . Abstractions ;
@@ -10,76 +13,37 @@ namespace MeshIO.Tests.Formats.Fbx;
1013
1114public class FbxWriterTests : IOTestsBase
1215{
13- public static readonly TheoryData < FbxVersion > Versions = FbxTestCasesData . Versions ;
14-
15- public FbxWriterTests ( ITestOutputHelper output ) : base ( output ) { }
16-
17- [ Theory ]
18- [ MemberData ( nameof ( Versions ) ) ]
19- public void WriteEmptyAsciiStream ( FbxVersion version )
20- {
21- FbxWriterOptions options = new FbxWriterOptions
22- {
23- IsBinaryFormat = false ,
24- Version = version ,
25- } ;
16+ public static TheoryData < FbxFileModel > TestCases { get ; } = new ( ) ;
2617
27- using ( FbxWriter writer = new FbxWriter ( new MemoryStream ( ) , new Scene ( ) , options ) )
28- {
29- writer . OnNotification += this . onNotification ;
30- writer . Write ( new FbxWriterOptions ( ) { IsBinaryFormat = false } ) ;
31- }
32- }
18+ public static readonly TheoryData < FbxVersion > Versions = FbxTestCasesData . Versions ;
3319
34- [ Theory ]
35- [ MemberData ( nameof ( Versions ) ) ]
36- public void WriteAsciiFbxWithMesh ( FbxVersion version )
20+ static FbxWriterTests ( )
3721 {
38- FbxWriterOptions options = new FbxWriterOptions
39- {
40- IsBinaryFormat = false ,
41- Version = version ,
42- } ;
43-
44- string path = Path . Combine ( FolderPath . OutFilesFbx , $ "box_{ version } _ascii.fbx") ;
45-
46- Scene scene = this . createScene ( ) ;
22+ string folder = Path . Combine ( TestVariables . OutputSamplesFolder , "fbx" ) ;
23+ Directory . CreateDirectory ( folder ) ;
4724
48- this . writeFile ( path , scene , options ) ;
25+ TestCases . Add ( new FbxFileModel ( folder , FbxVersion . v6100 , ContentType . ASCII ) ) ;
26+ TestCases . Add ( new FbxFileModel ( folder , FbxVersion . v6100 , ContentType . Binary ) ) ;
27+ TestCases . Add ( new FbxFileModel ( folder , FbxVersion . v7700 , ContentType . ASCII ) ) ;
28+ TestCases . Add ( new FbxFileModel ( folder , FbxVersion . v7700 , ContentType . Binary ) ) ;
4929 }
5030
51- [ Theory ]
52- [ MemberData ( nameof ( Versions ) ) ]
53- public void WriteEmptyBinaryStream ( FbxVersion version )
31+ public FbxWriterTests ( ITestOutputHelper output ) : base ( output )
5432 {
55- FbxWriterOptions options = new FbxWriterOptions
56- {
57- IsBinaryFormat = true ,
58- Version = version ,
59- } ;
60-
61- using ( FbxWriter writer = new FbxWriter ( new MemoryStream ( ) , new Scene ( ) ) )
62- {
63- writer . OnNotification += this . onNotification ;
64- writer . Write ( new FbxWriterOptions ( ) { IsBinaryFormat = true } ) ;
65- }
6633 }
6734
6835 [ Theory ]
69- [ MemberData ( nameof ( Versions ) ) ]
70- public void WriteBinaryFbxWithMesh ( FbxVersion version )
36+ [ MemberData ( nameof ( TestCases ) ) ]
37+ public void WriteTest ( FbxFileModel test )
7138 {
7239 FbxWriterOptions options = new FbxWriterOptions
7340 {
74- IsBinaryFormat = true ,
75- Version = version ,
41+ ContentType = test . Content ,
42+ Version = test . Version ,
7643 } ;
7744
78- string path = Path . Combine ( FolderPath . OutFilesFbx , $ "box_{ version } _binary.fbx") ;
79-
8045 Scene scene = this . createScene ( ) ;
81-
82- this . writeFile ( path , scene , options ) ;
46+ this . writeFile ( test . Path , scene , options ) ;
8347 }
8448
8549 private Scene createScene ( )
@@ -100,7 +64,7 @@ private void writeFile(string path, Scene scene, FbxWriterOptions options)
10064 using ( FbxWriter writer = new FbxWriter ( path , scene , options ) )
10165 {
10266 writer . OnNotification += this . onNotification ;
103- writer . Write ( options ) ;
67+ writer . Write ( ) ;
10468 }
10569 }
106- }
70+ }
0 commit comments