Пример #1
0
        public void AddImage_NegativeHeight_Throws()
        {
            PresentationDocument pres       = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFileI3.pptx");
            ShapeTree            shapeTree  = PowerpointHelper.GetShapeTreeOfFirstSlide(pres);
            GroupShape           groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50);

            PowerpointHelper.AddElement(shapeTree, groupShape);

            Bitmap logo = Resx.klee;

            using (MemoryStream ms = new MemoryStream()) {
                logo.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                PowerpointHelper.AddImage(groupShape, ms, 50, 50, 50, -50);
            }
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
0
 public void CreatePresentationWithOneEmptySlide_LowHeight_Throws()
 {
     PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFileP4.pptx", 9989900, 900);
 }
Пример #5
0
 public void CreatePresentationWithOneEmptySlide_NegativeWidth_Throws()
 {
     PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFileP1.pptx", -9989900, 9989900);
 }
Пример #6
0
 public void CreatePresentationWithOneEmptySlide_InvalidFile_Throws()
 {
     PowerpointHelper.CreatePresentationWithOneEmptySlide(null);
 }
Пример #7
0
        public void CreatePresentationWithOneEmptySlide_CustomAttributes_Valid()
        {
            PresentationDocument pres = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFile1.pptx", 9989900, 998990);

            Assert.IsTrue(pres.PresentationPart.SlideParts.Count() > 0);
        }
Пример #8
0
        public void CreatePresentationWithOneEmptySlide_Valid()
        {
            PresentationDocument pres = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFile0.pptx");

            Assert.IsTrue(pres.PresentationPart.SlideParts.Count() > 0);
        }
Пример #9
0
        public void GetShapeTreeOfFirstSlide_Valid()
        {
            PresentationDocument pres = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFile2.pptx");

            ShapeTree shapeTree = PowerpointHelper.GetShapeTreeOfFirstSlide(pres);
        }