예제 #1
0
        public void GenerateHTML_StyleClasInFormatOnlyOneText_Ok()
        {
            IGenerator htmlGenerator = new HtmlGenerator();
            Style      colorRed      = Utils.CreateStyleForTest("color red", Style.StyleType.COLOR, "red");
            Style      colorBlue     = Utils.CreateStyleForTest("color blue", Style.StyleType.COLOR, "blue");
            Style      alignRight    = Utils.CreateStyleForTest("align right", Style.StyleType.ALIGN, "right");
            Style      bold          = Utils.CreateStyleForTest("bold", Style.StyleType.BOLD, "bold");
            Style      italic        = Utils.CreateStyleForTest("italic", Style.StyleType.ITALIC, "italic");
            StyleClass styleClassInheritedParagraph = CreateStyleClassForTest("Normal0", alignRight);
            StyleClass styleClassParagraph          = CreateStyleClassForTest("Normal", colorBlue);
            StyleClass styleClassDocument           = CreateStyleClassForTest("Normal2", bold);

            styleClassParagraph.SetInheritedStyleClass(styleClassInheritedParagraph);
            styleClassInheritedParagraph.AddStyle(italic);

            Format format = CreateFormatForTest(styleClassParagraph);

            format.AddStyleClass(styleClassDocument);

            Document  document  = Utils.CreateDocumentForTest();
            Paragraph paragraph = Utils.CreateParagraphForTest();
            Text      text      = Utils.CreateTextForTest();

            paragraph.PutTextAtLast(text);
            document.DocumentParagraphs.Add(paragraph);

            document.OwnStyleClass  = "Normal";
            paragraph.OwnStyleClass = "Normal2";

            string htmlGenerated = htmlGenerator.Generate(document, format);
            int    x             = 2;
        }
        public void ModifyStyleClass_ExpectedParameters_Ok()
        {
            styleClassDataAccess.Add(styleClass);
            StyleClass inheritedStyleClass = Utils.CreateStyleClassInDataBaseForTest();

            styleClass.SetInheritedStyleClass(inheritedStyleClass);
            styleClassDataAccess.Modify(styleClass);
            StyleClass obtained = styleClassDataAccess.Get(styleClass.Id);

            Assert.AreEqual(inheritedStyleClass, obtained.InheritedStyleClass);
        }
        private StyleClass GetStyleClassForDocumentPart(string ownStyleClassName, Format format, StyleClass styleClassInherited)
        {
            StyleClass styleClassForDocumentPart = styleClassInherited;
            StyleClass ownStyleClass             = format.GetStyleClass(ownStyleClassName);

            if (ownStyleClass != null)
            {
                ownStyleClass.SetInheritedStyleClass(styleClassInherited);
                styleClassForDocumentPart = ownStyleClass;
            }
            return(styleClassForDocumentPart);
        }