Exemple #1
0
        protected void SetUp()
        {
            _stylesXML = new InStyles();
            _storyXML = new InStory();
            _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles");
            _outputPath = Common.PathCombine(_testFolderPath, "output");
            _outputStyles = Common.PathCombine(_outputPath, "Resources");
            _outputStory = Common.PathCombine(_outputPath, "Stories");
            _outputSpread = Common.PathCombine(_outputPath, "Spreads");
            projInfo.TempOutputFolder = _outputPath;
            _cssProperty = new Dictionary<string, Dictionary<string, string>>();
            _cssTree = new CssTree();

            _inputCSS1 = Common.DirectoryPathReplace(_testFolderPath + "/input/Page1.css");
            _inputCSS2 = Common.DirectoryPathReplace(_testFolderPath + "/input/Page2.css");

            _facingPages.Add("Spread_1.xml");
            _facingPages.Add("Spread_2.xml");
            _facingPages.Add("Spread_3.xml");

            _singlePages.AddRange(_facingPages);
            _singlePages.Add("Spread_4.xml");
            _singlePages.Add("Spread_5.xml");

            _columnClass.Add("t1");
            _columnClass.Add("t2");
            _columnClass.Add("t3");
        }
Exemple #2
0
 protected void SetUp()
 {
     _stylesXML = new InStyles();
     _storyXML = new InStory();
     _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles");
     ClassProperty = _expected;  //Note: All Reference address initialized here
     _output = Common.PathCombine(_testFolderPath, "output");
     _outputPath = Common.PathCombine(_testFolderPath, "output");
     _outputStyles = Common.PathCombine(_outputPath, "Resources");
     _outputStory = Common.PathCombine(_outputPath, "Stories");
     projInfo.TempOutputFolder = _outputPath;
     _cssProperty = new Dictionary<string, Dictionary<string, string>>();
     _cssTree = new CssTree();
 }
Exemple #3
0
 protected void SetUpAll()
 {
     _stylesXML = new InStyles();
     _storyXML = new InStory();
     _testFolderPath = PathPart.Bin(Environment.CurrentDirectory, "/InDesignConvert/TestFiles");
     ClassProperty = _expected;  //Note: All Reference address initialized here
     _outputPath = Common.PathCombine(_testFolderPath, "output");
     _expectedPath = Common.PathCombine(_testFolderPath, "Expected");
     _expectedPath = Common.PathCombine(_expectedPath, "BuangExpect");
     _outputStyles = Common.PathCombine(_outputPath, "Resources");
     _outputStory = Common.PathCombine(_outputPath, "Stories");
     projInfo.TempOutputFolder = _outputPath;
     _cssProperty = new Dictionary<string, Dictionary<string, string>>();
     Common.SupportFolder = "";
     Common.ProgInstall = PathPart.Bin(Environment.CurrentDirectory, "/../../DistFiles");
     Common.CopyFolderandSubFolder(_expectedPath, _outputPath, true);
 }
Exemple #4
0
        public void SpacePreserve()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/SpacePreserve.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/SpacePreserve.xhtml");
            ExportProcess();

            _expected.Clear();
            string styleName = "$ID/[No character style]"; 
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange/CharacterStyleRange[2][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]//Content";
            string content = " ";
            bool result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");
        }
Exemple #5
0
        //[Ignore]
        public void Ancestor()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/Ancestor.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/Ancestor.xhtml");
            ExportProcess();

            _expected.Clear();
            string styleName = "letter.-locator_1";
            _expected.Add(styleName, "a");
            XPath = "//ParagraphStyleRange[2]/CharacterStyleRange[1][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            bool result = StoryXmlNodeTest(false);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "letter.-locator_1";
            _expected.Add(styleName, "b");
            XPath = "//ParagraphStyleRange[2]/CharacterStyleRange[2][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(false);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "letter.-locator_1";
            _expected.Add(styleName, "d");
            XPath = "//ParagraphStyleRange[2]/CharacterStyleRange[5][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(false);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "letter.-current_1";
            _expected.Add(styleName, "w");
            XPath = "//ParagraphStyleRange[2]/CharacterStyleRange[24][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(false);
            Assert.IsTrue(result, styleName + " test Failed");


        }
Exemple #6
0
        public void MultiClass()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/multiClass.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/multiClass.xhtml");
            ExportProcess();

            _expected.Clear();
            string styleName = "a.-b.-c_1";
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange[1][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]";
            bool result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "a_1";
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange[2][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "b_1";
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange[3][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "a.-c_1";
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange[6][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");
        }
Exemple #7
0
        public void ParentPrecede()
        {
            _stylesXML = new InStyles();
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/ParentPrecede.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/ParentPrecede.xhtml");
            ExportProcess();

            _expected.Clear();
            string styleName = "xitem_.en_1";
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange[1][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]";
            bool result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
                        
            styleName = "xlanguagetag_xitem-xitem_xitem_1";
            _expected.Add("AppliedCharacterStyle", "CharacterStyle/" + styleName);
            XPath = "//ParagraphStyleRange[2]/CharacterStyleRange[2][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");
        }
Exemple #8
0
        public void FootnoteSpanContent()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/FootnoteSpanContent.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/FootnoteSpanContent.xhtml");
            ExportProcess();

            _expected.Clear();
            string styleName = "NoteTargetReference_1";
            XPath = "//CharacterStyleRange[@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]//Content";
            string content = "21:1 ";
            bool result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "AlternateReading_1";
            XPath = "//CharacterStyleRange[@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]//Content";
            content = "runaround text ";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "NoteGeneralParagraph_1";
            XPath = "//CharacterStyleRange[@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]//Content";
            content = "Keep in mind that text wrap options apply to the object being wrapped.";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");
        }
Exemple #9
0
        public void PseudoAfter()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/PseudoAfter.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/PseudoAfter.xhtml");
            ExportProcess();

            _expected.Clear();
            string styleName = "letHead..after_1";
            XPath = "//CharacterStyleRange[@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]//Content";
            string content = "###";
            bool result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "letHead-letHead..after_1";
            XPath = "//CharacterStyleRange[@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]//Content";
            content = "***";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");
        }
Exemple #10
0
        public void NestedSpan1()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/NestedSpan1.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/NestedSpan1.xhtml");
            ExportProcess();

            _expected.Add("PointSize", "8");
            XPath = "//RootCharacterStyleGroup/CharacterStyle[@Name = \"t3_1\"]";
            bool result = StyleXmlNodeTest(true);
            Assert.IsTrue(result, _inputCSS + " test Failed");
        }
Exemple #11
0
        public void NestedDiv4()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/NestedDivCase4.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/NestedDivCase4.xhtml");
            ExportProcess();

            string styleName = "t1_1";
            XPath = "//ParagraphStyleRange[1][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]//Content";
            string content = "T1 class ";
            bool result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");

            styleName = "t2_1";
            XPath = "//ParagraphStyleRange[2][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]//Content";
            content = "T2 class ";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");

            styleName = "t3_1";
            XPath = "//ParagraphStyleRange[3][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]//Content";
            content = "T3 class ";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");

            styleName = "t4_1";
            XPath = "//ParagraphStyleRange[4][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]//Content";
            content = "T4 class ";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");

            styleName = "t2_1";
            XPath = "//ParagraphStyleRange[5][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]//Content";
            content = "T2 class ";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");

            styleName = "t4_1";
            XPath = "//ParagraphStyleRange[6][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]//Content";
            content = "T4 class ";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");

            styleName = "t4_1";
            XPath = "//ParagraphStyleRange[7][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]//Content";
            content = "T4 class ";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");

            styleName = "t1_1";
            XPath = "//ParagraphStyleRange[8][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]//Content";
            content = "T1 class ";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");

        }
Exemple #12
0
        // compare output with firefox
        public void TaggedText()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/TaggedText.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/TaggedText.xhtml");
            ExportProcess();

            XPath = "//Story/ParagraphStyleRange[@AppliedParagraphStyle = \"ParagraphStyle/div.header_1\"]";

            _cssProperty = _cssTree.CreateCssProperty(_inputCSS, true);
            _idAllClass = _stylesXML.CreateIDStyles(_outputStyles, _cssProperty);
            _storyXML.CreateStory(projInfo, _idAllClass, _cssTree.SpecificityClass, _cssTree.CssClassOrder);

            XmlNodeList nodesList = Common.GetXmlNodeListInDesignNamespace(Common.PathCombine(_outputStory, "Story_2.xml"), XPath);
            XmlNode node = nodesList[0];
            Assert.IsTrue(node != null, _inputCSS + " test Failed");
        }
Exemple #13
0
        public void EmptyTextNode()
        {
            const string classname = "EmptyTextNode";
            _storyXML = new InStory();
            _cssProperty.Clear();
            _idAllClass.Clear();
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/EmptyTextNode.xhtml");
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/EmptyTextNode.css");
            _cssProperty = _cssTree.CreateCssProperty(_inputCSS, true);
            _idAllClass = _stylesXML.CreateIDStyles(_outputStyles, _cssProperty);
            projInfo.DefaultXhtmlFileWithPath = _inputXHTML;
            _storyXML.CreateStory(projInfo, _idAllClass, _cssTree.SpecificityClass, _cssTree.CssClassOrder);
            XPath = "//ParagraphStyleRange[@AppliedParagraphStyle = \"ParagraphStyle/letter_1\"]/CharacterStyleRange";
            string _fileNameWithPath = Common.PathCombine(_outputStory, "Story_4.xml");
            XmlNodeList nodesList = Common.GetXmlNodeListInDesignNamespace(_fileNameWithPath, XPath);
            XmlNode node = nodesList[0];
            XmlAttributeCollection attrb = node.Attributes;

            string result = attrb["AppliedCharacterStyle"].Value;
            Assert.AreEqual(result, "CharacterStyle/$ID/[No character style]", classname + " test Failed");
        }
Exemple #14
0
        public void MultiLangHeader3()
        {
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/MultiLangHeader3.xhtml");
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/MultiLangHeader3.css");

            PublicationInformation projInfo = new PublicationInformation();

            projInfo.ProjectPath = Path.GetDirectoryName(_inputXHTML);
            projInfo.DefaultXhtmlFileWithPath = _inputXHTML;
            projInfo.DefaultCssFileWithPath = _inputCSS;

            PreExportProcess preProcessor = new PreExportProcess(projInfo);
            preProcessor.GetTempFolderPath();
            preProcessor.ImagePreprocess(false);
            preProcessor.ReplaceInvalidTagtoSpan("_AllComplexFormEntryBackRefs|LexEntryRef_PrimaryLexemes", "span");
            preProcessor.InsertHiddenChapterNumber();
            preProcessor.InsertHiddenVerseNumber();
            preProcessor.GetDefinitionLanguage();

            projInfo.DefaultXhtmlFileWithPath = preProcessor.ProcessedXhtml;
            projInfo.DefaultCssFileWithPath = preProcessor.ProcessedCss;

            Dictionary<string, Dictionary<string, string>> cssClass =
                new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
            preProcessor.InsertEmptyXHomographNumber(cssClass);

            Dictionary<string, Dictionary<string, string>> idAllClass =
                new Dictionary<string, Dictionary<string, string>>();
            InStyles inStyles = new InStyles();
            projInfo.TempOutputFolder = _outputPath;
            idAllClass = inStyles.CreateIDStyles(Common.PathCombine(_outputPath, "Resources"), cssClass);

            InGraphic inGraphic = new InGraphic();
            inGraphic.CreateIDGraphic(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass,
                                      cssTree.cssBorderColor);

            InStory inStory = new InStory();
            Dictionary<string, ArrayList> StyleName =
                inStory.CreateStory(projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder);

            InMasterSpread inMasterSpread = new InMasterSpread();
            ArrayList masterPageNames =
                inMasterSpread.CreateIDMasterSpread(Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads"),
                                                    idAllClass, StyleName["TextVariables"]);

            InSpread inSpread = new InSpread();
            inSpread.CreateIDSpread(Common.PathCombine(projInfo.TempOutputFolder, "Spreads"), idAllClass,
                                    StyleName["ColumnClass"]);

            InDesignMap inDesignMap = new InDesignMap();
            inDesignMap.CreateIDDesignMap(projInfo.TempOutputFolder, StyleName["ColumnClass"].Count, masterPageNames,
                                          StyleName["TextVariables"], StyleName["CrossRef"], string.Empty);

            InPreferences inPreferences = new InPreferences();
            inPreferences.CreateIDPreferences(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), idAllClass);

            string classname = "dTextVariablenFirst1";
            string output = Common.PathCombine(projInfo.TempOutputFolder, "designmap.xml");
            string xPath = "//TextVariable[@Self = \"" + classname + "\"]";
            XmlNode node = Common.GetXmlNodeInDesignNamespace(output, xPath);
            string result = node.InnerXml;
            string expected = "<MatchCharacterStylePreference TextBefore=\"\" TextAfter=\"\" AppliedCharacterStyle=\"CharacterStyle/headword\" SearchStrategy=\"FirstOnPage\" ChangeCase=\"None\" DeleteEndPunctuation=\"false\" />";
            Assert.AreEqual(expected, result, "MultiLangHeader1 test failed");

            classname = "dTextVariablenLast1";
            output = Common.PathCombine(projInfo.TempOutputFolder, "designmap.xml");
            xPath = "//TextVariable[@Self = \"" + classname + "\"]";
            node = Common.GetXmlNodeInDesignNamespace(output, xPath);
            result = node.InnerXml;
            expected = "<MatchCharacterStylePreference TextBefore=\"\" TextAfter=\"\" AppliedCharacterStyle=\"CharacterStyle/headword\" SearchStrategy=\"LastOnPage\" ChangeCase=\"None\" DeleteEndPunctuation=\"false\" />";
            Assert.AreEqual(expected, result, "MultiLangHeader1 test failed");
        }
Exemple #15
0
        public void FileComparisionTest(string fileName, string fileNo)
        {
            PublicationInformation projInfo = new PublicationInformation();

            projInfo.ProjectPath = Path.GetDirectoryName(_inputXHTML);
            projInfo.DefaultXhtmlFileWithPath = _inputXHTML;
            projInfo.DefaultCssFileWithPath = _inputCSS;
            projInfo.ProjectInputType = "Scripture";
            PreExportProcess preProcessor = new PreExportProcess(projInfo);
            preProcessor.GetTempFolderPath();
            preProcessor.ImagePreprocess(false);
            preProcessor.InsertHiddenChapterNumber();
            preProcessor.InsertHiddenVerseNumber();
            projInfo.DefaultXhtmlFileWithPath = preProcessor.ProcessedXhtml;
            projInfo.DefaultCssFileWithPath = preProcessor.ProcessedCss;

            Dictionary<string, Dictionary<string, string>> cssClass = new Dictionary<string, Dictionary<string, string>>();
            CssTree cssTree = new CssTree();
            cssClass = cssTree.CreateCssProperty(projInfo.DefaultCssFileWithPath, true);
            preProcessor.InsertEmptyXHomographNumber(cssClass);

            Dictionary<string, Dictionary<string, string>> idAllClass = new Dictionary<string, Dictionary<string, string>>();
            InStyles inStyles = new InStyles();
            projInfo.TempOutputFolder = _outputPath;
            idAllClass = inStyles.CreateIDStyles(Common.PathCombine(_outputPath, "Resources"), cssClass);

            InGraphic inGraphic = new InGraphic();
            inGraphic.CreateIDGraphic(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), cssClass, cssTree.cssBorderColor);

            InStory inStory = new InStory();
            Dictionary<string, ArrayList> StyleName = inStory.CreateStory(projInfo, idAllClass, cssTree.SpecificityClass, cssTree.CssClassOrder);

            InMasterSpread inMasterSpread = new InMasterSpread();
            ArrayList masterPageNames = inMasterSpread.CreateIDMasterSpread(Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads"), idAllClass, headwordStyles);

            InSpread inSpread = new InSpread();
            inSpread.CreateIDSpread(Common.PathCombine(projInfo.TempOutputFolder, "Spreads"), idAllClass, StyleName["ColumnClass"]);

            InDesignMap inDesignMap = new InDesignMap();
            inDesignMap.CreateIDDesignMap(projInfo.TempOutputFolder, StyleName["ColumnClass"].Count, masterPageNames, StyleName["TextVariables"], StyleName["CrossRef"], string.Empty);

            InPreferences inPreferences = new InPreferences();
            inPreferences.CreateIDPreferences(Common.PathCombine(projInfo.TempOutputFolder, "Resources"), idAllClass);

            // Compare files
            string expectedFolder = Common.PathCombine(_testFolderPath, "Expected\\" + fileName);

            string output = Common.PathCombine(projInfo.TempOutputFolder, "Stories\\Story_" + fileNo + ".xml");
            string expected = Common.PathCombine(expectedFolder, "Stories\\Story_" + fileNo + ".xml");
            XmlAssert.AreEqual(output, expected, " Story_"+ fileNo + ".xml is not matching");

            output = Common.PathCombine(projInfo.TempOutputFolder, "Resources\\styles.xml");
            expected = Common.PathCombine(expectedFolder, "Resources\\styles.xml");
            XmlAssert.AreEqual(output, expected, " styles.xml is not matching");
            output = Common.PathCombine(projInfo.TempOutputFolder, "Resources\\Graphic.xml");
            expected = Common.PathCombine(expectedFolder, "Resources\\Graphic.xml");
            XmlAssert.AreEqual(output, expected, " Graphic.xml is not matching");
            
            output = Common.PathCombine(projInfo.TempOutputFolder, "Resources\\Preferences.xml");
            expected = Common.PathCombine(expectedFolder, "Resources\\Preferences.xml");
            XmlAssert.AreEqual(output, expected, " Preferences.xml is not matching");

            output = Common.PathCombine(projInfo.TempOutputFolder, "Spreads\\Spread_1.xml");
            expected = Common.PathCombine(expectedFolder, "Spreads\\Spread_1.xml");
            XmlAssert.AreEqual(output, expected, " Spread_1.xml is not matching");
            
            output = Common.PathCombine(projInfo.TempOutputFolder, "Spreads\\Spread_2.xml");
            expected = Common.PathCombine(expectedFolder, "Spreads\\Spread_2.xml");
            XmlAssert.AreEqual(output, expected, " Spread_2.xml is not matching");
            
            output = Common.PathCombine(projInfo.TempOutputFolder, "Spreads\\Spread_3.xml");
            expected = Common.PathCombine(expectedFolder, "Spreads\\Spread_3.xml");
            XmlAssert.AreEqual(output, expected, " Spread_3.xml is not matching");

            output = Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads\\MasterSpread_All.xml");
            expected = Common.PathCombine(expectedFolder, "MasterSpreads\\MasterSpread_All.xml");
            XmlAssert.AreEqual(output, expected, " MasterSpread_All.xml is not matching");
            
            output = Common.PathCombine(projInfo.TempOutputFolder, "MasterSpreads\\MasterSpread_First.xml");
            expected = Common.PathCombine(expectedFolder, "MasterSpreads\\MasterSpread_First.xml");
            XmlAssert.AreEqual(output, expected, " MasterSpread_First.xml is not matching");
        }
Exemple #16
0
        public void CrossRef()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/CrossRef.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/CrossRef.xhtml");
            _cssProperty.Clear();
            _idAllClass.Clear();
            _cssProperty = _cssTree.CreateCssProperty(_inputCSS, true);
            _idAllClass = _stylesXML.CreateIDStyles(_outputStyles, _cssProperty);
            projInfo.DefaultXhtmlFileWithPath = _inputXHTML;
            var StyleName = _storyXML.CreateStory(projInfo, _idAllClass, _cssTree.SpecificityClass, _cssTree.CssClassOrder);

            string classname = "Hyperlink nema1";
            XPath = "//HyperlinkTextSource[@Name = \"" + classname + "\"]";
            string content = "nema1";
            bool result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, classname + " test Failed");

            classname = "Hyperlink nema2";
            XPath = "//HyperlinkTextSource[@Name = \"" + classname + "\"]";
            content = "nema2";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, classname + " test Failed");

            classname = "Hyperlink nema3";
            XPath = "//HyperlinkTextSource[@Name = \"" + classname + "\"]";
            content = "nema3";
            result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, classname + " test Failed");

            classname = "Name_namenema1";
            XPath = "//HyperlinkTextDestination[@Name = \"" + classname + "\"]";
            content = "nema1";
            result = ValidateNextNodeContent(_outputStory, content);
            Assert.IsTrue(result, classname + " test Failed");

            classname = "Name_namenema2";
            XPath = "//HyperlinkTextDestination[@Name = \"" + classname + "\"]";
            content = "nema2";
            result = ValidateNextNodeContent(_outputStory, content);
            Assert.IsTrue(result, classname + " test Failed");

            classname = "Name_namenema3";
            XPath = "//HyperlinkTextDestination[@Name = \"" + classname + "\"]";
            content = "nema3";
            result = ValidateNextNodeContent(_outputStory, content);
            Assert.IsTrue(result, classname + " test Failed");

            ArrayList test = new ArrayList();
            InDesignMap _designmapXML = new InDesignMap();
            _designmapXML.CreateIDDesignMap(_outputPath, 4, new ArrayList(), test, StyleName["CrossRef"], string.Empty);
            classname = "Name_namenema3";

            FileNameWithPath = Common.PathCombine(_outputPath,"designmap.xml");
            foreach (string crossref in StyleName["CrossRef"])
            {
                XPath = "//Hyperlink[@Name = \"" + crossref + "\"]";
                result = IsNodeExists();
                Assert.IsTrue(result, classname + " test Failed");
            }
        }
Exemple #17
0
        public void AttributeTest2()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/Attribute2.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/Attribute2.xhtml");
            ExportProcess();

            _expected.Add("FillColor", "Color/#0000ff");
            XPath = "//RootCharacterStyleGroup/CharacterStyle[@Name = \"main_2\"]";
            bool result = StyleXmlNodeTest(true);
            Assert.IsTrue(result, _inputCSS + " test Failed");

            //1
            _expected.Clear();
            _expected.Add("FillColor", "Color/#ff0000");
            XPath = "//RootCharacterStyleGroup/CharacterStyle[@Name = \"main_3\"]";
            result = ValidateNodeAttribute();
            Assert.IsTrue(result, _inputCSS + " 1test Failed");
        }
Exemple #18
0
        public void Font1()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/Font1.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/Font1.xhtml");
            ExportProcess();

            _expected.Add("PointSize", "8");
            XPath = "//RootParagraphStyleGroup/ParagraphStyle[@Name = \"t2_1\"]";
            bool result = StyleXmlNodeTest(true);
            Assert.IsTrue(result, _inputCSS + " test Failed");

            _expected.Clear();
            _expected.Add("AppliedFont", "Verdana");
            XPath = "//RootParagraphStyleGroup/ParagraphStyle[@Name = \"" + "t2_1" + "\"]/Properties/AppliedFont";
            result = ValidateNodeValue();
            Assert.IsTrue(result, _inputCSS + " test Failed");
        }
Exemple #19
0
        public void PrinceTextReplace()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/PrinceTextReplace.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/PrinceTextReplace.xhtml");
            ExportProcess();

            _expected.Clear();
            string styleName = "Paragraph_1";
            XPath = "//CharacterStyleRange[@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]//Content";
            string content = "You can (( wrap text (around any object) in InDesign )). ";
            bool result = ValidateNodeContent(_outputStory, content);
            Assert.IsTrue(result, styleName + " test Failed");
        }
Exemple #20
0
        public void FontParent()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/FontParent.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/FontParent.xhtml");
            ExportProcess();

            _expected.Add("AppliedFont", "Arial Black");
            XPath = "//RootParagraphStyleGroup/ParagraphStyle[@Name = \"" + "a_1" + "\"]/Properties/AppliedFont";
            bool result = ValidateNodeValue();
            Assert.IsTrue(result, _inputCSS + " test Failed");

            _expected.Clear();
            _expected.Add("AppliedFont", "Arial Black");
            XPath = "//RootParagraphStyleGroup/ParagraphStyle[@Name = \"" + "a_1" + "\"]/Properties/AppliedFont";
            result = ValidateNodeValue();
            Assert.IsTrue(result, _inputCSS + " test Failed");
        } 
Exemple #21
0
        public void Precede1()
        {
            _cssProperty.Clear();
            _idAllClass.Clear();
            ClassProperty.Clear();

            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/Precede1.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/Precede1.xhtml");
            ExportProcess();

            _expected.Clear();
            string styleName = "main_2";
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange[1][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]";
            bool result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "main_3";
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange[2][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");


            _expected.Clear();
            styleName = "main_4";
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange[3][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "main_3";
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange[6][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "main_3";
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange[7][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "main_3";
            _expected.Add("AppliedParagraphStyle", "ParagraphStyle/" + styleName);
            XPath = "//ParagraphStyleRange[8][@AppliedParagraphStyle = \"ParagraphStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");

        }
Exemple #22
0
 public void ColumnGap3()
 {
     _storyXML = new InStory();
     _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/ColumnGap3.css");
     _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/ColumnGap3.xhtml");
     ExportProcess();
     _expected.Add("TextColumnGutter", "18");
     XPath = "//RootParagraphStyleGroup/ParagraphStyle[@Name = \"t1_1\"]";
     bool result = StyleXmlNodeTest(true);
     Assert.IsTrue(result, _inputCSS + " test Failed");
 }
Exemple #23
0
        public void PseudoContains()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/PseudoContains.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/PseudoContains.xhtml");
            ExportProcess();

            _expected.Clear();
            string styleName = "main_3";
            _expected.Add("AppliedCharacterStyle", "CharacterStyle/" + styleName);
            XPath = "//CharacterStyleRange[1][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            bool result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "main_3";
            _expected.Add("AppliedCharacterStyle", "CharacterStyle/" + styleName);
            XPath = "//CharacterStyleRange[1][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(true);
            Assert.IsTrue(result, styleName + " test Failed");
        }
Exemple #24
0
 public void Larger()
 {
     _storyXML = new InStory();
     _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/larger.css");
     _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/largersmaller.xhtml");
     ExportProcess();
     _expected.Add("PointSize", "22");
     XPath = "//RootParagraphStyleGroup/ParagraphStyle[@Name = \"t2_1\"]";
     bool result = StyleXmlNodeTest(true);
     Assert.IsTrue(result, _inputCSS + " test Failed");
 }
Exemple #25
0
        public void MultiParent()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/MultiParent.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/MultiParent.xhtml");
            projInfo.DefaultXhtmlFileWithPath = _inputXHTML;
            ExportProcess();

            _expected.Clear();
            string styleName = "xsensenumber_1";
            _expected.Add(styleName, "x red ");
            XPath = "//ParagraphStyleRange/CharacterStyleRange[2][@AppliedCharacterStyle = \"CharacterStyle/" +
                    styleName + "\"]";
            bool result = StoryXmlNodeTest(false);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "xsensenumber_sense_subsenses_1";
            _expected.Add(styleName, "2.1) ");
            XPath = "//ParagraphStyleRange/CharacterStyleRange[8][@AppliedCharacterStyle = \"CharacterStyle/" +
                    styleName + "\"]";
            result = StoryXmlNodeTest(false);
            Assert.IsTrue(result, styleName + " test Failed");
        }
Exemple #26
0
        public void DisplayBlock()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/DisplayBlock.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/DisplayBlock.xhtml");
            ExportProcess();

            string expected = Common.DirectoryPathReplace(_testFolderPath + "/expected/Resources/DisplayBlock.xml");
            string output = Common.DirectoryPathReplace(_testFolderPath + "/output/Resources/Styles.xml");
            XmlAssert.AreEqual(expected, output, "DisplayBlock syntax failed in Styles.xml");

            expected = Common.DirectoryPathReplace(_testFolderPath + "/expected/stories/DisplayBlock.xml");
            output = Common.DirectoryPathReplace(_testFolderPath + "/output/stories/Story_1.xml");
            XmlAssert.AreEqual(expected, output, "DisplayBlock syntax failed in stories.xml");

        }
Exemple #27
0
        public void Tag()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/Tag.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/Tag.xhtml");
            ExportProcess();

            _expected.Clear();
            string styleName = "main_2";
            _expected.Add(styleName, "span Tag - Red");
            XPath = "//ParagraphStyleRange/CharacterStyleRange[1][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            bool result = StoryXmlNodeTestForTag(false);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "main_3";
            _expected.Add(styleName, " span Header with lang - Orange");
            XPath = "//ParagraphStyleRange/CharacterStyleRange[2][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTestForTag(false);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "main_4";
            _expected.Add(styleName, " span Header - Blue");
            XPath = "//ParagraphStyleRange/CharacterStyleRange[3][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTestForTag(false);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "main_5";
            _expected.Add(styleName, " span Header with lang - Green");
            XPath = "//ParagraphStyleRange/CharacterStyleRange[4][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTestForTag(false);
            Assert.IsTrue(result, styleName + " test Failed");

        }
Exemple #28
0
 public void PseudoBefore()
 {
     _storyXML = new InStory();
     _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/PseudoBefore.css");
     _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/PseudoBefore.xhtml");
     ExportProcess();
     string expected = Common.DirectoryPathReplace(_testFolderPath + "/expected/stories/PseudoBefore.xml");
     string output = _testFolderPath + "/output/stories/Story_1.xml";
     TextFileAssert.AreEqual(expected, output, "PseudoBefore syntax failed in stories.xml");
 }
Exemple #29
0
        public void TagTest1()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/TagTest1.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/TagTest1.xhtml");
            ExportProcess();

            _expected.Clear();
            string styleName = "letData_2";
            _expected.Add(styleName, "chomi");
            XPath = "//ParagraphStyleRange/CharacterStyleRange[1][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            bool result = StoryXmlNodeTest(false);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "Focused_1";
            _expected.Add(styleName, "vako");
            XPath = "//ParagraphStyleRange/CharacterStyleRange[2][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(false);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "letData_2";
            _expected.Add(styleName, "tagantsi");
            XPath = "//ParagraphStyleRange/CharacterStyleRange[3][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(false);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "letData_3";
            _expected.Add(styleName, "chuparse la mano");
            XPath = "//ParagraphStyleRange/CharacterStyleRange[4][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(false);
            Assert.IsTrue(result, styleName + " test Failed");

            _expected.Clear();
            styleName = "letData_3";
            _expected.Add(styleName, ").");
            XPath = "//ParagraphStyleRange/CharacterStyleRange[5][@AppliedCharacterStyle = \"CharacterStyle/" + styleName + "\"]";
            result = StoryXmlNodeTest(false);
            Assert.IsTrue(result, styleName + " test Failed");

        }
Exemple #30
0
        public void AttributeTest1()
        {
            _storyXML = new InStory();
            _inputCSS = Common.DirectoryPathReplace(_testFolderPath + "/input/Attribute1.css");
            _inputXHTML = Common.DirectoryPathReplace(_testFolderPath + "/input/Attribute1.xhtml");
            ExportProcess();

            _expected.Add("FillColor", "Color/#008000");
            XPath = "//RootCharacterStyleGroup/CharacterStyle[@Name = \"main_2\"]";
            bool result = StyleXmlNodeTest(true);
            Assert.IsTrue(result, _inputCSS + " test Failed");
            
            //1
            _expected.Clear();
            _expected.Add("FillColor", "Color/#ffa500");
            XPath = "//RootCharacterStyleGroup/CharacterStyle[@Name = \"main_3\"]";
            result = ValidateNodeAttribute();
            Assert.IsTrue(result, _inputCSS + " 1test Failed");
            //2
            _expected.Clear();
            _expected.Add("FillColor", "Color/#00ffff");
            XPath = "//RootCharacterStyleGroup/CharacterStyle[@Name = \"main_4\"]";
            result = ValidateNodeAttribute();
            Assert.IsTrue(result, _inputCSS + " 2test Failed");
            //3
            _expected.Clear();
            _expected.Add("FillColor", "Color/#ffff00");
            XPath = "//RootCharacterStyleGroup/CharacterStyle[@Name = \"main_5\"]";
            result = ValidateNodeAttribute();
            Assert.IsTrue(result, _inputCSS + " 3test Failed");

            //4
            _expected.Clear();
            _expected.Add("FillColor", "Color/#a52a2a");
            XPath = "//RootCharacterStyleGroup/CharacterStyle[@Name = \"main_6\"]";
            result = ValidateNodeAttribute();
            Assert.IsTrue(result, _inputCSS + " 4test Failed");
            //5
            _expected.Clear();
            _expected.Add("FillColor", "Color/#0000ff");
            XPath = "//RootCharacterStyleGroup/CharacterStyle[@Name = \"main_7\"]";
            result = ValidateNodeAttribute();
            Assert.IsTrue(result, _inputCSS + " 5test Failed");
            //6
            _expected.Clear();
            _expected.Add("FillColor", "Color/#ff0000");
            XPath = "//RootCharacterStyleGroup/CharacterStyle[@Name = \"main_8\"]";
            result = ValidateNodeAttribute();
            Assert.IsTrue(result, _inputCSS + " 6test Failed");
            //7
            _expected.Clear();
            _expected.Add("FillColor", "Color/#ee82ee");
            XPath = "//RootCharacterStyleGroup/CharacterStyle[@Name = \"main_9\"]";
            result = ValidateNodeAttribute();
            Assert.IsTrue(result, _inputCSS + " 7test Failed");

        }