1313using NUnit . Framework ;
1414using SIL . IO ;
1515using SIL . Progress ;
16+ using System . Text . RegularExpressions ;
1617
1718namespace LibFLExBridgeChorusPluginTests . Handling . ConfigLayout
1819{
@@ -109,6 +110,24 @@ public void ShouldNotBeAbleToValidateFile()
109110 Assert . IsNotNull ( FileHandler . ValidateFile ( _ourFile . Path , new NullProgress ( ) ) ) ;
110111 }
111112
113+ [ Test ]
114+ public void ShouldBeAbleToValidateFileWithPartAndIndent ( )
115+ {
116+ const string data =
117+ @"<?xml version=""1.0"" encoding=""utf-8""?>
118+ <LayoutInventory>
119+ <part ref=""HeavySummary"" param=""Summary"" collapsedLayout=""SummaryCollapsed"" expansion=""expanded"" menu=""mnuDataTree-Sense"" hotlinks=""mnuDataTree-Sense-Hotlinks"" notifyVirtual=""LexSenseOutline"">
120+ <indent>
121+ <part ref=""Exemplar"" visibility=""ifdata"" />
122+ <part ref=""ReversalEntries"" visibility=""ifdata"" />
123+ </indent>
124+ </part>
125+ </LayoutInventory>" ;
126+
127+ File . WriteAllText ( _ourFile . Path , data ) ;
128+ Assert . IsNull ( FileHandler . ValidateFile ( _ourFile . Path , new NullProgress ( ) ) ) ;
129+ }
130+
112131 [ Test ]
113132 public void ShouldBeAbleToValidateFile ( )
114133 {
@@ -357,5 +376,45 @@ public void SampleMergeWithEmptyAncestor()
357376 Assert . IsFalse ( results . Contains ( "combinedkey" ) ) ;
358377
359378 }
379+
380+ [ Test ]
381+ public void SampleMergeWithPartAndIndent ( )
382+ {
383+ const string commonAncestor =
384+ @"<?xml version=""1.0"" encoding=""utf-8""?>
385+ <LayoutInventory>
386+ <part ref=""HeavySummary"" param=""Summary"" collapsedLayout=""SummaryCollapsed"" expansion=""expanded"" menu=""mnuDataTree-Sense"" hotlinks=""mnuDataTree-Sense-Hotlinks"" notifyVirtual=""LexSenseOutline"">
387+ <indent>
388+ <part ref=""Exemplar"" visibility=""ifdata"" />
389+ <part ref=""ReversalEntries"" visibility=""ifdata"" />
390+ </indent>
391+ </part>
392+ </LayoutInventory>" ;
393+ const string ourContent =
394+ @"<?xml version=""1.0"" encoding=""utf-8""?>
395+ <LayoutInventory>
396+ <part ref=""HeavySummary"" param=""Summary"" collapsedLayout=""SummaryCollapsed"" expansion=""expanded"" menu=""mnuDataTree-Sense"" hotlinks=""mnuDataTree-Sense-Hotlinks"" notifyVirtual=""LexSenseOutline"">
397+ <indent>
398+ <part ref=""ReversalEntries"" visibility=""ifdata"" />
399+ <part ref=""Exemplar"" visibility=""ifdata"" />
400+ </indent>
401+ </part>
402+ </LayoutInventory>" ;
403+
404+ const string theirContent = commonAncestor ;
405+
406+ var results = FieldWorksTestServices . DoMerge (
407+ FileHandler ,
408+ _ourFile , ourContent ,
409+ _commonFile , commonAncestor ,
410+ _theirFile , theirContent ,
411+ null , null ,
412+ 0 , new List < Type > ( ) ,
413+ 1 , new List < Type > { typeof ( XmlChangedRecordReport ) } ) ;
414+ string normalizedResults = Regex . Replace ( results , @"\s" , "" ) ;
415+ string normalizedOurContent = Regex . Replace ( ourContent , @"\s" , "" ) ;
416+ Assert . AreEqual ( normalizedResults , normalizedOurContent ) ;
417+ }
418+
360419 }
361420}
0 commit comments