public override void TestSetup() { base.TestSetup(); Mdc.UpgradeToVersion(MetadataCache.MaximumModelVersion); _eventListener = new ListenerForUnitTests(); FieldWorksTestServices.SetupTempFilesWithName(SharedConstants.DataNotebookFilename, MetadataCache.MaximumModelVersion, out _ourFile, out _commonFile, out _theirFile); }
public void WinnerAndLoserEachAddedNewElement() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <Anthropology> <header> <RnResearchNbk guid='c1ed6db2-e382-11de-8a39-0800200c9a66'> </RnResearchNbk> </header> <RnGenericRec guid='oldie'> </RnGenericRec> </Anthropology>"; var ourContent = commonAncestor.Replace("</Anthropology>", "<RnGenericRec guid='newbieOurs'/></Anthropology>"); var theirContent = commonAncestor.Replace("</Anthropology>", "<RnGenericRec guid='newbieTheirs'/></Anthropology>"); FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"Anthropology/RnGenericRec[@guid=""oldie""]", @"Anthropology/RnGenericRec[@guid=""newbieOurs""]", @"Anthropology/RnGenericRec[@guid=""newbieTheirs""]" }, null, 0, new List <Type>(), 2, new List <Type> { typeof(XmlAdditionChangeReport), typeof(XmlAdditionChangeReport) }); }
public void ShouldNotHaveTwoTextElementsAfterMerge() { var baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase); #if MONO baseDir = baseDir.Replace(@"file:", null); // Path.GetDirectoryName squeezes file:/// to file:/ #else baseDir = baseDir.Replace(@"file:\", null); #endif var testDataDir = Path.Combine(baseDir, "TestData"); var common = File.ReadAllText(Path.Combine(testDataDir, "DataNotebook_Common.ntbk")); var annOurs = File.ReadAllText(Path.Combine(testDataDir, "DataNotebook_Ann.ntbk")); var susannaTheirs = File.ReadAllText(Path.Combine(testDataDir, "DataNotebook_Susanna.ntbk")); // No. FieldWorksCommonFileHandler-Do3WayMerge method needs to do this. // var mdc = MetadataCache.TestOnlyNewCache; // mdc.UpgradeToVersion(7000058); FieldWorksTestServices.DoMerge( FileHandler, _ourFile, annOurs, _commonFile, common, _theirFile, susannaTheirs, new List <string> { @"Anthropology/RnGenericRec/Text" }, null, 0, new List <Type>(), 2, new List <Type> { typeof(XmlBothDeletionChangeReport), typeof(XmlAdditionChangeReport) }); }
public void MergeStTxtParaNoChanges() { string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <Text guid='4836797B-5ADE-4C1C-94F7-8C1104236A94'> <StText guid='4D86FB53-CB4E-44D9-9FBD-AC7E1CBEA766'> <Paragraphs> <ownseq class='StTxtPara' guid='9edbb6e1-2bdd-481c-b84d-26c69f22856c'> <Contents> <Str> <Run ws='en'>This is the first paragraph.</Run> </Str> </Contents> <ParseIsCurrent val='true'/> </ownseq> </Paragraphs> </StText> </Text>".Replace("'", "\""); var results = FieldWorksTestServices.DoMerge( FileHandler, _ourFile, commonAncestor, _commonFile, commonAncestor, _theirFile, commonAncestor, new [] { "Text/StText/Paragraphs/ownseq/ParseIsCurrent[@val='true']" }, null, 0, new List <Type>(), 0, new List <Type>()); }
public void MergeStTxtParaTheyChangedText_SetsParseIsCurrentFalse() { string pattern = @"<?xml version='1.0' encoding='utf-8'?> <Text guid='4836797B-5ADE-4C1C-94F7-8C1104236A94'> <StText guid='4D86FB53-CB4E-44D9-9FBD-AC7E1CBEA766'> <Paragraphs> <ownseq class='StTxtPara' guid='9edbb6e1-2bdd-481c-b84d-26c69f22856c'> <Contents> <Str> <Run ws='en'>This is the first paragraph.{0}</Run> </Str> </Contents> <ParseIsCurrent val='True'/> </ownseq> </Paragraphs> </StText> </Text>".Replace("'", "\""); string commonAncestor = string.Format(pattern, ""); string ours = commonAncestor; string theirs = string.Format(pattern, "x"); FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ours, _commonFile, commonAncestor, _theirFile, theirs, new [] { "Text/StText/Paragraphs/ownseq/ParseIsCurrent[@val='False']" }, null, 0, new List <Type>(), 1, new List <Type>() { typeof(XmlChangedRecordReport) }); }
public void NullAncestorEndsWithTrueIfWeAddedTrueAndTheyAddedFalseHasConflictReport() { // Be sure to test ancestor being null, and ours and theirs not being the same const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <MorphTypes> <CmPossibilityList guid='0a017bfe-10a8-4ce5-ac40-c0d16648a695'> </CmPossibilityList> </MorphTypes>"; const string ourContent = @"<?xml version='1.0' encoding='utf-8'?> <MorphTypes> <CmPossibilityList guid='0a017bfe-10a8-4ce5-ac40-c0d16648a695'> <IsClosed val='True' /> </CmPossibilityList> </MorphTypes>"; const string theirContent = @"<?xml version='1.0' encoding='utf-8'?> <MorphTypes> <CmPossibilityList guid='0a017bfe-10a8-4ce5-ac40-c0d16648a695'> <IsClosed val='False' /> </CmPossibilityList> </MorphTypes>"; FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"MorphTypes/CmPossibilityList/IsClosed[@val='True']" }, null, 1, new List <Type> { typeof(BothAddedAttributeConflict) }, 0, new List <Type>()); }
public void WinnerAddedNewEntryLoserAddedNewSubentry() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <Reversal> <header> <ReversalIndex guid='c1ed46b8-e382-11de-8a39-0800200c9a66'> </ReversalIndex> </header> <ReversalIndexEntry guid='c1ed6dc3-e382-11de-8a39-0800200c9a66'> </ReversalIndexEntry> </Reversal>"; var ourContent = commonAncestor.Replace("</Reversal>", "<ReversalIndexEntry guid='c1ed6dc4-e382-11de-8a39-0800200c9a66'/></Reversal>"); var theirContent = commonAncestor.Replace("</ReversalIndexEntry>", "<Subentries><ReversalIndexEntry guid='c1ed6dc5-e382-11de-8a39-0800200c9a66'/></Subentries></ReversalIndexEntry>"); FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"Reversal/ReversalIndexEntry[@guid=""c1ed6dc3-e382-11de-8a39-0800200c9a66""]", @"Reversal/ReversalIndexEntry[@guid=""c1ed6dc4-e382-11de-8a39-0800200c9a66""]", @"Reversal/ReversalIndexEntry[@guid=""c1ed6dc3-e382-11de-8a39-0800200c9a66""]/Subentries/ReversalIndexEntry[@guid=""c1ed6dc5-e382-11de-8a39-0800200c9a66""]" }, null, 0, new List <Type>(), 2, new List <Type> { typeof(XmlAdditionChangeReport), typeof(XmlAdditionChangeReport) }); }
public void BothEditedCanonicalNumInConflictingWayButBothIgnoredSinceScrDraftIsImmutable() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <ArchivedDrafts> <ScrDraft guid='oldie'> <Books> <ScrBook guid='16525edd-c902-43ad-99fa-decb7b751c5d'> <CanonicalNum val='42' /> </ScrBook> </Books> </ScrDraft> </ArchivedDrafts>"; var ourContent = commonAncestor.Replace("val='42'", "val='43'"); var theirContent = commonAncestor.Replace("val='42'", "val='44'"); var result = FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, null, null, 0, new List <Type>(), 0, new List <Type>()); Assert.IsTrue(result.Contains("val=\"42\"")); }
public void SampleMergeWithConflicts() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <Styles> <StStyle guid='06425922-3258-4094-a9ec-3c2fe5b52b39'> <Name> <Uni>Line3</Uni> </Name> </StStyle> </Styles>"; var ourContent = commonAncestor.Replace("Line3", "Line4"); var theirContent = commonAncestor.Replace("Line3", "Line5"); var results = FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, null, null, 1, new List <Type> { typeof(XmlTextBothEditedTextConflict) }, 0, new List <Type>()); Assert.IsTrue(results.Contains("Line4")); }
public void SampleMergeWithConflicts() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <CheckList> <CmPossibilityList guid='06425922-3258-4094-a9ec-3c2fe5b52b39'> <Name> <AUni ws='en'>Proper names</AUni> </Name> </CmPossibilityList> </CheckList>"; var ourContent = commonAncestor.Replace("Proper names", "My Proper names"); var theirContent = commonAncestor.Replace("Proper names", "Their Proper names"); var results = FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, null, null, 1, new List <Type> { typeof(XmlTextBothEditedTextConflict) }, 0, new List <Type>()); Assert.IsTrue(results.Contains("My Proper names")); }
public void BothEditedEmptyImportResidueHasConflictReport3() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <Lexicon> <header> <LexDb guid='lexdb' /> </header> <LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'/> </Lexicon>"; var ourContent = commonAncestor.Replace("<LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'/>", "<LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'><ImportResidue><Str><Run ws='en'>OurAddition</Run></Str></ImportResidue></LexEntry>"); var theirContent = commonAncestor.Replace("<LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'/>", "<LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'><ImportResidue><Str><Run ws='en'>TheirAddition</Run></Str></ImportResidue></LexEntry>"); FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"Lexicon/LexEntry/ImportResidue/Str/Run[text()='OurAddition']" }, new List <string> { @"Lexicon/LexEntry/ImportResidue/Str/Run[text()='TheirAddition']" }, 1, new List <Type> { typeof(BothEditedTheSameAtomicElement) }, 1, new List <Type> { typeof(XmlBothAddedSameChangeReport) }); }
public void SampleMergeWithConflicts() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <TranslatedScripture> <Scripture guid='06425922-3258-4094-a9ec-3c2fe5b52b39'> <VerseSepr> <Uni>,</Uni> </VerseSepr> </Scripture> </TranslatedScripture>"; var ourContent = commonAncestor.Replace("<Uni>,</Uni>", "<Uni>+</Uni>"); var theirContent = commonAncestor.Replace("<Uni>,</Uni>", "<Uni>-</Uni>"); var results = FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, null, null, 1, new List <Type> { typeof(XmlTextBothEditedTextConflict) }, 0, new List <Type>()); Assert.IsTrue(results.Contains("<Uni>+</Uni>")); }
public void WinnerDeletedButLoserEditedElement() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <AdditionalFields> <CustomField class='WfiWordform' key='WfiWordformCertified' name='Certified' type='Boolean' /> <CustomField class='WfiWordform' key='WfiWordformAttested' name='Attested' type='Binary' /> </AdditionalFields>"; var ourContent = commonAncestor.Replace("<CustomField class='WfiWordform' key='WfiWordformAttested' name='Attested' type='Binary' />", null); var theirContent = commonAncestor.Replace("Binary", "Integer"); FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"AdditionalFields/CustomField[@key=""WfiWordformCertified""]", @"AdditionalFields/CustomField[@key=""WfiWordformAttested""]" }, null, 1, new List <Type> { typeof(RemovedVsEditedElementConflict) }, 0, new List <Type>()); }
public void MergedCmPictureShouldOnlyHaveOneScaleFactorElement() { const string commonAncestor = @"<Pictures> <CmPicture guid='fff03918-9674-4401-8bb1-efe6502985a7' > <ScaleFactor val='1' /> </CmPicture> </Pictures>"; const string ourContent = @"<Pictures> <CmPicture guid='fff03918-9674-4401-8bb1-efe6502985a7' > <ScaleFactor val='1' /> </CmPicture> </Pictures>"; const string theirContent = @"<Pictures> <CmPicture guid='fff03918-9674-4401-8bb1-efe6502985a7' > <ScaleFactor val='1' /> </CmPicture> </Pictures>"; FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"Pictures/CmPicture/ScaleFactor" }, new List <string>(), 0, new List <Type>(), 0, new List <Type>()); }
public void WinnerAndLoserBothDeletedElement() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <AdditionalFields> <CustomField class='WfiWordform' key='WfiWordformCertified' name='Certified' type='Boolean' /> <CustomField class='WfiWordform' key='WfiWordformAttested' name='Attested' type='Boolean' /> </AdditionalFields>"; var ourContent = commonAncestor.Replace("<CustomField class='WfiWordform' key='WfiWordformAttested' name='Attested' type='Boolean' />", null); var theirContent = commonAncestor.Replace("<CustomField class='WfiWordform' key='WfiWordformAttested' name='Attested' type='Boolean' />", null); FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"AdditionalFields/CustomField[@key=""WfiWordformCertified""]" }, new List <string> { @"AdditionalFields/CustomField[@key=""WfiWordformAttested""]" }, 0, new List <Type>(), 1, new List <Type> { typeof(XmlBothDeletionChangeReport) }); }
public void SampleMergeWithNoConflicts() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <ImportSettings> <ScrImportSet guid='0a0be0c1-39c4-44d4-842e-231680c7cd56' > <ImportType val='2' /> <Name> <AUni ws='en'>Default</AUni> </Name> </ScrImportSet> </ImportSettings>"; var ourContent = commonAncestor.Replace("val='2'", "val='3'"); var theirContent = commonAncestor.Replace("Default", "Basic"); var results = FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"ImportSettings/ScrImportSet/ImportType[@val=""3""]" }, null, 0, new List <Type>(), 2, new List <Type> { typeof(XmlAttributeChangedReport), typeof(XmlTextChangedReport) }); Assert.IsTrue(results.Contains("Basic")); }
public void SampleMergeWithConflicts() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <ImportSettings> <ScrImportSet guid='0a0be0c1-39c4-44d4-842e-231680c7cd56' > <ImportType val='2' /> <Name> <AUni ws='en'>Default</AUni> </Name> </ScrImportSet> </ImportSettings>"; var ourContent = commonAncestor.Replace("Default", "Complex"); var theirContent = commonAncestor.Replace("Default", "Basic"); var results = FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, null, null, 1, new List <Type> { typeof(XmlTextBothEditedTextConflict) }, 0, new List <Type>()); Assert.IsTrue(results.Contains("Complex")); }
public void MergedLangProjectShouldOnlyHaveOneLexDbElement() { const string commonAncestor = @"<LanguageProject> <LangProject guid='fff03918-9674-4401-8bb1-efe6502985a7' > <LexDb /> </LangProject> </LanguageProject>"; const string ourContent = @"<LanguageProject> <LangProject guid='fff03918-9674-4401-8bb1-efe6502985a7' > <LexDb /> </LangProject> </LanguageProject>"; const string theirContent = @"<LanguageProject> <LangProject guid='fff03918-9674-4401-8bb1-efe6502985a7' > <LexDb /> </LangProject> </LanguageProject>"; FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"LanguageProject/LangProject/LexDb" }, new List <string>(), 0, new List <Type>(), 0, new List <Type>()); }
private static void DoMerge(IChorusFileTypeHandler fileHandler, int ours) { TempFile ourFile; TempFile commonFile; TempFile theirFile; FieldWorksTestServices.SetupTempFilesWithExtension(".ModelVersion", out ourFile, out commonFile, out theirFile); try { var baseModelVersion = ours - 1; File.WriteAllText(commonFile.Path, FormatModelVersionData(baseModelVersion)); File.WriteAllText(ourFile.Path, FormatModelVersionData(ours)); File.WriteAllText(theirFile.Path, FormatModelVersionData(baseModelVersion)); var listener = new ListenerForUnitTests(); var mergeOrder = new MergeOrder(ourFile.Path, commonFile.Path, theirFile.Path, new NullMergeSituation()) { EventListener = listener }; fileHandler.Do3WayMerge(mergeOrder); } finally { FieldWorksTestServices.RemoveTempFiles(ref ourFile, ref commonFile, ref theirFile); } }
public void ContextForComplexChangeInAStyle() { const string source = @" <StStyle guid='d9aa70f0-ea5e-11de-8efb-0013722f8dec'> <Name> <Uni>Abnormal</Uni> </Name> <Rules> <Prop backcolor='white' fontsize='14000' forecolor='green' spaceAfter='6000' undercolor='red' underline='double'> <WsStyles9999> <WsProp backcolor='red' fontFamily='Verdana' fontsize='12000' fontsizeUnit='mpt' offset='-3000' offsetUnit='mpt' undercolor='yellow' underline='single' ws='en' /> <WsProp backcolor='white' fontFamily='Vladamir' fontsize='18000' fontsizeUnit='mpt' offsetUnit='mpt' undercolor='black' underline='double' ws='ru' /> </WsStyles9999> <WsStyles9999> <WsProp backcolor='blue' fontFamily='OuiOui' fontsize='24000' fontsizeUnit='mpt' offset='5000' offsetUnit='mpt' underline='tripple' ws='fr' /> </WsStyles9999> </Prop> </Rules> </StStyle>" ; var root = FieldWorksTestServices.GetNode(source); var input = root.ChildNodes[1]; // Rules var generator = new StyleContextGenerator(); var descriptor = generator.GenerateContextDescriptor(input, "myfile"); Assert.That(descriptor.DataLabel, Is.EqualTo("Style \"Abnormal\"")); Assert.That(descriptor.PathToUserUnderstandableElement, Contains.Substring("label=" + descriptor.DataLabel)); Assert.That(descriptor.PathToUserUnderstandableElement, Contains.Substring("guid=" + "d9aa70f0-ea5e-11de-8efb-0013722f8dec")); // verify the html context generation Assert.That(generator.HtmlContext(input.ChildNodes[0]), // Prop Is.EqualTo(@"<div class='StStyle'> backcolor (white) fontsize (14000) forecolor (green) spaceAfter (6000) undercolor (red) underline (double)" + @" ws (en [backcolor (red) fontFamily (Verdana) fontsize (12000) fontsizeUnit (mpt) offset (-3000) offsetUnit (mpt) undercolor (yellow) underline (single)])" + @" ws (ru [backcolor (white) fontFamily (Vladamir) fontsize (18000) fontsizeUnit (mpt) offsetUnit (mpt) undercolor (black) underline (double)])" + @" ws (fr [backcolor (blue) fontFamily (OuiOui) fontsize (24000) fontsizeUnit (mpt) offset (5000) offsetUnit (mpt) underline (tripple)])</div>")); }
public void SampleMergeWithEmptyAncestor() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <LayoutInventory> <layout class='CmLocation' type='jtview' name='publishStemLocation#Stem-612' version='19'> <generate class='LexExampleSentence' fieldType='mlstring' restrictions='customOnly' /> </layout> </LayoutInventory>"; var ourContent = commonAncestor.Replace("19", "20"); var theirContent = commonAncestor.Replace("19", "21"); var results = FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, "", _theirFile, theirContent, null, null, 1, new List <Type> { typeof(BothAddedAttributeConflict) }, 4, new List <Type> { typeof(XmlAttributeBothAddedReport), typeof(XmlAttributeBothAddedReport), typeof(XmlAttributeBothAddedReport), typeof(XmlBothAddedSameChangeReport) }); Assert.IsTrue(results.Contains("20")); Assert.IsFalse(results.Contains("combinedkey")); }
public void SampleMergeWithConflicts() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <ReferenceSystem> <ScrRefSystem guid='0a0be0c1-39c4-44d4-842e-231680c7cd56' > <Books> <ScrBookRef guid='51caa4a0-8cd1-4c66-acac-7daead917510'> <BookName> <AUni ws='en'>Genesis</AUni> <AUni ws='es'>GenesisSp</AUni> </BookName> </ScrBookRef> </Books> </ScrRefSystem> </ReferenceSystem>"; var ourContent = commonAncestor.Replace("GenesisSp", "GenesisSpOurs"); var theirContent = commonAncestor.Replace("GenesisSp", "GenesisSpTheirs"); var results = FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, null, null, 1, new List <Type> { typeof(XmlTextBothEditedTextConflict) }, 0, new List <Type>()); Assert.IsTrue(results.Contains("GenesisSpOurs")); }
public void ContextForNamedFieldStyleChange() { const string source = @" <WfiWordform guid='d9aa70f0-ea5e-11de-8efb-0013722f8dec'> <!-- some element that MdCache.GetClassInfo() knows has a guid --> <Name> <Uni>Abnormal</Uni> </Name> <SomeWsRules> <Prop backcolor='green' fontsize='24000' forecolor='yellow' spaceAfter='9000' undercolor='blue' underline='red'> <MoreRules> <WsProp backcolor='beet' fontFamily='NanoPrint' fontsize='0.00002' fontsizeUnit='mi' offset='-0.003' offsetUnit='m' undercolor='yellow' underline='none' ws='aa' /> </MoreRules> <MoreRules> <WsProp backcolor='carrot' fontFamily='ReallyLarge' fontsize='98E-57' fontsizeUnit='au' offset='0.050' offsetUnit='cm' underline='tripple' ws='bb' /> </MoreRules> </Prop> </SomeWsRules> </WfiWordform>" ; var root = FieldWorksTestServices.GetNode(source); var input = root.ChildNodes[2]; // SomeWsRules - the comment is [0] var generator = new StyleContextGenerator(); var descriptor = generator.GenerateContextDescriptor(input, "myfile"); Assert.That(descriptor.DataLabel, Is.EqualTo("WfiWordform \"Abnormal\"")); Assert.That(descriptor.PathToUserUnderstandableElement, Contains.Substring("label=" + descriptor.DataLabel)); Assert.That(descriptor.PathToUserUnderstandableElement, Contains.Substring("guid=" + "d9aa70f0-ea5e-11de-8efb-0013722f8dec")); // verify the html context generation Assert.That(generator.HtmlContext(input.ChildNodes[0]), // Prop Is.EqualTo(@"<div class='StStyle'> backcolor (green) fontsize (24000) forecolor (yellow) spaceAfter (9000) undercolor (blue) underline (red) " + @"ws (aa [backcolor (beet) fontFamily (NanoPrint) fontsize (0.00002) fontsizeUnit (mi) offset (-0.003) offsetUnit (m) undercolor (yellow) underline (none)]) " + @"ws (bb [backcolor (carrot) fontFamily (ReallyLarge) fontsize (98E-57) fontsizeUnit (au) offset (0.050) offsetUnit (cm) underline (tripple)])</div>")); }
public override void TestSetup() { base.TestSetup(); Mdc.UpgradeToVersion(7000038); FieldWorksTestServices.SetupTempFilesWithName(SharedConstants.FLExVirtualOrderingFilename, out _ourFile, out _commonFile, out _theirFile); }
public void MergedSourceShouldOnlyHaveOneSourceElement() { const string commonAncestor = @"<VirtualOrderings> <VirtualOrdering guid='fff03918-9674-4401-8bb1-efe6502985a7' > <Source /> </VirtualOrdering> </VirtualOrderings>"; const string ourContent = @"<VirtualOrderings> <VirtualOrdering guid='fff03918-9674-4401-8bb1-efe6502985a7' > <Source /> </VirtualOrdering> </VirtualOrderings>"; const string theirContent = @"<VirtualOrderings> <VirtualOrdering guid='fff03918-9674-4401-8bb1-efe6502985a7' > <Source /> </VirtualOrdering> </VirtualOrderings>"; FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"VirtualOrderings/VirtualOrdering/Source" }, new List <string>(), 0, new List <Type>(), 0, new List <Type>()); }
public void TestSetup() { // Each starts with a fresh FileHandler, because DictionaryConfigurationHandlerStrategy caches the path to the schema, // but some tests require the schema's presence and others require its absence. _fileHandler = FieldWorksTestServices.CreateChorusFileHandlers(); _configFile = TempFile.WithExtension("." + SharedConstants.fwdictconfig); }
public void WinnerAndLoserBothChangedAttributeInAtomicElementButInDifferentWays() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <AdditionalFields> <CustomField class='WfiWordform' key='WfiWordformCertified' name='Certified' type='Boolean' /> </AdditionalFields>"; var ourContent = commonAncestor.Replace("Boolean", "Integer"); var theirContent = commonAncestor.Replace("Boolean", "Binary"); FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"AdditionalFields/CustomField[@type=""Integer""]" }, new List <string> { @"AdditionalFields/CustomField[@type=""Binary""]" }, 1, new List <Type> { typeof(BothEditedTheSameAtomicElement) }, 0, new List <Type>()); }
public override void TestSetup() { base.TestSetup(); FieldWorksTestServices.SetupTempFilesWithName(SharedConstants.DiscourseChartFilename, out _ourFile, out _commonFile, out _theirFile); Mdc = MetadataCache.TestOnlyNewCache; }
public void BothEditedEmptyCommentHasConflictReport1() { const string commonAncestor = @"<?xml version='1.0' encoding='utf-8'?> <Lexicon> <header> <LexDb guid='lexdb' /> </header> <LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'/> </Lexicon>"; const string ourContent = @"<?xml version='1.0' encoding='utf-8'?> <Lexicon> <header> <LexDb guid='lexdb' /> </header> <LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'> <Comment> <AStr ws='en'> <Run ws='en'>OurAddition</Run> </AStr> </Comment> </LexEntry> </Lexicon>"; const string theirContent = @"<?xml version='1.0' encoding='utf-8'?> <Lexicon> <header> <LexDb guid='lexdb' /> </header> <LexEntry guid='c1ed94c5-e382-11de-8a39-0800200c9a66'> <Comment> <AStr ws='en'> <Run ws='en'>TheirAddition</Run> </AStr> </Comment> </LexEntry> </Lexicon>"; FieldWorksTestServices.DoMerge( FileHandler, _ourFile, ourContent, _commonFile, commonAncestor, _theirFile, theirContent, new List <string> { @"Lexicon/LexEntry/Comment/AStr[@ws='en']/Run[text()='OurAddition']" }, new List <string> { @"Lexicon/LexEntry/Comment/AStr[@ws='en']/Run[text()='TheirAddition']" }, 1, new List <Type> { typeof(BothEditedTheSameAtomicElement) }, 0, new List <Type>()); }
public void ContextForDataNotebookSliceStyleChange() { const string source = @" <RnGenericRec guid='29fb1310-385c-46a5-9e0e-d6cdaee7db17'> <Description> <StText guid='b7c744ed-a59c-4484-aead-f5c3dfd1b604'> <Paragraphs> <ownseq class='StTxtPara' guid='9febc9a9-20ce-4345-8a82-bf168fd9200d'> <StyleRules> <Prop namedStyle='Heading 2' /> </StyleRules> </ownseq> </Paragraphs> </StText> </Description> <Custom name='Like'> <StText guid='f0b19053-f91e-4856-9679-5e801ed66961'> <Paragraphs> <ownseq class='StTxtPara' guid='4125c1ed-567e-47a3-a6fb-e6186f6f176d'> <StyleRules> <Prop namedStyle='Block Quote' /> </StyleRules> </ownseq> </Paragraphs> </StText> </Custom> <Title> <Str> <Run ws='en'>Type</Run> </Str> </Title> </RnGenericRec>" ; var root = FieldWorksTestServices.GetNode(source); var input = root.ChildNodes[1].ChildNodes[0].ChildNodes[0].ChildNodes[0].ChildNodes[0]; // Custom//StyleRules var generator = new StyleContextGenerator(); var descriptor = generator.GenerateContextDescriptor(input, "myfile"); Assert.That(descriptor.DataLabel, Is.EqualTo("Data Notebook Record \"Type\" Custom Field \"Like\"")); Assert.That(descriptor.PathToUserUnderstandableElement, Contains.Substring("label=" + descriptor.DataLabel)); Assert.That(descriptor.PathToUserUnderstandableElement, Contains.Substring("silfw://localhost/link?app=flex&d")); // verify the html context generation Assert.That(generator.HtmlContext(input.ChildNodes[0]), // Prop Is.EqualTo(@"<div class='StStyle'> namedStyle (Block Quote)</div>")); input = root.ChildNodes[0].ChildNodes[0].ChildNodes[0].ChildNodes[0].ChildNodes[0]; // Description//StyleRules generator = new StyleContextGenerator(); descriptor = generator.GenerateContextDescriptor(input, "myfile"); Assert.That(descriptor.DataLabel, Is.EqualTo("Data Notebook Record \"Type\" Description")); Assert.That(descriptor.PathToUserUnderstandableElement, Contains.Substring("label=" + descriptor.DataLabel)); Assert.That(descriptor.PathToUserUnderstandableElement, Contains.Substring("silfw://localhost/link?app=flex&d")); // verify the html context generation Assert.That(generator.HtmlContext(input.ChildNodes[0]), // Prop Is.EqualTo(@"<div class='StStyle'> namedStyle (Heading 2)</div>")); }