示例#1
0
        public void SubscriptForNewFlexTest()
        {
            _projInfo.ProjectInputType = "Dictionary";
            const string file        = "SubscriptForNewFlex";
            string       styleOutput = GetStyleOutput(file);

            //Content Test - First
            _validate              = new ValidateXMLFile(_projInfo.TempOutputFolder);
            _validate.ClassName    = "mainheadwordst_.bzh_span_.bzh_mainheadword_entry_letData_dicBody";
            _validate.GetInnerText = true;
            const string content      = "1";
            bool         returnValue1 = _validate.ValidateOfficeTextNode(content, "span");

            Assert.IsTrue(returnValue1);

            //Note - The Styles will be created while processing xhtml(content.xml)
            //Style Test - Second
            _validate           = new ValidateXMLFile(styleOutput);
            _validate.ClassName = "mainheadwordst_.bzh_span_.bzh_mainheadword_entry_letData_dicBody";
            _validate.ClassProperty.Add("fo:font-weight", "700");
            _validate.ClassProperty.Add("style:font-weight-complex", "700");
            _validate.ClassProperty.Add("fo:font-size", "12pt");
            _validate.ClassProperty.Add("style:font-size-complex", "12pt");
            _validate.ClassProperty.Add("style:text-position", "-12% 58%");
            bool returnValue = _validate.ValidateNodeAttributesNS(false);

            Assert.IsTrue(returnValue);
        }
示例#2
0
        private void InLineMethod()
        {
            _validate = new ValidateXMLFile(_projInfo.TempOutputFolder);
            XmlNode x    = _validate.GetOfficeNode();
            bool    fail = false;

            int    counter = 1;
            string exp;
            string inner;

            foreach (XmlNode item in x.ChildNodes)
            {
                switch (counter)
                {
                case 3:
                    exp   = "locator_dictionary";
                    inner = "parent text div div parent text";
                    fail  = CheckStyleandInnerText(item, exp, inner);
                    break;

                case 4:
                    exp   = "locator_locator_dictionary";
                    inner = "parent text";
                    fail  = CheckStyleandInnerText(item, exp, inner);
                    break;

                case 5:
                    exp   = "locator_dictionary";
                    inner = "parent text";
                    fail  = CheckStyleandInnerText(item, exp, inner);
                    break;

                case 6:
                    exp   = "topara_locator_dictionary";
                    inner = "text";
                    fail  = CheckStyleandInnerText(item, exp, inner);
                    break;

                case 7:
                    exp   = "topara_locator_dictionary";
                    inner = "text";
                    fail  = CheckStyleandInnerText(item, exp, inner);
                    break;

                case 8:
                    exp   = "locator_dictionary";
                    inner = "parent text";
                    fail  = CheckStyleandInnerText(item, exp, inner);
                    break;

                default:
                    break;
                }
                counter++;
                if (fail)
                {
                    Assert.Fail("InlineBlock Test Failed");
                }
            }
        }
示例#3
0
        public void UnitConversionTest_Node()
        {
            const string file = "UnitConversion";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "unit";
            _validate.ClassProperty.Add("fo:margin-left", "9pt");
            _validate.ClassProperty.Add("fo:margin-right", "9pt");
            _validate.ClassProperty.Add("fo:margin-top", "9pt");
            _validate.ClassProperty.Add("fo:margin-bottom", "9pt");

            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);

            _validate.ClassProperty.Add("fo:font-size", "24pt");
            _validate.ClassProperty.Add("fo:font-size-complex", "24pt");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

        }
示例#4
0
        public void BorderTest_Node()
        {

            const string file = "Border";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "border";
            _validate.ClassProperty.Add("fo:border-left", "solid 3pt #ff0000");
            _validate.ClassProperty.Add("fo:border-right", "solid 3pt #ff0000");
            _validate.ClassProperty.Add("fo:border-top", "solid 0pt #ff0000");
            _validate.ClassProperty.Add("fo:border-bottom", "solid 0pt #ff0000");

            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);
        }
示例#5
0
        public void WidowsandOrphans_Node()
        {
            const string file = "WidowsandOrphans";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "orphans";
            _validate.ClassProperty.Add("fo:orphans", "2");
            _validate.ClassProperty.Add("fo:widows", "2");
            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);
        }
示例#6
0
        public void Padding_Node()
        {
            const string file = "Padding";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "entry";
            _validate.ClassProperty.Add("fo:border-left", "0.5pt solid #ffffff");
            _validate.ClassProperty.Add("fo:border-right", "0.5pt solid #ffffff");
            _validate.ClassProperty.Add("fo:border-top", "0.5pt solid #ffffff");
            _validate.ClassProperty.Add("fo:border-bottom", "0.5pt solid #ffffff");

            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);
        }
示例#7
0
        public void Font_Node()
        {
            const string file = "Font";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "a";
            _validate.ClassProperty.Add("fo:font-weight", "700");
            _validate.ClassProperty.Add("fo:font-weight-complex", "700");
            _validate.ClassProperty.Add("fo:font-size", "24pt");
            _validate.ClassProperty.Add("fo:font-size-complex", "24pt");
            _validate.ClassProperty.Add("fo:font-family", "Times New Roman");

            _validate.ClassProperty.Add("fo:font-name-complex", "Times New Roman");
            _validate.ClassProperty.Add("fo:font-style", "italic");
            _validate.ClassProperty.Add("fo:font-variant", "small-caps");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);
        }
示例#8
0
        public void TextFontVariantTestA_Node()
        {
            const string file = "TextFontVariantTestA";
            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "letter";
            _validate.ClassProperty.Add("fo:font-variant", "normal");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "letter1";
            _validate.ClassProperty.Add("fo:font-variant", "small-caps");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);
        }
示例#9
0
        public void TextFontSizeTestB_Node()
        {
            const string file = "TextFontSizeTestB";
            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "letter";
            _validate.ClassProperty.Add("fo:font-size", "12pt");
            _validate.ClassProperty.Add("fo:font-size-complex", "12pt");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "letter1";
            _validate.ClassProperty.Add("fo:font-size", "150%");
            _validate.ClassProperty.Add("fo:font-size-complex", "150%");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "letter2";
            _validate.ClassProperty.Add("fo:font-size", "150%");
            _validate.ClassProperty.Add("fo:font-size-complex", "150%");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);
        }
示例#10
0
        public void DoulosSILFont_Node()
        {
            const string file = "DoulosSILFont";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "DoulosSIL";
            _validate.ClassProperty.Add("fo:font-family", "Doulos SIL");
            _validate.ClassProperty.Add("fo:font-name-complex", "Doulos SIL");
            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);
        }
示例#11
0
        public void HyphenationKeywordsTest_Node()
        {

            const string file = "HyphenationKeywords";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "div.scriptureText";
            _validate.ClassProperty.Add("fo:hyphenation-ladder-count", "1");

            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);

            _validate.ClassProperty.Add("fo:hyphenate", "true");
            _validate.ClassProperty.Add("fo:hyphenation-push-char-count", "2");
            _validate.ClassProperty.Add("fo:hyphenation-remain-char-count", "3");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);
        }
示例#12
0
        public void MirroredPageRefTest_Node()
        {
            const string file = "MirroredPageRef";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            //First Node
            string xpath = "//style:page-layout[@style:name='";
            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "pm1";
            _validate.ClassProperty.Add("style:page-usage", "mirrored");

            returnValue = _validate.ValidateNodeAttributesNS(0, xpath);
            Assert.IsTrue(returnValue);

            xpath = "samenode";
            _validate.ClassProperty.Add("fo:page-width", "14.8cm");
            _validate.ClassProperty.Add("fo:page-height", "21cm");
            _validate.ClassProperty.Add("style:num-format", "1");
            _validate.ClassProperty.Add("style:print-orientation", "portrait");
            _validate.ClassProperty.Add("style:writing-mode", "lr-tb");
            _validate.ClassProperty.Add("style:footnote-max-height", "0in");

            _validate.ClassProperty.Add("fo:margin-top", "1.15cm");
            _validate.ClassProperty.Add("fo:margin-right", "1.5cm");
            _validate.ClassProperty.Add("fo:margin-bottom", "1.5cm");
            _validate.ClassProperty.Add("fo:margin-left", "1.5cm");

            returnValue = _validate.ValidateNodeAttributesNS(1, xpath); // style:page-layout-properties
            Assert.IsTrue(returnValue);

            //Second Node
            xpath = "//style:page-layout[@style:name='";
            _validate.ClassName = "pm2";
            _validate.ClassProperty.Add("style:page-usage", "mirrored");

            returnValue = _validate.ValidateNodeAttributesNS(0, xpath);
            Assert.IsTrue(returnValue);

            xpath = "samenode";
            _validate.ClassProperty.Add("fo:page-width", "14.8cm");
            _validate.ClassProperty.Add("fo:page-height", "21cm");
            _validate.ClassProperty.Add("style:num-format", "1");
            _validate.ClassProperty.Add("style:print-orientation", "portrait");
            _validate.ClassProperty.Add("style:writing-mode", "lr-tb");
            _validate.ClassProperty.Add("style:footnote-max-height", "0in");

            _validate.ClassProperty.Add("fo:margin-top", "1.15cm");
            _validate.ClassProperty.Add("fo:margin-right", "1.5cm");
            _validate.ClassProperty.Add("fo:margin-bottom", "1.5cm");
            _validate.ClassProperty.Add("fo:margin-left", "1.5cm");

            returnValue = _validate.ValidateNodeAttributesNS(1, xpath);
            Assert.IsTrue(returnValue);

            //Third Node
            xpath = "//style:header-left";
            _validate.ClassName = string.Empty;
            string inner = "<text:p text:style-name=\"Header\" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\">" +
            "<text:span text:style-name=\"AllHeaderPageLeft\">" +
            "<text:chapter text:display=\"name\" text:outline-level=\"9\" />" +
            "</text:span>" +
            "<text:tab />" +
            "<text:span text:style-name=\"AllHeaderPageNumber\">" +
            "<text:page-number text:select-page=\"current\">4</text:page-number>" +
            "</text:span>" +
            "<text:tab />" +
            "<text:span text:style-name=\"AllHeaderPageRight\" />" +
            "</text:p>";
            returnValue = _validate.ValidateNodeInnerXml(xpath, inner);
            Assert.IsTrue(returnValue);

            //Fourth Node
            xpath = "//style:master-page[@style:name='";
            _validate.ClassName = "First_20_Page";

            _validate.ClassProperty.Add("style:display-name", "First Page");
            _validate.ClassProperty.Add("style:page-layout-name", "pm2");
            _validate.ClassProperty.Add("style:next-style-name", "Standard");

            returnValue = _validate.ValidateNodeAttributesNS(0, xpath);
            Assert.IsTrue(returnValue);
        }
示例#13
0
        public void CallTOCTest()
        {

            //For Scripture
            SetUp();
            //CopyFile();
            LoadParam("Scripture", "true");
            _projInfo.ProjectInputType = "Scripture";
            const string fileCallTOCScriptureTrue = "CallTOCScripture";

            string styleOutput = GetStyleOutput(fileCallTOCScriptureTrue);
            _validate = new ValidateXMLFile(_projInfo.TempOutputFolder);
            _validate.ClassName = string.Empty;
            string xpath = "//text:table-of-content[@text:style-name='Sect3']/text:table-of-content-source";
            _validate.ClassProperty.Add("text:outline-level", "10");
            bool returnValue = _validate.ValidateNodeAttributesNS(0, xpath);
            Assert.IsTrue(returnValue);

            LoadParam("Scripture", "false");
            _projInfo.ProjectInputType = "Scripture";
            const string fileCallTOCScriptureFalse = "CallTOCScripture";

            styleOutput = GetStyleOutput(fileCallTOCScriptureFalse);

            _validate = new ValidateXMLFile(_projInfo.TempOutputFolder);
            _validate.ClassName = string.Empty;

            xpath = "//text:table-of-content[@text:style-name='Sect3']/text:table-of-content-source";
            _validate.ClassProperty.Add("text:outline-level", "10");
            returnValue = _validate.ValidateNodeAttributesNS(0, xpath);
            Assert.IsFalse(returnValue);

            //For Dictionary
            LoadParam("Dictionary", "true");
            _projInfo.ProjectInputType = "Dictionary";
            const string fileCallTOCDictionaryTrue = "CallTOCDictionary";
            styleOutput = GetStyleOutput(fileCallTOCDictionaryTrue);

            _validate = new ValidateXMLFile(_projInfo.TempOutputFolder);
            _validate.ClassName = string.Empty;

            xpath = "//text:table-of-content[@text:style-name='Sect3']/text:table-of-content-source";
            _validate.ClassProperty.Add("text:outline-level", "10");
            returnValue = _validate.ValidateNodeAttributesNS(0, xpath);
            Assert.IsTrue(returnValue);

            LoadParam("Dictionary", "false");
            _projInfo.ProjectInputType = "Dictionary";
            const string fileCallTOCDictionaryFalse = "CallTOCDictionary";
            styleOutput = GetStyleOutput(fileCallTOCDictionaryFalse);

            _validate = new ValidateXMLFile(_projInfo.TempOutputFolder);
            _validate.ClassName = string.Empty;

            xpath = "//text:table-of-content[@text:style-name='Sect3']/text:table-of-content-source";
            _validate.ClassProperty.Add("text:outline-level", "10");
            returnValue = _validate.ValidateNodeAttributesNS(0, xpath);
            Assert.IsFalse(returnValue);
        }
示例#14
0
        public void ColumnGapLong()
        {
            const string file = "ColumnGapLong";
            _projInfo.ProjectInputType = "Dictionary";
            string styleOutput = GetStyleOutput(file);

            _validate = new ValidateXMLFile(_projInfo.TempOutputFolder);
            _validate.ClassName = string.Empty;

            string xpath = "//style:style[@style:name='Sect_letData']/style:section-properties";
            _validate.ClassProperty.Add("text:dont-balance-text-columns", "false");
            bool returnValue = _validate.ValidateNodeAttributesNS(0, xpath);
            Assert.IsTrue(returnValue);

            xpath = "//style:style[@style:name='Sect_letData']/style:section-properties/style:columns";
            _validate.ClassProperty.Add("fo:column-count", "2");
            returnValue = _validate.ValidateNodeAttributesNS(0, xpath);
            Assert.IsTrue(returnValue);

            _validate.ClassProperty.Add("style:color", "#aa0000");
            _validate.ClassProperty.Add("style:width", "1pt");
            returnValue = _validate.ValidateNodeAttributesNS(1, xpath);
            Assert.IsTrue(returnValue);


            _validate.ClassProperty.Add("style:rel-width", "2.99*");
            _validate.ClassProperty.Add("fo:start-indent", "0in");
            _validate.ClassProperty.Add("fo:end-indent", "0.005in");
            returnValue = _validate.ValidateNodeAttributesNS(2, xpath);
            Assert.IsTrue(returnValue);

            _validate.ClassProperty.Add("style:rel-width", "2.99*");
            _validate.ClassProperty.Add("fo:start-indent", "0.005in");
            _validate.ClassProperty.Add("fo:end-indent", "0in");
            returnValue = _validate.ValidateNodeAttributesNS(3, xpath);
            Assert.IsTrue(returnValue);

            ////////////////////////////////
            xpath = "//style:style[@style:name='Sect_letHead']/style:section-properties";
            _validate.ClassProperty.Add("text:dont-balance-text-columns", "false");
            returnValue = _validate.ValidateNodeAttributesNS(0, xpath);
            Assert.IsTrue(returnValue);

            xpath = "//style:style[@style:name='Sect_letHead']/style:section-properties/style:columns";
            _validate.ClassProperty.Add("fo:column-count", "3");
            returnValue = _validate.ValidateNodeAttributesNS(0, xpath);
            Assert.IsTrue(returnValue);

            _validate.ClassProperty.Add("style:color", "#aa0000");
            _validate.ClassProperty.Add("style:width", "1pt");
            returnValue = _validate.ValidateNodeAttributesNS(1, xpath);
            Assert.IsTrue(returnValue);

            _validate.ClassProperty.Add("style:rel-width", "1.555556*");
            _validate.ClassProperty.Add("fo:start-indent", "0in");
            _validate.ClassProperty.Add("fo:end-indent", "0.2222222in");
            returnValue = _validate.ValidateNodeAttributesNS(2, xpath);
            Assert.IsTrue(returnValue);

            _validate.ClassProperty.Add("style:rel-width", "1.555556*");
            _validate.ClassProperty.Add("fo:start-indent", "0.2222222in");
            _validate.ClassProperty.Add("fo:end-indent", "0.2222222in");
            returnValue = _validate.ValidateNodeAttributesNS(3, xpath);
            Assert.IsTrue(returnValue);

            _validate.ClassProperty.Add("style:rel-width", "1.555556*");
            _validate.ClassProperty.Add("fo:start-indent", "0.2222222in");
            _validate.ClassProperty.Add("fo:end-indent", "0in");
            returnValue = _validate.ValidateNodeAttributesNS(4, xpath);
            Assert.IsTrue(returnValue);

        }
示例#15
0
        public void ClassNameValueTest_Node()
        {

            const string file = "ClassNameValueTest";
            _projInfo.ProjectInputType = "Dictionary";
            string styleOutput = GetStyleOutput(file);

            _validate = new ValidateXMLFile(styleOutput);
            _validate.ClassName = "letter.-current_locator_dictionary";

            _validate.ClassProperty.Add("fo:color", "#ff0000");
            _validate.ClassProperty.Add("fo:background-color", "#aaff00");
            bool returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            //Content Test - First
            _validate = new ValidateXMLFile(_projInfo.TempOutputFolder);
            _validate.ClassName = "letter.-current_locator_dictionary";
            string content = "w";
            bool returnValue1 = _validate.ValidateOfficeTextNode(content, "span");
            Assert.IsTrue(returnValue1);
        }
示例#16
0
        public void CrossReference_Node()
        {
            const string file = "CrossRef";
            _projInfo.ProjectInputType = "Dictionary";
            string styleOutput = GetStyleOutput(file);

            _validate = new ValidateXMLFile(_projInfo.TempOutputFolder);
            _validate.ClassName = string.Empty;
            string xpath = "//text:span[@text:style-name='link_entry_letData_dicBody']";
            string content = "<text:a xlink:type=\"simple\" xlink:href=\"#nema1\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\">nema1 source</text:a>";
            bool returnValue1 = _validate.ValidateNodeInnerXml(xpath, content);
            Assert.IsTrue(returnValue1, "reference-ref failed");

            _validate = new ValidateXMLFile(_projInfo.TempOutputFolder);
            _validate.ClassName = string.Empty;
            xpath = "//text:span[@text:style-name='headword1_.bzh_a_entry_letData_dicBody']";
            content = "<text:bookmark-start text:name=\"nema3\" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\" /><text:bookmark-end text:name=\"nema3\" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\" />nema3 text";
            returnValue1 = _validate.ValidateNodeInnerXml(xpath, content);
            Assert.IsTrue(returnValue1, "reference-ref failed");
        }
示例#17
0
        public void TextAlignTestB_Node()
        {
            const string file = "TextAlignTestB";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "letter";
            _validate.ClassProperty.Add("fo:text-align", "justify");

            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);

        }
示例#18
0
        public void FixedLineHeightTest_Node()
        {
            const string file = "fixed-line-height";
            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "entry";
            _validate.ClassProperty.Add("fo:line-height", "14pt");
            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);

        }
示例#19
0
        public void TextFontSizeTestD_Node()
        {
            const string file = "TextFontSizeTestD";
            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "letter";
            _validate.ClassProperty.Add("fo:font-size", "22pt");
            _validate.ClassProperty.Add("fo:font-size-complex", "22pt");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            //Note: letter1 font-size should not exist, to write it
            //_validate.ClassName = "letter1";
            //_validate.ClassProperty.Add("fo:font-size", "18pt");

            //returnValue = _validate.ValidateNodeAttributesNS(false);
            //Assert.IsTrue(returnValue);

            _validate.ClassName = "letter2";
            _validate.ClassProperty.Add("fo:font-size", "6.6pt");
            _validate.ClassProperty.Add("fo:font-size-complex", "6.6pt");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);
        }
示例#20
0
        public void HeaderSpace_Node()
        {
            const string file = "HeaderSpace";
            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            //First Node
            string xpath = "//style:page-layout[@style:name='pm3']";
            _validate = new ValidateXMLFile(output);
            _validate.ClassName = string.Empty;
            _validate.ClassProperty.Add("fo:padding-top=","72pt");
            //string content = "<style:page-layout-properties fo:page-width=\"8.5in\" fo:page-height=\"11in\" style:num-format=\"1\" style:print-orientation=\"portrait\" fo:margin-top=\"0.7874in\" fo:margin-right=\"0.7874in\" fo:margin-bottom=\"0.7874in\" fo:margin-left=\"0.7874in\" style:writing-mode=\"lr-tb\" style:footnote-max-height=\"0in\" fo:padding-top=\"72pt\" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\" xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"><style:background-image /></style:page-layout-properties><style:header-style xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"><style:header-footer-properties fo:margin-bottom=\"106.3464pt\" fo:min-height=\"14.21pt\" fo:margin-left=\"0pt\" fo:margin-right=\"0pt\" style:dynamic-spacing=\"false\" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\" /></style:header-style><style:footer-style xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"><style:header-footer-properties fo:margin-bottom=\"106.3464pt\" fo:min-height=\"14.21pt\" fo:margin-left=\"0pt\" fo:margin-right=\"0pt\" style:dynamic-spacing=\"false\" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\" /></style:footer-style>";

            returnValue = _validate.ValidateNodeAttributesNS(1,xpath);
            Assert.IsTrue(returnValue);

            //second Node
            xpath = "//style:page-layout[@style:name='pm4']";
            _validate = new ValidateXMLFile(output);
            _validate.ClassName = string.Empty;
            _validate.ClassProperty.Add("fo:padding-top=", "72pt");
            //string content = "<style:page-layout-properties fo:page-width=\"8.5in\" fo:page-height=\"11in\" style:num-format=\"1\" style:print-orientation=\"portrait\" fo:margin-top=\"0.7874in\" fo:margin-right=\"0.7874in\" fo:margin-bottom=\"0.7874in\" fo:margin-left=\"0.7874in\" style:writing-mode=\"lr-tb\" style:footnote-max-height=\"0in\" fo:padding-top=\"72pt\" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\" xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"><style:background-image /></style:page-layout-properties><style:header-style xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"><style:header-footer-properties fo:margin-bottom=\"106.3464pt\" fo:min-height=\"14.21pt\" fo:margin-left=\"0pt\" fo:margin-right=\"0pt\" style:dynamic-spacing=\"false\" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\" /></style:header-style><style:footer-style xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"><style:header-footer-properties fo:margin-bottom=\"106.3464pt\" fo:min-height=\"14.21pt\" fo:margin-left=\"0pt\" fo:margin-right=\"0pt\" style:dynamic-spacing=\"false\" xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\" /></style:footer-style>";

            returnValue = _validate.ValidateNodeAttributesNS(1, xpath);
            Assert.IsTrue(returnValue);
        }
示例#21
0
        public void FontWeightBolder_Node()
        {
            const string file = "FontWeightBolder";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "a";
            _validate.ClassProperty.Add("fo:font-weight", "700");
            _validate.ClassProperty.Add("fo:font-weight-complex", "700");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "b";
            _validate.ClassProperty.Add("fo:font-weight", "400");
            _validate.ClassProperty.Add("fo:font-weight-complex", "400");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "c";
            _validate.ClassProperty.Add("fo:font-weight", "700");
            _validate.ClassProperty.Add("fo:font-weight-complex", "700");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);
        }
示例#22
0
        public void ParallerReferenceKeepWith_Node()
        {
            const string file = "ParallerReferenceKeepWith";
            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            string xpath = "//style:style[@style:name='ParallelPassageReference']";
            _validate = new ValidateXMLFile(output);
            _validate.ClassName = string.Empty;
            _validate.ClassProperty.Add("fo:keep-with-next", "always");

            returnValue = _validate.ValidateNodeAttributesNS(1, xpath);
            Assert.IsTrue(returnValue);
        }
示例#23
0
        public void VerticalAlignTest_Node()
        {
            const string file = "VerticalAlignTest";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "xhomographnumber";
            _validate.ClassProperty.Add("style:text-position", "sub 55%");
            _validate.ClassProperty.Add("fo:font-size", "100%");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "xhomographnumbersuper";
            _validate.ClassProperty.Add("style:text-position", "super 55%");
            _validate.ClassProperty.Add("fo:font-size", "100%");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);
        }
示例#24
0
        public void TextTransformTest_Node()
        {
            const string file = "TD100";
            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "uppercase";
            _validate.ClassProperty.Add("fo:text-transform", "uppercase");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue, "TextTransform syntax failed in Styles.xml");

            _validate.ClassName = "lowercase";
            _validate.ClassProperty.Add("fo:text-transform", "lowercase");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue, "TextTransform syntax failed in Styles.xml");

            _validate.ClassName = "Title";
            _validate.ClassProperty.Add("fo:text-transform", "capitalize");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue, "TextTransform syntax failed in Styles.xml");

        }
示例#25
0
        public void DirectionTest_Node()
        {
            const string file = "Direction";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "letter";
            _validate.ClassProperty.Add("style:writing-mode", "lr-tb");

            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "entryFirst";
            _validate.ClassProperty.Add("style:writing-mode", "lr-tb");

            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "entrylast";
            _validate.ClassProperty.Add("style:writing-mode", "rl-tb");

            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);
        }
示例#26
0
        public void TextFontWeightTestE_Node()
        {
            const string file = "TextFontWeightTestE";
            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "letter";
            _validate.ClassProperty.Add("fo:font-weight", "700");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue, "Font-Weight-Test-E syntax failed in Styles.xml");

            _validate.ClassName = "letter2";
            _validate.ClassProperty.Add("fo:font-weight", "700");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue, "Font-Weight-Test-E syntax failed in Styles.xml");

        }
示例#27
0
        public void PageBreakAfterTest_Node()
        {
            const string file = "PageBreakAfterTest";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "entry";
            _validate.ClassProperty.Add("fo:break-after", "page");
            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);
        }
示例#28
0
        public void TableProperty()
        {
            const string file = "TableProperty";
            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "thstyle";
            _validate.ClassProperty.Add("fo:color", "#0000ff");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue, "Table property failed in Styles.xml");
        }
示例#29
0
        public void PositionTest_Node()
        {
            const string file = "Position";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "positionLeft";
            _validate.ClassProperty.Add("fo:margin-left", "50pt");
            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "positionRight";
            _validate.ClassProperty.Add("fo:margin-left", "-20pt");
            returnValue = _validate.ValidateNodeAttributesNS(true);
            Assert.IsTrue(returnValue);

        }
示例#30
0
        public void TextFontStyleTestB_Node()
        {
            const string file = "TextFontStyleTestB";
            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "letter";
            _validate.ClassProperty.Add("fo:font-style", "italic");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            //Note: letter1 should not exist, to write it

            _validate.ClassName = "letter2";
            _validate.ClassProperty.Add("fo:font-style", "italic");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);
        }
示例#31
0
        public void SinglePageRefTest_Node()
        {

            const string file = "SinglePageRef";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            // Note - single node test
            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "PageHeaderFooter12";
            _validate.ClassProperty.Add("fo:font-weight", "700");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "PageHeaderFooter14";
            _validate.ClassProperty.Add("fo:font-weight", "700");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            //style:master-page style:name="First_20_Page"
            //Third Node
            //XPath = "//style:style[@style:name='" + ClassName + "']";
            //string xpath = "//style:master-page[style:name=\"First_20_Page\"]";
            string xpath = "//style:master-page[@style:name='Left_20_Page']";
            _validate.ClassName = string.Empty;
            string inner =
                //"<text:p text:style-name=\"Header\" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\">" +
                "<style:header xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\">" +
                "<text:p text:style-name=\"Header\" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\">" +
                "<text:span text:style-name=\"PageHeaderFooter12\">" +
                "<text:chapter text:display=\"name\" text:outline-level=\"9\" />" +
                "</text:span>" +
                "<text:tab />" +
                "<text:span text:style-name=\"PageHeaderFooter13\">" +
                "<text:page-number text:select-page=\"current\">4</text:page-number>" +
                "</text:span>" +
                "<text:tab />" +
                "<text:span text:style-name=\"PageHeaderFooter14\">" +
                "<text:chapter text:display=\"name\" text:outline-level=\"10\" />" +
                "</text:span>" +
                "</text:p>" +
                "</style:header>";

            returnValue = _validate.ValidateNodeInnerXml(xpath, inner);
            Assert.IsTrue(returnValue);

            xpath = "//style:master-page[@style:name='Right_20_Page']";
            _validate.ClassName = string.Empty;
            inner =
                //"<text:p text:style-name=\"Header\" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\">" +
                "<style:header xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\">" +
                "<text:p text:style-name=\"Header\" xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\">" +
                "<text:span text:style-name=\"PageHeaderFooter18\">" +
                "<text:chapter text:display=\"name\" text:outline-level=\"9\" />" +
                "</text:span>" +
                "<text:tab />" +
                "<text:span text:style-name=\"PageHeaderFooter19\">" +
                "<text:page-number text:select-page=\"current\">4</text:page-number>" +
                "</text:span>" +
                "<text:tab />" +
                "<text:span text:style-name=\"PageHeaderFooter20\">" +
                "<text:chapter text:display=\"name\" text:outline-level=\"10\" />" +
                "</text:span>" +
                "</text:p>" +
                "</style:header>";

            returnValue = _validate.ValidateNodeInnerXml(xpath, inner);
            Assert.IsTrue(returnValue);
        }
示例#32
0
        public void FontFamily_Node()
        {
            const string file = "FontFamily";

            string input = FileInput(file + ".css");
            string output = FileOutput(file + "styles.xml");
            GetCssClass(input, output);

            _validate = new ValidateXMLFile(output);
            _validate.ClassName = "letter1";
            _validate.ClassProperty.Add("fo:font-family", "Times New Roman");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "letter2";
            _validate.ClassProperty.Add("fo:font-family", "Verdana");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);


            _validate.ClassName = "letter3"; // Inherit
            _validate.ClassProperty.Add("fo:font-family", "Tahoma");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "letter4";
            _validate.ClassProperty.Add("fo:font-family", "Tahoma");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "letter5";
            _validate.ClassProperty.Add("fo:font-family", "dummyfont");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            // letter6 no style

            _validate.ClassName = "letter7";
            _validate.ClassProperty.Add("fo:font-family", "dummyfamily");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);

            _validate.ClassName = "letter8";
            _validate.ClassProperty.Add("fo:font-family", "Times New Roman");

            returnValue = _validate.ValidateNodeAttributesNS(false);
            Assert.IsTrue(returnValue);


        }