Forum Discussion

NThomas's avatar
NThomas
Occasional Contributor
10 years ago

Component offset from the visual

Hello !

 

I just created a new project to test the TC Mobile module 10.
Everything works properly (installation, smartphone emulation, ...).

 

I just have a problem, because when I use object spy, components are not in the same location as visually.

 

example: In the Object Browser:
Aliases.Device.Desktop.Height = 1280
Aliases.Device.Desktop.Width = 720

This is the size of the screen => ok

 

Then I process my application and the first component "RootLayout"
Aliases.Device.Process ("My application"). RootLayout.Height = 1138
Aliases.Device.Process ("My application"). RootLayout.Width = 640

 

When I make a Highlight on Screen on the component, I have a rectangle but it is smaller than the application.
All components within are also affected.

 

You had this problem?

 

Thank you.
Nicolas

 

PS: I apologize if I made mistakes, I try to improve my English.

  • NThomas's avatar
    NThomas
    10 years ago

    Hello,


    I found a solution by taking the width and height of the smartphone and I divisie to the width and height of the application to give me a zoom factor :

     

    var oMobile = Mobile.Device("RAINBOW");
    var oRootLayout = oMobile.FindChild('ObjectType', 'RootLayout', 5);
        
    var iCoefHeight = oMobile.Desktop.Height / oRootLayout.Height;
    var iCoefWidth = oMobile.Desktop.Width / oRootLayout.Width;

    I look for the component and a variable, I store the new X and Y coordinates by adding the zoom factor to click in the middle of the component :

     

    var oComponent = oRootLayout.FindChild(new Array('ObjectType', 'textContent'), new Array('TextNode', "Démarrer l'application"), 50);
    
    var iComponentCoordinateX = (oComponent.ScreenLeft * iCoefWidth) + ((oComponent.Width * iCoefWidth) / 2); 
    var iComponentCoordinateY = (oComponent.ScreenTop * iCoefHeight) + ((oComponent.Height * iCoefHeight) / 2);

    Then I click on the mobile to coordinated X and Y found :

     

    oMobile.Touch(iComponentCoordinateX, iComponentCoordinateY);

    Here is a solution if you ever have the problem.


    Tanya thank you for your help.

     

    Have a great day.

    Nicolas

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Nicolas,

     

    It’s ok that the size of the layout of your application is smaller when the screen size. Let me clarify one thing: when you say the rectangle is smaller than the application, do you highlight a separate object (for example, a text box or label) inside the app?

    • NThomas's avatar
      NThomas
      Occasional Contributor

      Hi Tanya,

       

      Thank you for your reply.

       

      Here is a montage to show you the problem :

       

      Geofolia_withTC.png

       

      HighlightObject that we see on the appplication Smartphone is the RootLayout object in the Object Browser.
      We can see that does not match the visual of appplication.

       

      I asked our developers, they told me that the size of the components were fixed, the Smartphone resizes the components according to the size of the screen.

       

      I ask you the question about whether you have had the problem and determine if it is a TestComplete parameterization problem, the Android SDK or our application?

       

      Good day.

      Nicolas

      • TanyaYatskovska's avatar
        TanyaYatskovska
        SmartBear Alumni (Retired)

        Hi Nicolas,

         

        The behavior you observe is very strange. Is there a way our Support Team can get a copy of the tested application to reproduce and investigate the problem in their lab (they can sign an NDA if necessary)? Please contact them via our Contact Support form ( http://support.smartbear.com/product-list/ ).