public void TestPreviewStyle() { TempPath.InitTempFolder(); foreach (StyleOption style in _factory.GetAllStylesPreviewOptions()) { PowerPointLabs.PictureSlidesLab.Service.Preview.PreviewInfo previewInfo = _designer.PreviewApplyStyle(_sourceImage, _contentSlide, Pres.PageSetup.SlideWidth, Pres.PageSetup.SlideHeight, style); SlideUtil.IsSameLooking( new FileInfo(PathUtil.GetDocTestPath() + "PictureSlidesLab\\" + style.StyleName + ".jpg"), new FileInfo(previewInfo.PreviewApplyStyleImagePath)); } }
private void UpdateStylesPreviewImages(ImageItem source, Slide contentSlide, float slideWidth, float slideHeight) { var selectedId = StylesPreviewListSelectedId.Number; StylesPreviewList.Clear(); if (!IsAbleToUpdateStylesPreviewImages(source, contentSlide)) { return; } try { foreach (var stylesPreviewOption in StyleOptionsFactory.GetAllStylesPreviewOptions()) { var previewInfo = Designer.PreviewApplyStyle(source, contentSlide, slideWidth, slideHeight, stylesPreviewOption); StylesPreviewList.Add(new ImageItem { ImageFile = previewInfo.PreviewApplyStyleImagePath, Tooltip = stylesPreviewOption.StyleName }); } } catch { View.ShowErrorMessageBox(TextCollection.PictureSlidesLabText.ErrorImageCorrupted); } StylesPreviewListSelectedId.Number = selectedId; }
private int MapStyleNameToStyleIndex(string styleName) { var allOptions = StyleOptionsFactory.GetAllStylesPreviewOptions(); for (var i = 0; i < allOptions.Count; i++) { if (allOptions[i].StyleName == styleName) { return(i); } } return(0); }
public void TestApplyStyle() { TempPath.InitTempFolder(); foreach (var style in StyleOptionsFactory.GetAllStylesPreviewOptions()) { _designer.ApplyStyle(_sourceImage, _contentSlide, Pres.PageSetup.SlideWidth, Pres.PageSetup.SlideHeight, style); var imgPath = TempPath.GetPath("applystyle-" + Guid.NewGuid().ToString().Substring(0, 7) + "-" + DateTime.Now.GetHashCode()); _contentSlide.Export(imgPath, "JPG"); SlideUtil.IsSameLooking( new FileInfo(PathUtil.GetDocTestPath() + "PictureSlidesLab\\" + style.StyleName + ".jpg"), new FileInfo(imgPath)); } }
public void TestGetAllPreviewStyleOptions() { var allOptions = _factory.GetAllStylesPreviewOptions(); Assert.IsTrue(allOptions.Count > 0); }