@@ -724,6 +724,89 @@ public void DB014_KeepWebExtensions()
724
724
}
725
725
}
726
726
727
+ [ Theory ]
728
+ [ InlineData ( "DB100-00010" , "DB/GlossaryDocuments/CellLevelContentControl-built.docx" , "DB/GlossaryDocuments/BaseDocument.docx,0,4" , "DB/GlossaryDocuments/CellLevelContentControl.docx" , "DB/GlossaryDocuments/BaseDocument.docx,4" , null , null , null ) ]
729
+ [ InlineData ( "DB100-00020" , "DB/GlossaryDocuments/InlineContentControl-built.docx" , "DB/GlossaryDocuments/BaseDocument.docx,0,4" , "DB/GlossaryDocuments/InlineContentControl.docx" , "DB/GlossaryDocuments/BaseDocument.docx,4" , null , null , null ) ]
730
+ [ InlineData ( "DB100-00030" , "DB/GlossaryDocuments/MultilineWithBulletPoints-built.docx" , "DB/GlossaryDocuments/BaseDocument.docx,0,4" , "DB/GlossaryDocuments/MultilineWithBulletPoints.docx" , "DB/GlossaryDocuments/BaseDocument.docx,4" , null , null , null ) ]
731
+ [ InlineData ( "DB100-00040" , "DB/GlossaryDocuments/NestedContentControl-built.docx" , "DB/GlossaryDocuments/BaseDocument.docx,0,4" , "DB/GlossaryDocuments/NestedContentControl.docx" , "DB/GlossaryDocuments/BaseDocument.docx,4" , null , null , null ) ]
732
+ [ InlineData ( "DB100-00050" , "DB/GlossaryDocuments/RowLevelContentControl-built.docx" , "DB/GlossaryDocuments/BaseDocument.docx,0,4" , "DB/GlossaryDocuments/RowLevelContentControl.docx" , "DB/GlossaryDocuments/BaseDocument.docx,4" , null , null , null ) ]
733
+ [ InlineData ( "DB100-00060" , "DB/GlossaryDocuments/ContentControlDanishProofingLanguage-built.docx" , "DB/GlossaryDocuments/BaseDocument.docx,0,4" , "DB/GlossaryDocuments/ContentControlDanishProofingLanguage.docx" , "DB/GlossaryDocuments/BaseDocument.docx,4" , null , null , null ) ]
734
+ [ InlineData ( "DB100-00070" , "DB/GlossaryDocuments/ContentControlEnglishProofingLanguage-built.docx" , "DB/GlossaryDocuments/BaseDocument.docx,0,4" , "DB/GlossaryDocuments/ContentControlEnglishProofingLanguage.docx" , "DB/GlossaryDocuments/BaseDocument.docx,4" , null , null , null ) ]
735
+ [ InlineData ( "DB100-00080" , "DB/GlossaryDocuments/ContentControlMixedProofingLanguage-built.docx" , "DB/GlossaryDocuments/BaseDocument.docx,0,4" , "DB/GlossaryDocuments/ContentControlMixedProofingLanguage.docx" , "DB/GlossaryDocuments/BaseDocument.docx,4" , null , null , null ) ]
736
+ [ InlineData ( "DB100-00090" , "DB/GlossaryDocuments/ContentControlWithContent-built.docx" , "DB/GlossaryDocuments/BaseDocument.docx,0,4" , "DB/GlossaryDocuments/ContentControlWithContent.docx" , "DB/GlossaryDocuments/BaseDocument.docx,4" , null , null , null ) ]
737
+ [ InlineData ( "DB100-00100" , "DB/GlossaryDocuments/FooterContent-built.docx" , "DB/GlossaryDocuments/BaseDocument.docx,0,4" , "DB/GlossaryDocuments/FooterContent.docx" , "DB/GlossaryDocuments/BaseDocument.docx,4" , null , null , null ) ]
738
+ [ InlineData ( "DB100-00110" , "DB/GlossaryDocuments/HeaderContent-built.docx" , "DB/GlossaryDocuments/BaseDocument.docx,0,4" , "DB/GlossaryDocuments/HeaderContent.docx" , "DB/GlossaryDocuments/BaseDocument.docx,4" , null , null , null ) ]
739
+ [ InlineData ( "DB100-00200" , null , "DB/GlossaryDocuments/BaseDocument.docx" , "DB/GlossaryDocuments/CellLevelContentControl.docx" , "DB/GlossaryDocuments/NestedContentControl.docx" , null , null , null ) ]
740
+
741
+ public void WithGlossaryDocuments ( string testId , string baseline , string src1 , string src2 , string src3 , string src4 , string src5 , string src6 )
742
+ {
743
+ var rawSources = new string [ ] { src1 , src2 , src3 , src4 , src5 , src6 , } ;
744
+ var sourcesStr = rawSources . Where ( s => s != null ) . ToArray ( ) ;
745
+
746
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
747
+ // Load the source documents
748
+ List < Source > sources = sourcesStr . Select ( s =>
749
+ {
750
+ var spl = s . Split ( ',' ) ;
751
+ if ( spl . Length == 1 )
752
+ {
753
+ var sourceFi = new FileInfo ( Path . Combine ( TestUtil . SourceDir . FullName , s ) ) ;
754
+ var wmlSource = new WmlDocument ( sourceFi . FullName ) ;
755
+ return new Source ( wmlSource ) ;
756
+ }
757
+ else if ( spl . Length == 2 )
758
+ {
759
+ var start = int . Parse ( spl [ 1 ] ) ;
760
+ var sourceFi = new FileInfo ( Path . Combine ( TestUtil . SourceDir . FullName , spl [ 0 ] ) ) ;
761
+ return new Source ( sourceFi . FullName , start , true ) ;
762
+ }
763
+ else
764
+ {
765
+ var start = int . Parse ( spl [ 1 ] ) ;
766
+ var count = int . Parse ( spl [ 2 ] ) ;
767
+ var sourceFi = new FileInfo ( Path . Combine ( TestUtil . SourceDir . FullName , spl [ 0 ] ) ) ;
768
+ return new Source ( sourceFi . FullName , start , count , true ) ;
769
+ }
770
+ } )
771
+ . ToList ( ) ;
772
+
773
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
774
+ // Create the dir for the test
775
+ var rootTempDir = TestUtil . TempDir ;
776
+ var thisTestTempDir = new DirectoryInfo ( Path . Combine ( rootTempDir . FullName , testId ) ) ;
777
+ if ( thisTestTempDir . Exists )
778
+ Assert . True ( false , "Duplicate test id: " + testId ) ;
779
+ else
780
+ thisTestTempDir . Create ( ) ;
781
+ var tempDirFullName = thisTestTempDir . FullName ;
782
+
783
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
784
+ // Copy sources to temp directory, for ease of review
785
+
786
+ foreach ( var item in sources )
787
+ {
788
+ var fi = new FileInfo ( item . WmlDocument . FileName ) ;
789
+ var sourceCopiedToDestFi = new FileInfo ( Path . Combine ( tempDirFullName , fi . Name ) ) ;
790
+ if ( ! sourceCopiedToDestFi . Exists )
791
+ File . Copy ( item . WmlDocument . FileName , sourceCopiedToDestFi . FullName ) ;
792
+ }
793
+
794
+ if ( baseline != null )
795
+ {
796
+ var baselineFi = new FileInfo ( Path . Combine ( TestUtil . SourceDir . FullName , baseline ) ) ;
797
+ var baselineCopiedToDestFileName = new FileInfo ( Path . Combine ( tempDirFullName , baselineFi . Name ) ) ;
798
+ File . Copy ( baselineFi . FullName , baselineCopiedToDestFileName . FullName ) ;
799
+ }
800
+
801
+ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
802
+ // Use DocumentBuilder to build the destination document
803
+
804
+ var outFi = new FileInfo ( Path . Combine ( tempDirFullName , "Output.docx" ) ) ;
805
+ DocumentBuilderSettings settings = new DocumentBuilderSettings ( ) ;
806
+ DocumentBuilder . BuildDocument ( sources , outFi . FullName , settings ) ;
807
+ Validate ( outFi ) ;
808
+ }
809
+
727
810
private void Validate ( FileInfo fi )
728
811
{
729
812
using ( WordprocessingDocument wDoc = WordprocessingDocument . Open ( fi . FullName , true ) )
0 commit comments