Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #5
0
        public void ResizeGroup_ZerosValues_Valid()
        {
            GroupShape groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50);

            PowerpointHelper.ResizeGroup(groupShape, 0, 0);
        }
Beispiel #6
0
        public void ResizeGroup_Valid()
        {
            GroupShape groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50);

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

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

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

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

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

            ShapeTree shapeTree = PowerpointHelper.GetShapeTreeOfFirstSlide(pres);
        }