Exemple #1
0
        public List <ISlideData> FetchCurrentPresentationData()
        {
            List <ISlideData> slideData = FunctionalTestExtensions.GetCurrentPresentation().Presentation
                                          .Slides.Cast <Slide>().Select(SlideData.FromSlide).ToList();

            return(slideData);
        }
Exemple #2
0
 public void SaveSelectedShapes()
 {
     UIThreadExecutor.Execute(() =>
     {
         FunctionalTestExtensions.GetRibbonUi().AddShapeButtonClick(
             new RibbonControl("AddShapeToShapesLab"));
     });
 }
Exemple #3
0
 public void SaveSelectedShapes()
 {
     UIThreadExecutor.Execute(() =>
     {
         FunctionalTestExtensions.GetRibbonUi().OnAction(
             new RibbonControl("AddShape"));
     });
 }
Exemple #4
0
        public List <ISlideData> FetchPresentationData(string pathToPresentation)
        {
            Presentation presentation = FunctionalTestExtensions.GetPresentations().Open(pathToPresentation,
                                                                                         WithWindow: MsoTriState.msoFalse);
            List <ISlideData> slideData = presentation.Slides.Cast <Slide>().Select(SlideData.FromSlide).ToList();

            presentation.Close();
            return(slideData);
        }
Exemple #5
0
        public FileInfo ExportSelectedShapes()
        {
            ShapeRange shapes   = FunctionalTestExtensions.GetCurrentSelection().ShapeRange;
            int        hashCode = DateTime.Now.GetHashCode();
            string     pathName = TempPath.GetTempTestFolder() + "shapeName" + hashCode;

            shapes.Export(pathName, PpShapeFormat.ppShapeFormatPNG);
            return(new FileInfo(pathName));
        }
Exemple #6
0
 public void OpenPane()
 {
     UIThreadExecutor.Execute((Action)(() =>
     {
         FunctionalTestExtensions.GetRibbonUi().OnAction(
             new RibbonControl(TimerLabText.PaneTag));
         _pane = FunctionalTestExtensions.GetTaskPane(
             typeof(TimerPane)).Control as TimerPane;
     }));
 }
Exemple #7
0
 public void OpenPane()
 {
     UIThreadExecutor.Execute(() =>
     {
         FunctionalTestExtensions.GetRibbonUi().CustomShapeButtonClick(
             new RibbonControl("ShapesLab"));
         _pane = FunctionalTestExtensions.GetTaskPane(
             typeof(CustomShapePane)).Control as CustomShapePane;
     });
 }
        public string SelectTextInShape(string shapeName, int startIndex, int endIndex)
        {
            Shape shape = FunctionalTestExtensions.GetCurrentSlide().Shapes
                          .Cast <Shape>()
                          .FirstOrDefault(sh => sh.Name == shapeName);
            TextRange2 textRange = shape.TextFrame2.TextRange.Characters[startIndex, endIndex - startIndex];

            textRange.Select();
            return(textRange.Text);
        }
Exemple #9
0
 public void OpenPane()
 {
     UIThreadExecutor.Execute(() =>
     {
         FunctionalTestExtensions.GetRibbonUi().OnAction(
             new RibbonControl("ColorsLabButton"));
         _pane = FunctionalTestExtensions.GetTaskPane(
             typeof(ColorPane)).Control as ColorPane;
     });
 }
Exemple #10
0
        public string SelectAllTextInShape(string shapeName)
        {
            Shape shape = FunctionalTestExtensions.GetCurrentSlide().Shapes
                          .Cast <Shape>()
                          .FirstOrDefault(sh => sh.Name == shapeName);
            TextRange2 textRange = shape.TextFrame2.TextRange;

            textRange.Select();
            return(textRange.Text);
        }
 public void OpenPane()
 {
     UIThreadExecutor.Execute(() =>
     {
         FunctionalTestExtensions.GetRibbonUi().OnAction(
             new RibbonControl(ShapesLabText.PaneTag));
         _pane = FunctionalTestExtensions.GetTaskPane(
             typeof(CustomShapePane)).Control as CustomShapePane;
     });
     _pane?.InitCustomShapePaneStorage();
 }
Exemple #12
0
        public ShapeRange SelectShapes(IEnumerable <string> shapeNames)
        {
            ShapeRange range = FunctionalTestExtensions.GetCurrentSlide().Shapes.Range(shapeNames.ToArray());

            if (range.Count > 0)
            {
                range.Select();
                return(range);
            }
            return(null);
        }
Exemple #13
0
        public void SetTagToAssociatedWindow()
        {
            DocumentWindow docWindow = FunctionalTestExtensions.GetCurrentWindow();

            foreach (Microsoft.Office.Tools.CustomTaskPane pane in FunctionalTestExtensions.GetAddIn().CustomTaskPanes)
            {
                if (pane.Control.Tag == null)
                {
                    pane.Control.Tag = docWindow.HWND;
                }
            }
        }
Exemple #14
0
        public HashSet <Type> GetOpenPaneTypes()
        {
            DocumentWindow docWindow = FunctionalTestExtensions.GetCurrentWindow(); //.GetApplication().Windows[1];
            HashSet <Type> result    = new HashSet <Type>();

            foreach (Microsoft.Office.Tools.CustomTaskPane pane in FunctionalTestExtensions.GetAddIn().CustomTaskPanes)
            {
                if (pane.Control.Tag is int && (int)pane.Control.Tag == docWindow.HWND)
                {
                    result.Add(pane.Control.GetType());
                }
            }
            return(result);
        }
Exemple #15
0
        public ShapeRange SelectShapesByPrefix(string prefix)
        {
            var nameList = new List <String>();
            var shapes   = FunctionalTestExtensions.GetCurrentSlide().Shapes;

            foreach (Shape sh in shapes)
            {
                if (sh.Name.StartsWith(prefix))
                {
                    nameList.Add(sh.Name);
                }
            }
            return(SelectShapes(nameList));
        }
Exemple #16
0
        public ShapeRange SelectShapesByPrefix(string prefix)
        {
            List <string> nameList = new List <String>();

            Microsoft.Office.Interop.PowerPoint.Shapes shapes = FunctionalTestExtensions.GetCurrentSlide().Shapes;
            foreach (Shape sh in shapes)
            {
                if (sh.Name.StartsWith(prefix))
                {
                    nameList.Add(sh.Name);
                }
            }
            return(SelectShapes(nameList));
        }
Exemple #17
0
        public ShapeRange SelectShape(string shapeName)
        {
            var nameList = new List <String>();
            var shapes   = FunctionalTestExtensions.GetCurrentSlide().Shapes;

            foreach (Shape sh in shapes)
            {
                if (sh.Name == shapeName)
                {
                    nameList.Add(sh.Name);
                    break;
                }
            }
            return(SelectShapes(nameList));
        }
Exemple #18
0
        public Slide SelectSlide(int index)
        {
            var slides = FunctionalTestExtensions.GetCurrentPresentation().Slides;

            for (int i = 0; i <= slides.Count; i++)
            {
                if (i == (index - 1))
                {
                    var slide = slides[i].GetNativeSlide();
                    slide.Select();
                    FunctionalTestExtensions.GetCurrentWindow().View.GotoSlide(index);
                    return(slide);
                }
            }
            return(null);
        }
Exemple #19
0
        public Slide SelectSlide(string slideName)
        {
            List <Models.PowerPointSlide> slides = FunctionalTestExtensions.GetCurrentPresentation().Slides;

            for (int i = 0; i <= slides.Count; i++)
            {
                if (slideName == slides[i].Name)
                {
                    Slide slide = slides[i].GetNativeSlide();
                    slide.Select();
                    FunctionalTestExtensions.GetCurrentWindow().View.GotoSlide(i + 1);
                    return(slide);
                }
            }
            return(null);
        }
Exemple #20
0
 public Slide[] GetAllSlides()
 {
     return(FunctionalTestExtensions.GetCurrentPresentation().Presentation.Slides.Cast <Slide>().ToArray());
 }
Exemple #21
0
 public void DeleteSection(int index, bool deleteSlides)
 {
     FunctionalTestExtensions.GetCurrentPresentation().SectionProperties.Delete(index, deleteSlides);
 }
Exemple #22
0
 public Slide GetCurrentSlide()
 {
     return(FunctionalTestExtensions.GetCurrentSlide().GetNativeSlide());
 }
Exemple #23
0
 public bool IsOffice2013()
 {
     return(FunctionalTestExtensions.GetApplication().Version == "15.0");
 }
Exemple #24
0
 public void RenameSection(int index, string newName)
 {
     FunctionalTestExtensions.GetCurrentPresentation().SectionProperties.Rename(index, newName);
 }
Exemple #25
0
 public void MaximizeWindow()
 {
     FunctionalTestExtensions.GetCurrentWindow().WindowState = PpWindowState.ppWindowMaximized;
 }
Exemple #26
0
 public int GetNumWindows()
 {
     return(FunctionalTestExtensions.GetApplication().Windows.Count);
 }
Exemple #27
0
 public void NewWindow()
 {
     Presentation presentation = FunctionalTestExtensions.GetPresentations().Add();
 }
Exemple #28
0
 public void MaximizeWindow(int windowNumber)
 {
     FunctionalTestExtensions.GetApplication().Windows[windowNumber].Activate();
     FunctionalTestExtensions.GetApplication().Windows[windowNumber].WindowState = PpWindowState.ppWindowMaximized;
 }
Exemple #29
0
 public Selection GetCurrentSelection()
 {
     return(FunctionalTestExtensions.GetCurrentSelection());
 }
Exemple #30
0
 public void AddSection(int index, string sectionName)
 {
     FunctionalTestExtensions.GetCurrentPresentation().SectionProperties.AddSection(index, sectionName);
 }