SQABasic "HTMLImageFunctions" Script
MODULE DESCRIPTION:
Routines and utilities to work on SQA Type=HTMLImage objects in
Data-Driven Automation.
Action Commands
Global Variables
Routine Details
User Dependencies:
(stuff the developer's library/script $INCLUDES at compile time.)
(Note: The order of items may matter and may be different for your code.)
Internal Dependencies:
(stuff this library needs at compile time.)
DDE Action Commands
SUPPORTED ACTION COMMANDS:
VerifyHTMLImage 'verify an image within the html to a benchmark file
SaveHTMLImage 'saves an HTML image within the html
Globals
(none)
Routine Details
Sub VerifyHTMLImage()
DESCRIPTION:
Attempts to rightclick and save an HTMLimage and then perform a binary compare
with a benchmark file.
This command supports the "TW" record type when the user has configured
a diff tool for which we have no means to automatically verify the results.
The command may produce a WARNING if such a tool is configured and used.
The routine expects that the given object already has Context or Focus.
It also expects that Global StepDriverTestInfo contains all the information
it needs to perform its function.
For records with the optional Coordinate provided:
The coordinate lookup is done with the component name of the record AND
the provided reference in Field #6.
Typical Data Table records:
===========================
(1) t Window MyImage VerifyHTMLImage ^bench="Image.jpg"
(2) t Window MyImage VerifyHTMLImage ^bench="\SomeRelativePath\Image.jpg" ^rightclick="Coords=5,20"
(3) t Window MyImage VerifyHTMLImage ^bench="c:\Image.jpg" ^rightclick="Center"
===========================
#1 uses default coordinates and a benchmark file in \Datapool\Bench
#2 uses provided coordinates and a benchmark file stored in a relative path
found via FindSQAFile.
#3 uses coordinates stored in the App Map in a "Center" entry in the "[MyImage]"
section like below. The record also specifies an explicit full path to the
desired benchmark file.
[Window]
Window="Type=Window;...."
MyImage="Type=HTMLImage;...."
....
[MyImage]
Center="10,10"
BottomRight="Coords=18,18"
....
This will tell Robot to locate the MyList object and click at the coordinates
specified by the reference.
DATA TABLE PARAMETERS:
FLD CONTENT
--- ------------------------------
5 Benchmark filename for binary comparison.
[6] Optional coordinates, or App Map reference to coordinates to right click.
ERRORS:
none
Orig Author: Jack Imbriani
Orig Date: DEC 10, 2002
History:
DEC 10, 2002 Original Release
DEC 16, 2002 (CANAGL) Enhanced for broader Coordinate-based support.
AUG 18, 2003 (CANAGL) Mod to allow alternate file comparator tools.
Sub SaveHTMLImage()
DESCRIPTION:
Attempts to rightclick and save an HTMLimage.
The routine expects that the given object already has Context or Focus.
It also expects that Global StepDriverTestInfo contains all the information
it needs to perform its function.
Typical Data Table records:
===========================
(1) t Window MyImage SaveHTMLImage ^filename="Image.jpg"
(2) t Window MyImage SaveHTMLImage ^filename="C:\Image.jpg" ^xy="25,25"
(3) t Window MyImage SaveHTMLImage ^filename="images\Image.jpg" ^xy="TopRight"
===========================
#1 saves the image to the project's Datapool\Test directory.
#2 saves the image to the explicit path provided. Right click on the image at
coordinates 25,25 instead of the default coordinates to expose the menu.
#3 saves the image to the images subdirectory off of the project's
root directory. Right click on the image at the coordinates specified in the
app map under MyImage defined as TopRight.
Sample App Map:
[Window]
Window="Type=Window;...."
MyImage="Type=HTMLImage;...."
....
[MyImage]
TopRight="50,10"
Center="25,25"
BottomRight="Coords=50,40"
....
DATA TABLE PARAMETERS:
FLD CONTENT
--- ------------------------------
5 (Required) Image filename.
A simple filename with no path info, a filename with relative
path info, or a full filename path.
[6] Optional coordinates, or App Map reference to coordinates to right click.
ERRORS:
none
Orig Author: Bill Nasuti (winasu)
Orig Date: MAR 20,2003
History:
MAR 20, 2003 Original Release
MAR 25, 2003 (CANAGL) Added relative path and optional coords capabilities.
Sub Main ()
DESCRIPTION:
Entry point to process a StepDriver ACTION COMMAND on a HTMLImage.
The routine merely reads the Global StepDriverTestInfo.testcommand and
calls the appropriate subroutine to process it.
If the testcommand is unrecognized it will log a WARNING_MESSAGE and
exit with a WARNING status.
DATA TABLE PARAMETERS:
none - the called subroutine has the requirements
ERRORS:
none
Orig Author: Carl Nagle
Orig Date: JUL 15, 2000
History:
JUL 15, 2000 Original Release
OCT 17, 2002 (CANAGL) Reroute fallback to GenericObjectFunctions.
OCT 22, 2002 (CANAGL) Warn of unimplemented TF and TW record types.
DEC 10, 2002 (jaimbr) Added VerifyHTMLImage.
DEC 12, 2002 (CANAGL) Added support for XSLComponentActions.MAP
MAR 20, 2003 (winasu) Added SaveHTMLImage.
OCT 14, 2005 (CANAGL) CLICK defaulting to GenericObjectFunctions.
CompareStoredData and Properties in GenericObjectFunctions
Copyright (C) SAS Institute
GNU General Public License: http://www.opensource.org/licenses/gpl-license.php
==============================================================================