Forum Discussion

mirunik_tym's avatar
mirunik_tym
New Contributor
10 years ago
Solved

testing changes - object from a PowerPoint slide

Hello.I need to test if my app changes the shape and position of an object from a PowerPoint Presentation slide.How can I do that using TestComplete? Thanks.
  • Hi



    Is it possible that you can use the 'Point and Fix (Ctrl+Shift+A)' method in the Object Spy.  This will allow you to use PowerPoint to right-click on an object within a slide and select context menu options from which you can then highlight a field value then use Ctrl+Shift+A to see the properties.  For example, I was able to obtain a wText value of 5.89cm for a Height field, being one of the properties of an object on a slide.



    Regards

    Stephen.

5 Replies

  • sbkeenan's avatar
    sbkeenan
    Frequent Contributor
    Hi



    Is it possible that you can use the 'Point and Fix (Ctrl+Shift+A)' method in the Object Spy.  This will allow you to use PowerPoint to right-click on an object within a slide and select context menu options from which you can then highlight a field value then use Ctrl+Shift+A to see the properties.  For example, I was able to obtain a wText value of 5.89cm for a Height field, being one of the properties of an object on a slide.



    Regards

    Stephen.
  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)
    Hi Miru,



    You can also use PowerPoint's COM object, PowerPoint.Application, to get data from the slides including shape type and coordinates. To access a specific Shape object, you can use the ActivePresentation.Slides(index).Shapes(index) property of the PowerPoint.Application object. Here's an example:



    // JScript

    function Test()

    {

      var ppt = Sys.OleObject("PowerPoint.Application");

      ppt.Visible = true;

      var presentation = ppt.Presentations.Open("C:\\Presentations\\Sample.pptx");



      var shape = presentation.Slides(1).Shapes(1); // Note: indexes start from 1, not 0



      Log.Message("Type: " + shape.Type);

      Log.Message("Top: " + shape.Top);

      Log.Message("Left: " + shape.Left);

    }



    The Shape.Type property returns a number. To learn which share type this number corresponds to, do the following:


    • Launch PowerPoint.


    • Press Alt+F11. This will open the VBA editor.


    • Select View > Object Browser from the main menu.


    • Select MsoShapeType on the list on the left.


    • Click constant names - you'll see their values in the bottom pane.




    References:

    PowerPoint object model reference

    Shape object
  • sbkeenan's avatar
    sbkeenan
    Frequent Contributor


    Hi



    I've never worked with PowerPoint and TestComplete before and an initial test shows that I can only see the slide via the Object Spy and not any of its components.  Is it an option for you to obtain a region checkpoint of how the slide should look after the alterations?  If so, you could then do region comparison, which will show in the log file either as having passed or failed.



    Regards

    Stephen.


  • Hi :) no,can't do that because I need to know that a certain property of the object has been changed and in a region checkpoint that's not possible,right?Somehow, I need to reffer directly to that objects' property...somehow :|