summaryrefslogtreecommitdiff
path: root/testautomation/framework/tools/includes/performance.inc
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2008-12-09 12:50:33 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2008-12-09 12:50:33 +0000
commit5b3d1058ef692cd3ed555161a2032dc74d679c99 (patch)
tree623c0b2f6cf577f4f9caa08a40b96c9406179abc /testautomation/framework/tools/includes/performance.inc
parentda4fff6adad15b82547523887a946f21cff27921 (diff)
CWS-TOOLING: integrate CWS sjfixes11_DEV300
Diffstat (limited to 'testautomation/framework/tools/includes/performance.inc')
-rwxr-xr-xtestautomation/framework/tools/includes/performance.inc107
1 files changed, 22 insertions, 85 deletions
diff --git a/testautomation/framework/tools/includes/performance.inc b/testautomation/framework/tools/includes/performance.inc
index 44734517c937..18fd01332be1 100755
--- a/testautomation/framework/tools/includes/performance.inc
+++ b/testautomation/framework/tools/includes/performance.inc
@@ -39,94 +39,31 @@
function hWaitForObject( oControl as object, iTime as integer ) as integer
-
- '///<h3>Wait for a control to get ready</h3>
- '///<i>Wait for a control on a toolbar to get ready for a specified amount
- '///+ of time. Note that this function runs silent, you have to test the
- '///+ return value!</i><br><br>
-
- '///<u>Parameter(s):</u><br>
- '///<ol>
-
- '///+<li>The control to wait for (Object)</li>
- '///<ul>
- '///+<li>Kontext must be set prior to using this function</li>
- '///+<li>The control must exist</li>
- '///+<li>This function works on most, but not all, controls</li>
- '///</ul>
-
- '///+<li>Maximum time to wait in milliseconds (Integer)</li>
- '///<ul>
- '///+<li>Must be &gt; 0</li>
- '///+<li>Must be &le; 10000 ms (10 seconds)</li>
- '///</ul>
-
- '///</ol>
-
-
- '///<u>Returns:</u><br>
- '///<ol>
- '///+<li>Time to readiness in milliseconds(Integer)</li>
- '///<ul>
- '///+<li>-1: Control not ready within given timeframe</li>
- '///+<li>-2: Control appears not to exist</li>
- '///+<li>-&ge; 0: Time to readiness </li>
- '///</ul>
- '///</ol>
-
- const MAX_WAIT = 10000
- const CFN = "hWaitForObject::"
-
- dim _time as integer
- dim _loop as integer
- dim _name as string
- dim _wait as integer
+ const CFN = "hWaitForObject()::"
+ dim iWait as integer
- _name = oControl.name()
-
-
- '///<u>Description:</u>
- '///<ul>
- '///+<li>Verify function parameter validity</li>
- if ( iTime > MAX_WAIT ) then
- _time = MAX_WAIT
- else
- _time = iTime
- endif
-
- '///+<li>Override timeout</li>
- if ( iTime < 0 ) then
- _wait = abs( iTime )
- printlog( CFN & "<" & _name & " Timeout overridden: " & _wait & " ms" )
- else
- _wait = MAX_WAIT
- endif
-
- '///+<li>Verify that the control exists and wait</li>
- _loop = 0
- if ( oControl.exists() ) then
- do while( not oControl.isEnabled() )
- _loop = _loop + 1
- wait( 1 )
- if ( _loop = MAX_WAIT ) then
- qaerrorlog( CFN & "Timeout reached. Exiting." )
+ for iWait = 0 to iTime
+ try
+ oControl.Exists()
+ printlog( CFN & "Control Name....: " & oControl.Name() )
+ printlog( CFN & "Control ID......: " & oControl.ID() )
+ printlog( CFN & "Control ready in: " & iWait & " ms")
+
+ if ( oControl.isEnabled() ) then
+ printlog( CFN & "Control enabled.: Yes" )
+ hWaitForObject() = 0
+ else
+ printlog( CFN & "Control enabled.: No" )
hWaitForObject() = -1
- exit function
endif
- loop
-
- ' We get here when all went well.
- printlog( CFN & "Object was enabled within " & _loop & " milliseconds" )
- hWaitForObject() = _loop
-
- else
- ' This message might appear but can - under certain conditions - be
- ' incorrect. Some toolbars simply do not react to the .exists() method.
- printlog( CFN & "Non existing control. Exiting." )
- hWaitForObject() = -2
- exit function
- endif
- '///</ul>
+ exit function
+ catch
+ wait( 1 )
+ endcatch
+ next iWait
+
+ hWaitForObject() = -2
+ printlog( CFN & "Control not found, timeout reached" )
end function