Пример #1
0
        public void HeadWordField_CitationFieldDisabled_UsesLexemeFormSettings()
        {
            using (var environment = new EnvironmentForTest())
            {
                environment.Template.GetField(LexEntry.WellKnownProperties.Citation).Enabled = false;

                environment.MakeEntry();
                environment.DoExport();
                environment.AssertHasAtLeastOneMatchWithArgs(
                    "lift/entry/field[@type='headword']/form[@lang='{0}']/text[text() = '{1}']",
                    environment.HeadwordWritingSystem.Id,
                    "redLexemeForm"
                    );

                //nb: it's not clear what the "correct" behavior is, if the citation
                //form is disabled for this user but a citation form does exist for this ws.

                environment.AssertHasAtLeastOneMatchWithArgs(
                    "lift/entry/field[@type='headword']/form[@lang='{0}']/text[text() = '{1}']",
                    environment.WritingSystemIds[1],
                    "greenCitation"
                    );
                environment.AssertHasAtLeastOneMatchWithArgs(
                    "lift/entry/field[@type='headword']/form[@lang='{0}']/text[text() = '{1}']",
                    environment.WritingSystemIds[2],
                    "blueCitation"
                    );
            }
        }
Пример #2
0
        public void HeadWordField_CitationFieldEnabled_UsesCitationFormSettings()
        {
            using (var environment = new EnvironmentForTest())
            {
                environment.Template.GetField(LexEntry.WellKnownProperties.Citation).Enabled = true;

                environment.MakeEntry();
                environment.DoExport();
                environment.AssertHasAtLeastOneMatchWithArgs(
                    "lift/entry/field[@type='headword']/form[@lang='{0}']/text[text() = '{1}']",
                    environment.Template.GetField(LexEntry.WellKnownProperties.Citation).WritingSystemIds[0],
                    "blueCitation"
                    );
                //should fall through to lexeme form on red
                environment.AssertHasAtLeastOneMatchWithArgs(
                    "lift/entry/field[@type='headword']/form[@lang='{0}']/text[text() = '{1}']",
                    environment.Template.GetField(LexEntry.WellKnownProperties.Citation).WritingSystemIds[1],
                    "redLexemeForm"
                    );

                environment.AssertNoMatchForXPathWithArgs("lift/entry/field[@type='headword']/form[@lang='{0}']", EnvironmentForTest.Green);
            }
        }
Пример #3
0
        public void Export_LexicalUnitHasVoice_VoiceNotListed()
        {
            using (var environment = new EnvironmentForTest())
            {
                LexEntry e1 = environment.Repo.CreateItem();
                e1.LexicalForm[EnvironmentForTest.Red]   = "r";
                e1.LexicalForm[EnvironmentForTest.Voice] = "v";
                e1.LexicalForm[EnvironmentForTest.Blue]  = "b";

                environment.DoExport();
                environment.AssertHasAtLeastOneMatchWithArgs("lift/entry/lexical-unit/form[@lang='{0}']", EnvironmentForTest.Blue);                //sanity check
                environment.AssertNoMatchForXPathWithArgs("lift/entry/lexical-unit/form[@lang='{0}']", EnvironmentForTest.Voice);
            }
        }
Пример #4
0
        public void Export_CitationHasVoice_CitationOmitsVoice()
        {
            using (var environment = new EnvironmentForTest())
            {
                LexEntry e1 = environment.Repo.CreateItem();
                e1.CitationForm[EnvironmentForTest.Red]   = "r";
                e1.CitationForm[EnvironmentForTest.Voice] = "v";
                e1.CitationForm[EnvironmentForTest.Blue]  = "b";

                environment.DoExport();
                environment.PrintResult();
                environment.AssertHasAtLeastOneMatchWithArgs("lift/entry/citation/form[@lang='{0}']", EnvironmentForTest.Blue);                //sanity check
                environment.AssertNoMatchForXPathWithArgs("lift/entry/citation/form[@lang='{0}']", EnvironmentForTest.Voice);
            }
        }
Пример #5
0
        public void Export_ExampleSentenceHasVoice_TraitWithAudioPathIsOutput()
        {
            using (var environment = new EnvironmentForTest())
            {
                environment.Template.Add(new Field(Field.FieldNames.ExampleSentence.ToString(),
                                                   "LexExampleSentence",
                                                   environment.WritingSystemIds));

                LexEntry e1 = environment.Repo.CreateItem();
                e1.LexicalForm[EnvironmentForTest.Red] = "r";
                var sense = new LexSense(e1);
                e1.Senses.Add(sense);
                var example = new LexExampleSentence(sense);
                sense.ExampleSentences.Add(example);
                example.Sentence[EnvironmentForTest.Green] = "a sentence";
                example.Sentence[EnvironmentForTest.Voice] = "pretendFileName";

                environment.DoExport();
                environment.AssertHasAtLeastOneMatchWithArgs("lift/entry/sense/example/form[@lang='{0}']", EnvironmentForTest.Green);
                var path = string.Format("..{0}audio{0}pretendFileName", Path.DirectorySeparatorChar);
                environment.AssertHasAtLeastOneMatch("lift/entry/sense/example/trait[@name='audio' and @value='" + path + "']");
            }
        }