public void Font_CreateFontTest()
        {
            Scryber.Styles.FontStyle target = new Scryber.Styles.FontStyle();
            PDFFont expected = new PDFFont(PDFStyleConst.DefaultFontFamily, PDFStyleConst.DefaultFontSize);
            PDFFont actual;

            actual = target.CreateFont();
            Assert.AreEqual(expected, actual, "Default not the same");

            target.FontFamily = (PDFFontSelector)"Symbol";
            expected          = new PDFFont(StandardFont.Symbol, PDFStyleConst.DefaultFontSize);
            actual            = target.CreateFont();
            Assert.AreEqual(expected, actual, "Symbol not the same");

            target.FontSize = 40;
            expected        = new PDFFont(StandardFont.Symbol, 40);
            actual          = target.CreateFont();
            Assert.AreEqual(expected, actual, "Symbol 40pt not the same");

            target.FontFamily = (PDFFontSelector)"Bauhaus 92";
            target.FontBold   = true;
            target.FontItalic = true;
            target.FontSize   = new PDFUnit(10, PageUnits.Millimeters);

            expected = new PDFFont("Bauhaus 92", new PDFUnit(10, PageUnits.Millimeters), Scryber.Drawing.FontStyle.Bold | Scryber.Drawing.FontStyle.Italic);
            actual   = target.CreateFont();
            Assert.AreEqual(expected, actual, "Bauhaus not the same");
        }
        public void FlattenTest()
        {
            Style target = new Style();

            //Add a background color and style
            BackgroundStyle bg = new BackgroundStyle();

            target.Background.Color     = PDFColors.Aqua;
            target.Background.FillStyle = Scryber.Drawing.FillType.Pattern;
            //target.Background.AddItem(bg);

            //Add a font
            Scryber.Styles.FontStyle fs = new Scryber.Styles.FontStyle();
            target.Font.FontBold   = true;
            target.Font.FontFamily = (PDFFontSelector)"Bauhaus 92";
            //target.AddItem(fs);

            //Flattening process will remove the duplicates from the bottom up.
            Style actual = target.Flatten();

            Assert.AreEqual(PDFColors.Aqua, actual.Background.Color);
            Assert.AreEqual(Scryber.Drawing.FillType.Pattern, actual.Background.FillStyle);
            Assert.AreEqual(true, actual.Font.FontBold);
            Assert.AreEqual((PDFFontSelector)"Bauhaus 92", actual.Font.FontFamily);
        }
Beispiel #3
0
        private StyleItemCollection GetStdCollection()
        {
            Style style             = new Style();
            StyleItemCollection col = new StyleItemCollection(style);
            BackgroundStyle     bg  = new BackgroundStyle();

            bg.Color = PDFColors.Red;
            col.Add(bg);

            BorderStyle bor = new BorderStyle();

            bor.Color = PDFColors.Green;
            col.Add(bor);

            Scryber.Styles.FontStyle fnt = new Scryber.Styles.FontStyle();
            fnt.FontFamily = (PDFFontSelector)"Symbol";
            col.Add(fnt);

            return(col);
        }
        public void Font_FontItalicTest()
        {
            Scryber.Styles.FontStyle target = new Scryber.Styles.FontStyle();
            bool expected = false;

            Assert.AreEqual(expected, target.FontItalic);

            expected          = true;
            target.FontItalic = expected;
            Assert.AreEqual(expected, target.FontItalic);

            expected          = false;
            target.FontItalic = expected;
            Assert.AreEqual(expected, target.FontItalic);


            target.RemoveFontItalic();
            expected = false;
            Assert.AreEqual(expected, target.FontItalic);
        }
        public void Font_FontFamilyTest()
        {
            Scryber.Styles.FontStyle target = new Scryber.Styles.FontStyle();
            string expected = null;

            Assert.AreEqual(expected, target.FontFamily);

            expected          = "Arial MT";
            target.FontFamily = (PDFFontSelector)expected;
            Assert.AreEqual((PDFFontSelector)expected, target.FontFamily);

            expected          = "Helvetica";
            target.FontFamily = (PDFFontSelector)expected;
            Assert.AreEqual((PDFFontSelector)expected, target.FontFamily);


            target.RemoveFontFamily();
            expected = null;
            Assert.AreEqual(expected, target.FontFamily);
        }
        public void FontSizeTest()
        {
            Scryber.Styles.FontStyle target = new Scryber.Styles.FontStyle();
            PDFUnit expected = PDFUnit.Empty;

            Assert.AreEqual(expected, target.FontSize);

            expected        = new PDFUnit(20, PageUnits.Millimeters);
            target.FontSize = expected;
            Assert.AreEqual(expected, target.FontSize);

            expected        = new PDFUnit(10, PageUnits.Points);
            target.FontSize = expected;
            Assert.AreEqual(expected, target.FontSize);


            target.RemoveFontSize();
            expected = PDFUnit.Empty;
            Assert.AreEqual(expected, target.FontSize);

            target.FontSize = PDFUnit.Empty;
            Assert.AreEqual(PDFUnit.Empty, target.FontSize);
        }
 public void Font_ConstructorTest()
 {
     Scryber.Styles.FontStyle target = new Scryber.Styles.FontStyle();
     Assert.IsNotNull(target);
     Assert.AreEqual(StyleKeys.FontItemKey, target.ItemKey);
 }