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); }
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); }
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); }
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); }
public void ResizeGroup_ZerosValues_Valid() { GroupShape groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50); PowerpointHelper.ResizeGroup(groupShape, 0, 0); }
public void ResizeGroup_Valid() { GroupShape groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50); PowerpointHelper.ResizeGroup(groupShape, 100, 10); }
public void CreateGroupShape_NegativeHeight_Throws() { PowerpointHelper.CreateGroupShape(50, 50, 50, -100); }
public void CreateGroupShape_ZerosValues_Valid() { GroupShape groupShape = PowerpointHelper.CreateGroupShape(-10, -10, 0, 0); }
public void CreateGroupShape_Valid() { GroupShape groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50); }
public void CreatePolygon_EmptyList_Throws() { List <int[]> list = new List <int[]>(); Shape polygon = PowerpointHelper.CreatePolygon(list); }
public void CreateRectangle_InvalidColor_Throws() { PowerpointHelper.CreateRectangleShape(50, 50, 50, 50, "invalid"); }
public void CreatePresentationWithOneEmptySlide_CustomAttributes_Valid() { PresentationDocument pres = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFile1.pptx", 9989900, 998990); Assert.IsTrue(pres.PresentationPart.SlideParts.Count() > 0); }
public void CreatePresentationWithOneEmptySlide_Valid() { PresentationDocument pres = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFile0.pptx"); Assert.IsTrue(pres.PresentationPart.SlideParts.Count() > 0); }
public void CreatePresentationWithOneEmptySlide_NegativeWidth_Throws() { PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFileP1.pptx", -9989900, 9989900); }
public void CreateRectangle_NegativeHeight_Throws() { PowerpointHelper.CreateRectangleShape(50, 50, 50, -100); }
public void ResizeGroup_NegativeHeight_Throws() { GroupShape groupShape = PowerpointHelper.CreateGroupShape(50, 50, 50, 50); PowerpointHelper.ResizeGroup(groupShape, 10, -100); }
public void CreatePresentationWithOneEmptySlide_InvalidFile_Throws() { PowerpointHelper.CreatePresentationWithOneEmptySlide(null); }
public void CreatePresentationWithOneEmptySlide_LowHeight_Throws() { PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFileP4.pptx", 9989900, 900); }
public void GetShapeTreeOfFirstSlide_Valid() { PresentationDocument pres = PowerpointHelper.CreatePresentationWithOneEmptySlide("./testFile2.pptx"); ShapeTree shapeTree = PowerpointHelper.GetShapeTreeOfFirstSlide(pres); }