/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* <p>This class contains utilities useful for regression testing.
* <p>When using jtreg you would include this class via something like:
* <pre>
*
* @library ../../regtesthelpers
* @build Util
* </pre>
*/
public class Util {
/**
* Convert a rectangle from coordinate system of Component c to
* screen coordinate system.
*
* @param r a non-null Rectangle
* @param c a Component whose coordinate system is used for conversion
*/
r.x = p.x;
r.y = p.y;
}
/**
* Compares two bufferedImages pixel-by-pixel.
* return true if all pixels in the two areas are identical
*/
public static boolean compareBufferedImages(BufferedImage bufferedImage0, BufferedImage bufferedImage1) {
return false;
}
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
return false;
}
}
}
return true;
}
/**
* Fills the heap until OutOfMemoryError occurs. This method is useful for
* WeakReferences removing.
*/
public static void generateOOME() {
boolean oome = false;
try {
for(int i = 0; true ; i++) {
// Now, use up all RAM
// Give the GC a change at that weakref
if (i % 10 == 0) {
try {
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
} catch (OutOfMemoryError e) {
oome = true;
}
if (!oome) {
throw new RuntimeException("Problem with test case - never got OOME");
}
}
/**
* Find a sub component by class name.
* Always run this method on the EDT thread
*/
return parent;
}
if (subComponent != null) {
return subComponent;
}
}
}
return null;
}
/**
* Hits mnemonics by robot.
*/
}
}
}
/**
* Gets key codes from system mnemonic key mask
* @return key codes list
*/
}
/**
* Gets the key codes list from modifiers
* @param modifiers an integer combination of the modifier constants
* @return key codes list
*/
}
}
}
}
return result;
}
/**
* Hits keys by robot.
*/
}
}
}
/**
* Invokes the <code>task</code> on the EDT thread.
*
* @return result of the <code>task</code>
*/
public void run() {
try {
} catch (Exception e) {
exception[0] = e;
}
}
});
throw exception[0];
}
}
}