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 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 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>")); }
public void ContextForSimpleChangeInAStyle() { const string source = @" <StStyle guid='d9aa70f0-ea5e-11de-8efb-0013722f8dec'> <Name> <Uni>Normal</Uni> </Name> <Rules> <Prop backcolor='white' fontsize='20000' forecolor='993300' spaceAfter='6000' /> </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 \"Normal\"")); 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 (20000) forecolor (993300) spaceAfter (6000)</div>")); }
public void GetMoreCompletePartOfSpeechLabel_ToFromCase() { const string source = @" <LexEntry guid='89942b8e-2b1e-4074-8641-1abca93982f8'> <AlternateForms> <objsur guid='bcbc9cd6-ca73-4fb9-a427-12c5a3c7d1ae' t='o' /> </AlternateForms> <LexemeForm> <MoStemAllomorph guid='4109d3d2-faf4-4f80-b28c-f8e4e0146c11'> <Form> <AUni ws='seh'>conflict</AUni> </Form> </MoStemAllomorph> </LexemeForm> <MorphoSyntaxAnalyses> <MoStemMsa guid='54699bf4-7285-4f91-9f65-59b8dab40031'> <PartOfSpeech> <objsur guid='8e45de56-5105-48dc-b302-05985432e1e7' t='r' /> </PartOfSpeech> </MoStemMsa> <MoDerivAffMsa guid='156875ac-9f6a-4bab-9979-e914d8a062fc'> <FromMsFeatures/> <FromPartOfSpeech> <objsur guid='3ecbfcc8-76d7-43bc-a5ff-3c47fabf355c' t='r' /> </FromPartOfSpeech> <ToMsFeatures/> <ToPartOfSpeech> <objsur guid='00a10735-bd2c-4bc5-9555-ef9f784a8c8c' t='r' /> </ToPartOfSpeech> </MoDerivAffMsa> </MorphoSyntaxAnalyses> <Senses> <ownseq class='LexSense' guid='4bd15611-5a36-422e-baa6-b6edb943c4da'> <MorphoSyntaxAnalysis> <objsur guid='156875ac-9f6a-4bab-9979-e914d8a062fc' t='r' /> </MorphoSyntaxAnalysis> </ownseq> </Senses> </LexEntry>" ; const string posList = @"<?xml version='1.0' encoding='utf-8'?> <PartsOfSpeech> <CmPossibilityList guid='d7f7150c-e8cf-11d3-9764-00c04f186933'> <Abbreviation> <AUni ws='en'>Pos</AUni> </Abbreviation> <ItemClsid val='5049' /> <Name> <AUni ws='en'>Parts Of Speech</AUni> </Name> <Possibilities> <ownseq class='PartOfSpeech' guid='d7f7150d-e8cf-11d3-9764-00c04f186933'> <Abbreviation> <AUni ws='en'>V</AUni> </Abbreviation> <Name> <AUni ws='en'></AUni> </Name> </ownseq> <ownseq class='PartOfSpeech' guid='00a10735-bd2c-4bc5-9555-ef9f784a8c8c'> <Abbreviation> <AUni ws='en'>Adv</AUni> <AUni ws='es'>Adv</AUni> <AUni ws='fr'>Adv</AUni> </Abbreviation> <Name> <AUni ws='en'>Adverb</AUni> <AUni ws='es'>Adverbo</AUni> <AUni ws='fr'>Adverbe</AUni> </Name> </ownseq> <ownseq class='PartOfSpeech' guid='3ecbfcc8-76d7-43bc-a5ff-3c47fabf355c'> <Abbreviation> <AUni ws='en'>N</AUni> </Abbreviation> <Name> <AUni ws='en'>Noun</AUni> </Name> </ownseq> </Possibilities> </CmPossibilityList> </PartsOfSpeech>" ; var root = FieldWorksTestServices.GetNode(source); var morphSynData = FieldWorksTestServices.GetNode(posList); var input = root.ChildNodes[3].ChildNodes[0].ChildNodes[0]; // MorphoSyntaxAnalysis var generator = new MockPosContextGenerator(morphSynData); var descriptor = generator.GenerateContextDescriptor(input, "myfile"); Assert.That(descriptor.DataLabel, Is.EqualTo("Entry \"conflict\" Noun/Adverb:Adverbo:Adverbe")); Assert.That(descriptor.PathToUserUnderstandableElement, Contains.Substring("label=" + descriptor.DataLabel)); Assert.That(descriptor.PathToUserUnderstandableElement, Contains.Substring("guid=" + "4bd15611-5a36-422e-baa6-b6edb943c4da")); // verify the html context generation on the objsur element Assert.That(generator.HtmlContext(input.ChildNodes[0]), Is.EqualTo(@"<div class='PartOfSpeech'>Cat: Noun/Adverb:Adverbo:Adverbe</div>")); }