sub FindInHorizontalRegion
{
print "Inside FindInHorizontalRegion";
my ( $self,$element1,$element2,$duration,$threshold) = @_;
my ($xcoord1,$ycoord1, $xcoord2, $ycoord2);
my $regex1 = '(.*?)\:(.*?)';
print "Damn the element1 is $element1 \n";
if ( $element1 =~ m/$regex1/g )
{
print "Inside wait for image \n";
my $region = $self->WaitForImage( $element1, $duration );
$xcoord1 = $region->getX;
$ycoord1 = $region->getY;
print "The coordinates of element1 are $xcoord1, $ycoord1 \n";
}
else
{
print "Inside wait for Text \n";
my $region = $self->WaitForText( $element1, $duration );
$xcoord1 = $region->getX;
$ycoord1 = $region->getY;
print "The coordinates of element1 are $xcoord1, $ycoord1 \n";
}
if ( $element2 =~ m/$regex1/g )
{
my $region = $self->WaitForImage( $element2, $duration );
$xcoord2 = $region->getX;
$ycoord2 = $region->getY;
print "The coordinates of element2 are $xcoord1, $ycoord1 \n";
}
else
{
my $region = $self->WaitForText( $element2, $duration );
$xcoord2 = $region->getX;
$ycoord2 = $region->getY;
print "The coordinates of element2 are $xcoord1, $ycoord1 \n";
}
my ($x1,$y1,$x2,$y2) = $self->GetHorizontalCoord($xcoord1,$ycoord1,$xcoord2,$ycoord2,$threshold);
print "The horizontal coordinates are $x1,$y1,$x2,$y2 \n";
print "The element1 is $element1 \n";
if ( $element1 =~ m/$regex1/g )
{
print "To check for iImage";
my $region = $self->WaitForImageInROI($element1,$x1,$y1,$x2,$y2,$duration);
return ($region);
}
else
{
print "To check for tText";
my $region = $self->WaitForTextInROI($element1,$x1,$y1,$x2,$y2,$duration);
return ($region);
}
}
sub GetHorizontalCoord
{
print "Inside GetHorizontalCoord";
my ( $self,$xcoord1,$ycoord1,$xcoord2,$ycoord2,$threshold ) = @_;
my $width = $self->GetDeviceProperty('Width');
my $height = $self->GetDeviceProperty('Height');
my $x1 = 0;
my $x2 = $width;
my $y1 = $ycoord1 - $threshold ;
if ($y1<0)
{
$y1 = 0;
}
my $y2 = $ycoord2 + $threshold;
if ($y2 > $height)
{
$y2 = $height;
}
return ($x1,$x2,$y1,$y2);
}
####
my $region = $object->FindInHorizontalRegion('SETTINGS:Flight','SETTINGS:Tick','1000',10);
####
my ($x1,$y1,$x2,$y2) = $self->GetHorizontalCoord($xcoord1,$ycoord1,$xcoord2,$ycoord2,$threshold);
print "The horizontal coordinates are $x1,$y1,$x2,$y2 \n";
print "The element1 is $element1 \n";
if ( $element1 =~ m/$regex1/g )
{
print "To check for iImage";
my $region = $self->WaitForImageInROI($element1,$x1,$y1,$x2,$y2,$duration);
return ($region);
}
else
{
print "To check for tText";
my $region = $self->WaitForTextInROI($element1,$x1,$y1,$x2,$y2,$duration);
return ($region);
}