Kaydet (Commit) a9cf50c2 authored tarafından Michael Meeks's avatar Michael Meeks

junit: make tests robust by compensating for intermittent sizing race.

üst ab683542
......@@ -477,15 +477,21 @@ public class _XAccessibleComponent extends MultiMethodTest {
public void _getSize() {
requiredMethod("getBounds()");
boolean result = true;
boolean result = false;
Size size = oObj.getSize();
result &= (size.Width == bounds.Width);
result &= (size.Height == bounds.Height);
if (!result) {
log.println(
"bounds " + bounds.Width + "x" + bounds.Height + " vs. size "
+ size.Width + "x" + size.Height);
for (int i = 0; i < 2 && !result; i++)
{
result = true;
result &= (size.Width == bounds.Width);
result &= (size.Height == bounds.Height);
if (!result) {
log.println( "potential race bounds " + bounds.Width + "x" + bounds.Height +
" vs. size " + size.Width + "x" + size.Height);
// Possibily we hit a race condition and it re-sized (?) ...
bounds = oObj.getBounds();
size = oObj.getSize();
}
}
tRes.tested("getSize()", result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment