ZoomIn Method (Android Controls)

Applies to TestComplete 15.63, last modified on April 10, 2024
This method is available in legacy mobile tests that work with devices connected to the local computer. To learn how to simulate user actions in newer cloud-compatible mobile tests, see the Simulating user actions in tests section.

Description

The ZoomIn method simulates the specified number of touches on the Zoom In button of the zoom control in an Android application.

Declaration

TestObj.ZoomIn(Count)

TestObj A variable, parameter or expression that specifies a reference to one of the objects listed in the Applies To section
Count [in]    Optional    Integer Default value: 1   
Result None

Applies To

The method is applied to the following object:

View Mode

This method is available in the Object Browser panel and in other panels and dialogs in both Basic and Advanced view modes.

Parameters

The method has the following parameter:

Count

An integer value that specifies the number of touches to be simulated.

Result Value

None.

Example

The following example demonstrates how to simulate zooming in and zooming out in an Android application:

JavaScript, JScript

function Test()
{
  // Select the Android device
  Mobile.SetCurrent("MyDevice");
  
  // Obtain Zoom controls
  var p = Mobile.Device().Process("com.example.myapp");
  var v = p.RootLayout("").Layout("layoutTop").ScrollView("VerticalScrollView1");
  var Zoom = v.Layout("layout2").ZoomControls("zoomControls1");
  
  // Simulate zooming in
  Zoom.ZoomIn();
  
  // Simulate zooming out
  Zoom.ZoomOut();
}

Python

def Test():
  # Select the Android device
  Mobile.SetCurrent("MyDevice")
  
  # Obtain Zoom controls
  p = Mobile.Device().Process("com.example.myapp")
  v = p.RootLayout("").Layout("layoutTop").ScrollView("VerticalScrollView1")
  Zoom = v.Layout("layout2").ZoomControls("zoomControls1")
  
  # Simulate zooming in
  Zoom.ZoomIn()
  
  # Simulate zooming out
  Zoom.ZoomOut()

VBScript

Sub Test()
  ' Select the Android device
  Call Mobile.SetCurrent("MyDevice")
  
  ' Obtain Zoom controls
  Set p = Mobile.Device.Process("com.example.myapp")
  Set v = p.RootLayout("").Layout("layoutTop").ScrollView("VerticalScrollView1")
  Set Zoom = v.Layout("layout2").ZoomControls("zoomControls1")
  
  ' Simulate zooming in
  Zoom.ZoomIn()
  
  ' Simulate zooming out
  Zoom.ZoomOut()
End Sub

DelphiScript

procedure Test();
var 
  p, v, Zoom : OleVariant;
begin
  // Select the Android device
  Mobile.SetCurrent('MyDevice');
  
  // Obtain Zoom controls object
  p := Mobile.Device.Process('com.example.myapp');
  v := p.RootLayout('').Layout('layoutTop').ScrollView('VerticalScrollView1');
  Zoom := v.Layout('layout2').ZoomControls('zoomControls1');
  
  // Simulate zooming in
  Zoom.ZoomIn();
  
  // Simulate zooming out
  Zoom.ZoomOut();
end;

C++Script, C#Script

function Test()
{
  // Select the Android device
  Mobile["SetCurrent"]("MyDevice");
  
  // Obtain Zoom controls object
  var p = Mobile["Device"].Process("com.example.myapp");
  var v = p["RootLayout"]("")["Layout"]("layoutTop")["ScrollView"]("VerticalScrollView1");
  var Zoom = v["Layout"]("layout2")["ZoomControls"]("zoomControls1");
  
  // Simulate zooming in
  Zoom["ZoomIn"]();
  
  // Simulate zooming out
  Zoom["ZoomOut"]();
}

See Also

About Testing Android Applications (Legacy)
Zooming In and Out Zoom Controls
ZoomOut Method (Android Controls)
Touch Action (Mobile Objects)

Highlight search results