예제 #1
0
        public void ColumnRule()
        {
            _methodName = "ColumnRule";
            string inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/ColumnRule.css");

            _cssClass = _cssTree.CreateCssProperty(inputCSS, true);
            _InsertMacro._cssClass = _cssClass;
            string       output   = _InsertMacro.GetColumnRule();
            const string expected = "var columnRule=new Array(\"letData 1 Solid #aa0000\");";

            Assert.AreEqual(output, expected, _methodName + " failed");
        }
예제 #2
0
        public void Visibility()
        {
            string _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/Visibility.xhtml");
            string _inputCSS   = Common.DirectoryPathReplace(_testFolderPath + "/input/Visibility.css");

            _cssProperty = _cssTree.CreateCssProperty(_inputCSS, true);
            _idAllClass  = _stylesXML.CreateIDStyles(_outputStyles, _cssProperty);
            projInfo.DefaultXhtmlFileWithPath = _inputXHTML;
            _storyXML.CreateStory(projInfo, _idAllClass, _cssTree.SpecificityClass, _cssTree.CssClassOrder);
            const string classname = "a_1";

            XPath = "//RootParagraphStyleGroup/ParagraphStyle[@Name = \"" + classname + "\"]";
            string                 fileNameWithPath = Common.PathCombine(_outputStyles, "Styles.xml");
            XmlNodeList            nodesList        = Common.GetXmlNodeListInDesignNamespace(fileNameWithPath, XPath);
            XmlNode                node             = nodesList[0];
            XmlAttributeCollection attrb            = node.Attributes;
            string                 result           = attrb["FillColor"].Value;

            Assert.AreEqual("Color/Paper", result, classname + " test Failed");
        }
예제 #3
0
        private bool NodeListCompare()
        {
            _cssProperty = _cssTree.CreateCssProperty(_inputCSS, true);
            _idAllClass  = _stylesXML.CreateIDStyles(_outputStyles, _cssProperty);
            var       inMasterSpread  = new InMasterSpread();
            var       masterPageNames = inMasterSpread.CreateIDMasterSpread(_outputMasterSpreads, _idAllClass, headwordStyles);
            ArrayList test            = new ArrayList();

            _designmapXML.CreateIDDesignMap(_outputPath, 4, masterPageNames, test, new ArrayList(), string.Empty);
            FileNameWithPath = Common.PathCombine(_outputPath, "designmap.xml");
            var result1 = Common.GetXmlNodeListInDesignNamespace(FileNameWithPath, XPath);

            foreach (XmlNode fileName in result1)
            {
                if (_expectedList.Contains(fileName))
                {
                    return(false);
                }
            }
            return(true);
        }
예제 #4
0
 private void NodeTest(bool checkAttribute)
 {
     _cssProperty = _cssTree.CreateCssProperty(_input, true);
     _graphicXML.CreateIDGraphic(_output, _cssProperty, _cssTree.cssBorderColor);
     FileNameWithPath = Common.PathCombine(_output, "Graphic.xml");
     if (checkAttribute)
     {
         Assert.IsTrue(ValidateNodeAttribute(), _input + " test Failed");
     }
     else
     {
         Assert.IsTrue(ValidateNodeValue(), _input + " test Failed");
     }
 }
예제 #5
0
        private string GetStyleOutput(string file)
        {
            LOContent contentXML = new LOContent();
            LOStyles  stylesXML  = new LOStyles();
            string    fileOutput = _index > 0 ? file + _index + ".css" : file + ".css";

            //string input = FileInput(file + ".css");
            string input = FileInput(fileOutput);

            _projInfo.DefaultCssFileWithPath = input;
            _projInfo.TempOutputFolder       = _outputPath;

            Dictionary <string, Dictionary <string, string> > cssClass = new Dictionary <string, Dictionary <string, string> >();
            CssTree cssTree = new CssTree();

            cssClass = cssTree.CreateCssProperty(input, true);

            //StyleXML
            string styleOutput = FileOutput(file + _styleFile);
            Dictionary <string, Dictionary <string, string> > idAllClass = stylesXML.CreateStyles(_projInfo, cssClass, styleOutput);

            // ContentXML
            var pageSize = new Dictionary <string, string>();

            pageSize["height"] = cssClass["@page"]["page-height"];
            pageSize["width"]  = cssClass["@page"]["page-width"];
            _projInfo.DefaultXhtmlFileWithPath = FileInput(file + ".xhtml");
            _projInfo.TempOutputFolder         = FileOutput(file);
            _projInfo.HideSpaceVerseNumber     = stylesXML.HideSpaceVerseNumber;

            PreExportProcess preProcessor = new PreExportProcess(_projInfo);

            preProcessor.GetTempFolderPath();
            _projInfo.DefaultXhtmlFileWithPath = preProcessor.ProcessedXhtml;
            if (Param.HyphenEnable)
            {
                preProcessor.IncludeHyphenWordsOnXhtml(_projInfo.DefaultXhtmlFileWithPath);
            }

            AfterBeforeProcess afterBeforeProcess = new AfterBeforeProcess();

            afterBeforeProcess.RemoveAfterBefore(_projInfo, cssClass, cssTree.SpecificityClass, cssTree.CssClassOrder);

            contentXML.CreateStory(_projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder, 325, pageSize);
            _projInfo.TempOutputFolder = _projInfo.TempOutputFolder + _contentFile;
            return(styleOutput);
        }
예제 #6
0
        public void AddAfterTest()
        {
            PublicationInformation projInfo = new PublicationInformation();

            projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-ipa.xhtml");
            projInfo.DefaultCssFileWithPath   = _testFiles.Input("sena3-ipa.css");
            var cssTree = new CssTree();

            CssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
            var ContentStyles = new DictionaryForMIDsStyle();
            var rec           = new DictionaryForMIDsRec {
                CssClass = CssClass, Styles = ContentStyles
            };
            var input = new DictionaryForMIDsInput(projInfo);
            var node  = input.SelectNodes("//*[@class = 'xsensenumber']")[0];

            rec.AddAfter(node);
            Assert.AreEqual(") ", rec.Rec);
        }
예제 #7
0
        public void AddStyleTagTest()
        {
            PublicationInformation projInfo = new PublicationInformation();

            projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("sena3-imba.xhtml");
            projInfo.DefaultCssFileWithPath   = _testFiles.Input("sena3-imba.css");
            var cssTree = new CssTree();

            CssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
            var ContentStyles = new DictionaryForMIDsStyle();
            var rec           = new DictionaryForMIDsRec {
                CssClass = CssClass, Styles = ContentStyles
            };
            var input = new DictionaryForMIDsInput(projInfo);
            var node  = input.SelectNodes("//*[@class = 'partofspeech']//text()")[0];

            rec.AddStyleTag(node);
            Assert.AreEqual(2, ContentStyles.NumStyles);
        }
예제 #8
0
 private void NodeTest(bool checkAttribute)
 {
     _cssProperty = _cssTree.CreateCssProperty(_input, true);
     _stylesXML.CreateIDStyles(_output, _cssProperty);
     FileNameWithPath = Common.PathCombine(_output, "Styles.xml");
     if (checkAttribute)
     {
         Assert.IsTrue(ValidateNodeAttribute(), _input + " test Failed");
     }
     else
     {
         Assert.IsTrue(ValidateNodeValue(), _input + " test Failed");
     }
 }
예제 #9
0
        public void AddStyleTagLangTest()
        {
            PublicationInformation projInfo = new PublicationInformation();

            projInfo.DefaultXhtmlFileWithPath = _testFiles.Input("wasp.xhtml");
            projInfo.DefaultCssFileWithPath   = _testFiles.Input("wasp.css");
            var cssTree = new CssTree();

            CssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
            var ContentStyles = new DictionaryForMIDsStyle();
            var rec           = new DictionaryForMIDsRec {
                CssClass = CssClass, Styles = ContentStyles
            };
            var input = new DictionaryForMIDsInput(projInfo);
            var node  = input.SelectNodes("(//*[@class='xitem'])/*")[1];

            rec.AddStyleTag(node);
            Assert.AreEqual(2, ContentStyles.NumStyles);
            Assert.AreEqual("153,51,102", rec.Styles.FontColor(2));
        }
예제 #10
0
        public void PreferenceDocumentTagTest()
        {
            const string _methodName = "PreferenceDocumentTagTest";

            _inputCSSWithFileName = Common.DirectoryPathReplace(_testFolderPath + "/input/Page1.css");
            _cssProperty          = _cssTree.CreateCssProperty(_inputCSSWithFileName, true);
            _idAllClass           = _stylesXML.CreateIDStyles(_outputResourcePath, _cssProperty);
            CreateIDPreferences(_outputResourcePath, _idAllClass);
            _fileNameWithPath = Common.PathCombine(_outputResourcePath, "Preferences.xml");
            _xPath            = "//DocumentPreference";

            XmlNode node = Common.GetXmlNodeInDesignNamespace(_fileNameWithPath, _xPath);
            XmlAttributeCollection attrb = node.Attributes;
            string result = attrb["PageHeight"].Value;

            Assert.AreEqual(result, "792", _methodName + " failed");

            _xPath = "//DocumentPreference[@PageWidth = \"612\"]";
            node   = Common.GetXmlNodeInDesignNamespace(_fileNameWithPath, _xPath);
            attrb  = node.Attributes;
            result = attrb["PageWidth"].Value;
            Assert.AreEqual(result, "612", _methodName + " failed");
        }
예제 #11
0
        public void MasterPageCount()
        {
            ClearFiles();
            _methodName  = "MasterPageCount";
            _cssProperty = _cssTree.CreateCssProperty(_inputCSS1, true);
            _idAllClass  = _stylesXML.CreateIDStyles(_outputStyle, _cssProperty);

            _masterSpreadXML.CreateIDMasterSpread(_outputSpread, _idAllClass, headwordStyles);
            for (int i = 0; i < _listofMasterPages.Count - 1; i++)
            {
                string fileWithPath = Common.PathCombine(_outputSpread, _listofMasterPages[i].ToString());
                bool   result       = File.Exists(fileWithPath);
                Assert.IsTrue(result, fileWithPath + " is missing");
            }
        }
예제 #12
0
 public void SpreadListTest1()
 {
     ClearFiles();
     _spreadXML   = new InSpread();
     _methodName  = "SpreadListTest1";
     _cssProperty = _cssTree.CreateCssProperty(_inputCSS1, true);
     _idAllClass  = _stylesXML.CreateIDStyles(_outputStyles, _cssProperty);
     _spreadXML.CreateIDSpread(_outputSpread, _idAllClass, _columnClass);
     for (int i = 0; i < _facingPages.Count; i++)
     {
         string fileWithPath = Common.PathCombine(_outputSpread, _facingPages[i].ToString());
         bool   result       = File.Exists(fileWithPath);
         Assert.IsTrue(result, fileWithPath + " is missing");
     }
 }