Exemplo n.º 1
0
        public void AddCenteredParagraph_Valid()
        {
            List <int[]> list = new List <int[]>();

            list.Add(new int[] { 1, 2 });
            list.Add(new int[] { 3, 4 });
            list.Add(new int[] { 5, 6 });
            Shape polygon = PowerpointHelper.CreatePolygon(list);

            int oldNbParagraph = polygon.Descendants <D.Paragraph>().Count();

            PowerpointHelper.AddCenteredParagraph(polygon, "text");

            var errors = validator.Validate(polygon);

            Assert.IsTrue(errors.Count() == 0);
            Assert.IsTrue(polygon.Descendants <D.Paragraph>().Count() - oldNbParagraph == 1);
        }
Exemplo n.º 2
0
        public void AddImage_Valid()
        {
            PresentationDocument pres       = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFileI.pptx");
            ShapeTree            shapeTree  = PowerpointHelper.GetShapeTreeOfFirstSlide(pres);
            GroupShape           groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50);

            PowerpointHelper.AddElement(shapeTree, groupShape);
            Bitmap logo = Resx.klee;

            int oldNbPicture = groupShape.Descendants <Picture>().Count();

            using (MemoryStream ms = new MemoryStream()) {
                logo.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                PowerpointHelper.AddImage(groupShape, ms, 50, 50, 50, 50);
            }

            Assert.IsTrue(groupShape.Descendants <Picture>().Count() - oldNbPicture == 1);
        }
Exemplo n.º 3
0
        public void AddParagraph_CustomAttributes_Valid()
        {
            List <int[]> list = new List <int[]>();

            list.Add(new int[] { 1, 2 });
            list.Add(new int[] { 3, 4 });
            list.Add(new int[] { 5, 6 });
            Shape polygon = PowerpointHelper.CreatePolygon(list);

            int oldNbParagraph = polygon.Descendants <D.Paragraph>().Count();

            PowerpointHelper.AddParagraph(polygon, "text", 400, "ABABAB", true, D.TextAlignmentTypeValues.Right);

            var errors = validator.Validate(polygon);

            Assert.IsTrue(errors.Count() == 0);
            Assert.IsTrue(polygon.Descendants <D.Paragraph>().Count() - oldNbParagraph == 1);
        }
Exemplo n.º 4
0
        public void AddElement_Valid()
        {
            PresentationDocument pres      = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFile3.pptx");
            ShapeTree            shapeTree = PowerpointHelper.GetShapeTreeOfFirstSlide(pres);
            List <int[]>         list      = new List <int[]>();

            list.Add(new int[] { 1, 2 });
            list.Add(new int[] { 3, 4 });
            list.Add(new int[] { 5, 6 });
            Shape polygon = PowerpointHelper.CreatePolygon(list);

            PowerpointHelper.AddElement(shapeTree, polygon);

            var errors = validator.Validate(pres);

            Assert.IsTrue(errors.Count() == 0);
            Assert.IsTrue(shapeTree.Count() > 0);
        }
Exemplo n.º 5
0
        public void ResizeGroup_ZerosValues_Valid()
        {
            GroupShape groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50);

            PowerpointHelper.ResizeGroup(groupShape, 0, 0);
        }
Exemplo n.º 6
0
        public void ResizeGroup_Valid()
        {
            GroupShape groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50);

            PowerpointHelper.ResizeGroup(groupShape, 100, 10);
        }
Exemplo n.º 7
0
 public void CreateGroupShape_NegativeHeight_Throws()
 {
     PowerpointHelper.CreateGroupShape(50, 50, 50, -100);
 }
Exemplo n.º 8
0
 public void CreateGroupShape_ZerosValues_Valid()
 {
     GroupShape groupShape = PowerpointHelper.CreateGroupShape(-10, -10, 0, 0);
 }
Exemplo n.º 9
0
 public void CreateGroupShape_Valid()
 {
     GroupShape groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50);
 }
Exemplo n.º 10
0
        public void CreatePolygon_EmptyList_Throws()
        {
            List <int[]> list = new List <int[]>();

            Shape polygon = PowerpointHelper.CreatePolygon(list);
        }
Exemplo n.º 11
0
 public void CreateRectangle_InvalidColor_Throws()
 {
     PowerpointHelper.CreateRectangleShape(50, 50, 50, 50, "invalid");
 }
Exemplo n.º 12
0
        public void CreatePresentationWithOneEmptySlide_CustomAttributes_Valid()
        {
            PresentationDocument pres = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFile1.pptx", 9989900, 998990);

            Assert.IsTrue(pres.PresentationPart.SlideParts.Count() > 0);
        }
Exemplo n.º 13
0
        public void CreatePresentationWithOneEmptySlide_Valid()
        {
            PresentationDocument pres = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFile0.pptx");

            Assert.IsTrue(pres.PresentationPart.SlideParts.Count() > 0);
        }
Exemplo n.º 14
0
 public void CreatePresentationWithOneEmptySlide_NegativeWidth_Throws()
 {
     PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFileP1.pptx", -9989900, 9989900);
 }
Exemplo n.º 15
0
 public void CreateRectangle_NegativeHeight_Throws()
 {
     PowerpointHelper.CreateRectangleShape(50, 50, 50, -100);
 }
Exemplo n.º 16
0
        public void ResizeGroup_NegativeHeight_Throws()
        {
            GroupShape groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50);

            PowerpointHelper.ResizeGroup(groupShape, 10, -100);
        }
Exemplo n.º 17
0
 public void CreatePresentationWithOneEmptySlide_InvalidFile_Throws()
 {
     PowerpointHelper.CreatePresentationWithOneEmptySlide(null);
 }
Exemplo n.º 18
0
 public void CreatePresentationWithOneEmptySlide_LowHeight_Throws()
 {
     PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFileP4.pptx", 9989900, 900);
 }
Exemplo n.º 19
0
        public void GetShapeTreeOfFirstSlide_Valid()
        {
            PresentationDocument pres = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFile2.pptx");

            ShapeTree shapeTree = PowerpointHelper.GetShapeTreeOfFirstSlide(pres);
        }