private void exportTildaShape_Click(object sender, RibbonControlEventArgs e) { setUpFolders(); System.IO.File.WriteAllText(Settings.outputPath + Path.DirectorySeparatorChar + "settings.js", Settings.PresoSettingsToJS()); String js = ""; PowerPoint.PpSelectionType type = Globals.ThisAddIn.Application.ActiveWindow.Selection.Type; if (type == PowerPoint.PpSelectionType.ppSelectionNone || type == PowerPoint.PpSelectionType.ppSelectionText) { MessageBox.Show("You can only export slides right now via selection"); } else if (type == PowerPoint.PpSelectionType.ppSelectionSlides) { foreach (PowerPoint.Slide currentSlide in Globals.ThisAddIn.Application.ActiveWindow.Selection.SlideRange) { TildaSlide slide = new TildaSlide(currentSlide); js += "preso.slides.push(" + slide.exportSlide() + ");"; } export(js); } else if (type == PowerPoint.PpSelectionType.ppSelectionShapes) { /*PowerPoint.Slide currentSlide = Settings.ActiveSlide(); * TildaSlide slide = new TildaSlide(currentSlide); * slide.shapesRange = Globals.ThisAddIn.Application.ActiveWindow.Selection; * js += "preso.slides.push(" + slide.exportSlide() + ");";*/ MessageBox.Show("You can only export slides right now via selection"); } cleanUpFolders(); }
public void TildaSlideConstructorTest() { Slide slide = new TildaTests.Mocks.MockSlide(); TildaSlide target = new TildaSlide(slide); Assert.AreEqual(slide, target.slide); }
public void backgroundImageExported() { if (Directory.Exists(Settings.outputPath)) { Directory.Delete(Settings.outputPath, true); } Directory.CreateDirectory(Settings.outputPath); Directory.CreateDirectory(Settings.outputMediaFullPath); Slide slide = new TildaTests.Mocks.MockSlide(); TildaSlide target = new TildaSlide(slide); String actual = target.exportSlide(); bool bgcreated = false; foreach (string file in Directory.GetFiles(Settings.outputMediaFullPath)) { if (file.Contains("-bg.png")) { bgcreated = true; } } Assert.AreEqual(true, bgcreated); Assert.AreEqual(true, actual.Contains("preso.shapes.push(preso.paper.image('assets/")); Assert.AreEqual(true, actual.Contains(",0,0,2160,3800));preso.shapes[(preso.shapes.length-1)].toBack();")); Directory.Delete(Settings.outputPath, true); }
private void exportTildaSlide_Click(object sender, RibbonControlEventArgs e) { setUpFolders(); PowerPoint.Slide currentSlide = Settings.ActiveSlide(); TildaSlide slide = new TildaSlide(currentSlide); System.IO.File.WriteAllText(Settings.outputPath + Path.DirectorySeparatorChar + "settings.js", Settings.PresoSettingsToJS()); export("preso.slides.push(" + slide.exportSlide() + ");"); cleanUpFolders(); }
private void exportTildaPresentation_Click(object sender, RibbonControlEventArgs e) { PowerPoint.Presentation currentPreso = Settings.ActivePresentation(); setUpFolders(); System.IO.File.WriteAllText(Settings.outputPath + Path.DirectorySeparatorChar + "settings.js", Settings.PresoSettingsToJS()); String js = Settings.PresoSettingsToJS(); foreach(PowerPoint.Slide currentSlide in currentPreso.Slides) { TildaSlide slide = new TildaSlide(currentSlide); js += "preso.slides.push(" + slide.exportSlide() + ");"; } export(js); cleanUpFolders(); MessageBox.Show("Saved :)"); }
private void exportTildaPresentation_Click(object sender, RibbonControlEventArgs e) { PowerPoint.Presentation currentPreso = Settings.ActivePresentation(); setUpFolders(); System.IO.File.WriteAllText(Settings.outputPath + Path.DirectorySeparatorChar + "settings.js", Settings.PresoSettingsToJS()); String js = Settings.PresoSettingsToJS(); foreach (PowerPoint.Slide currentSlide in currentPreso.Slides) { TildaSlide slide = new TildaSlide(currentSlide); js += "preso.slides.push(" + slide.exportSlide() + ");"; } export(js); cleanUpFolders(); MessageBox.Show("Saved :)"); }
public void toRaphJSTest() { PowerPoint.Shape shape = new MockShape(); int id = 0; TildaPicture target = new TildaPicture(shape, id); TildaShape[] shapeMap = new TildaShape[2]; shapeMap[0] = target; shapeMap[0].shape.Width = 20f; shapeMap[0].shape.Height = 40f; shapeMap[0].shape.Top = 5f; shapeMap[0].shape.Left = 6f; shapeMap[1] = new TildaShape(new MockShape(), 1); shapeMap[1].shape.Width = 50f; shapeMap[1].shape.Height = 60f; List <TildaAnimation> animationMap = new List <TildaAnimation>(); TildaSlide slide = new TildaSlide(new TildaTests.Mocks.MockSlide()); string expected = @"preso.shapes.push\(preso.paper.image\('assets/[0-9]*-[0-9]*-image.png'," + shapeMap[0].position() + "," + (shapeMap[0].shape.Width * Settings.Scaler()) + "," + shapeMap[0].shape.Height * Settings.Scaler() + @"\)\);"; string actual; //Assert.AreEqual(slide.shapeCount, 0); actual = target.toRaphJS(); Boolean doesEqual = Regex.IsMatch(actual, expected); Assert.AreEqual(true, doesEqual); //Adding animations TildaAnimation anim = new TildaAnimation(new MockEffect(), shapeMap[0]); anim.effect.Timing.Duration = 5f; anim.effect.Timing.TriggerDelayTime = 15f; shapeMap[0].animations.Add(anim); expected = @"preso.shapes.push\(preso.paper.image\('assets/[0-9]*-[0-9]*-image.png'," + shapeMap[0].position() + "," + (shapeMap[0].shape.Width * Settings.Scaler()) + "," + shapeMap[0].shape.Height * Settings.Scaler() + @"\)\);" + @"preso.shapes\[\(preso.shapes.length-1\)\].attr\(\{'opacity':0\}\);preso.animations.push\(\{'ids':\[\(preso.shapes.length-1\)\],'dur':" + anim.effect.Timing.Duration * 1000 + @",'delay':" + anim.effect.Timing.TriggerDelayTime * 1000 + @",animate:\{'opacity':1\}\}\);"; actual = target.toRaphJS(); doesEqual = Regex.IsMatch(actual, expected); Assert.AreEqual(true, doesEqual); }
public void slideJSExportCode() { if (Directory.Exists(Settings.outputPath)) { Directory.Delete(Settings.outputPath, true); } Directory.CreateDirectory(Settings.outputPath); Directory.CreateDirectory(Settings.outputMediaFullPath); Slide slide = new TildaTests.Mocks.MockSlide(); TildaSlide target = new TildaSlide(slide); String actual = target.exportSlide(); Assert.AreEqual(true, actual.Contains("function(){")); Assert.AreEqual(true, actual[actual.Length - 1] == '}'); Directory.Delete(Settings.outputPath, true); }
public void backgroundImageExported() { if(Directory.Exists(Settings.outputPath)) Directory.Delete(Settings.outputPath, true); Directory.CreateDirectory(Settings.outputPath); Directory.CreateDirectory(Settings.outputMediaFullPath); Slide slide = new TildaTests.Mocks.MockSlide(); TildaSlide target = new TildaSlide(slide); String actual = target.exportSlide(); bool bgcreated = false; foreach(string file in Directory.GetFiles(Settings.outputMediaFullPath)){ if(file.Contains("-bg.png")) bgcreated = true; } Assert.AreEqual(true, bgcreated); Assert.AreEqual(true, actual.Contains("preso.shapes.push(preso.paper.image('assets/")); Assert.AreEqual(true, actual.Contains(",0,0,2160,3800));preso.shapes[(preso.shapes.length-1)].toBack();")); Directory.Delete(Settings.outputPath, true); }
public void shapesAreOrderedBasedOnZOrderAndVisibilityIsNotConsidered() { if (Directory.Exists(Settings.outputPath)) { Directory.Delete(Settings.outputPath, true); } Directory.CreateDirectory(Settings.outputPath); Directory.CreateDirectory(Settings.outputMediaFullPath); Slide slide = new TildaTests.Mocks.MockSlide(); TildaSlide target = new TildaSlide(slide); Shape tb = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100); tb.TextFrame2.TextRange.Text = "Hello2"; Shape tb2 = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100); tb2.TextFrame2.TextRange.Text = "Hello1"; tb2.ZOrder(Office.MsoZOrderCmd.msoSendToBack); Shape tb3 = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100); tb3.TextFrame2.TextRange.Text = "Hello3"; tb3.ZOrder(Office.MsoZOrderCmd.msoSendToBack); tb3.Visible = Office.MsoTriState.msoFalse; String actual = target.exportSlide(); int first = actual.IndexOf("Hello1"); int second = actual.IndexOf("Hello2"); int third = actual.IndexOf("Hello3"); Assert.AreEqual(true, first < second); Assert.AreEqual(true, third < second); Directory.Delete(Settings.outputPath, true); }
public void shapesAreOrderedBasedOnZOrderAndVisibilityIsNotConsidered() { if(Directory.Exists(Settings.outputPath)) Directory.Delete(Settings.outputPath, true); Directory.CreateDirectory(Settings.outputPath); Directory.CreateDirectory(Settings.outputMediaFullPath); Slide slide = new TildaTests.Mocks.MockSlide(); TildaSlide target = new TildaSlide(slide); Shape tb = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100); tb.TextFrame2.TextRange.Text = "Hello2"; Shape tb2 = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100); tb2.TextFrame2.TextRange.Text = "Hello1"; tb2.ZOrder(Office.MsoZOrderCmd.msoSendToBack); Shape tb3 = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationDownward, 0, 0, 100, 100); tb3.TextFrame2.TextRange.Text = "Hello3"; tb3.ZOrder(Office.MsoZOrderCmd.msoSendToBack); tb3.Visible = Office.MsoTriState.msoFalse; String actual = target.exportSlide(); int first = actual.IndexOf("Hello1"); int second = actual.IndexOf("Hello2"); int third = actual.IndexOf("Hello3"); Assert.AreEqual(true, first < second); Assert.AreEqual(true, third < second); Directory.Delete(Settings.outputPath, true); }
public void slideJSExportCode() { if(Directory.Exists(Settings.outputPath)) Directory.Delete(Settings.outputPath, true); Directory.CreateDirectory(Settings.outputPath); Directory.CreateDirectory(Settings.outputMediaFullPath); Slide slide = new TildaTests.Mocks.MockSlide(); TildaSlide target = new TildaSlide(slide); String actual = target.exportSlide(); Assert.AreEqual(true, actual.Contains("function(){")); Assert.AreEqual(true, actual[actual.Length-1]=='}'); Directory.Delete(Settings.outputPath, true); }
public void toRaphJSTest() { PowerPoint.Shape shape = new MockShape(); int id = 0; TildaPicture target = new TildaPicture(shape, id); TildaShape[] shapeMap = new TildaShape[2]; shapeMap[0] = target; shapeMap[0].shape.Width = 20f; shapeMap[0].shape.Height = 40f; shapeMap[0].shape.Top = 5f; shapeMap[0].shape.Left = 6f; shapeMap[1] = new TildaShape(new MockShape(), 1); shapeMap[1].shape.Width = 50f; shapeMap[1].shape.Height = 60f; List<TildaAnimation> animationMap = new List<TildaAnimation>(); TildaSlide slide = new TildaSlide(new TildaTests.Mocks.MockSlide()); string expected = @"preso.shapes.push\(preso.paper.image\('assets/[0-9]*-[0-9]*-image.png'," + shapeMap[0].position() + ","+(shapeMap[0].shape.Width*Settings.Scaler())+","+shapeMap[0].shape.Height*Settings.Scaler()+@"\)\);"; string actual; //Assert.AreEqual(slide.shapeCount, 0); actual = target.toRaphJS(); Boolean doesEqual = Regex.IsMatch(actual,expected); Assert.AreEqual(true, doesEqual); //Adding animations TildaAnimation anim = new TildaAnimation(new MockEffect(),shapeMap[0]); anim.effect.Timing.Duration = 5f; anim.effect.Timing.TriggerDelayTime = 15f; shapeMap[0].animations.Add(anim); expected = @"preso.shapes.push\(preso.paper.image\('assets/[0-9]*-[0-9]*-image.png'," + shapeMap[0].position() + "," + (shapeMap[0].shape.Width * Settings.Scaler()) + "," + shapeMap[0].shape.Height * Settings.Scaler() + @"\)\);" + @"preso.shapes\[\(preso.shapes.length-1\)\].attr\(\{'opacity':0\}\);preso.animations.push\(\{'ids':\[\(preso.shapes.length-1\)\],'dur':" + anim.effect.Timing.Duration * 1000 + @",'delay':" + anim.effect.Timing.TriggerDelayTime * 1000 + @",animate:\{'opacity':1\}\}\);"; actual = target.toRaphJS(); doesEqual = Regex.IsMatch(actual, expected); Assert.AreEqual(true, doesEqual); }
private void exportTildaShape_Click(object sender, RibbonControlEventArgs e) { setUpFolders(); System.IO.File.WriteAllText(Settings.outputPath + Path.DirectorySeparatorChar + "settings.js", Settings.PresoSettingsToJS()); String js = ""; PowerPoint.PpSelectionType type = Globals.ThisAddIn.Application.ActiveWindow.Selection.Type; if (type == PowerPoint.PpSelectionType.ppSelectionNone || type == PowerPoint.PpSelectionType.ppSelectionText) MessageBox.Show("You can only export slides right now via selection"); else if(type == PowerPoint.PpSelectionType.ppSelectionSlides) { foreach(PowerPoint.Slide currentSlide in Globals.ThisAddIn.Application.ActiveWindow.Selection.SlideRange) { TildaSlide slide = new TildaSlide(currentSlide); js += "preso.slides.push(" + slide.exportSlide() + ");"; } export(js); } else if(type == PowerPoint.PpSelectionType.ppSelectionShapes) { /*PowerPoint.Slide currentSlide = Settings.ActiveSlide(); TildaSlide slide = new TildaSlide(currentSlide); slide.shapesRange = Globals.ThisAddIn.Application.ActiveWindow.Selection; js += "preso.slides.push(" + slide.exportSlide() + ");";*/ MessageBox.Show("You can only export slides right now via selection"); } cleanUpFolders(); }