1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
/*
* @(#)TestFontUtils.java 9/9/2009
*
* Copyright 2002 - 2009 JIDE Software Inc. All rights reserved.
*/
package com.jidesoft.utils;
import com.jidesoft.swing.FontUtils;
import junit.framework.TestCase;
import javax.swing.*;
import java.awt.*;
public class TestFontUtils extends TestCase {
public void testAddFont() {
Font font = UIManager.getFont("Label.font");
for (int i = 0; i < 100; i++) {
FontUtils.getCachedDerivedFont(font, Font.BOLD, 4 + i);
}
assertEquals(100, FontUtils.getDerivedFontCacheSize());
try {
byte[] block = new byte[200 * 1024 * 1024];
}
catch (OutOfMemoryError ex) {
// ignore
}
assertEquals(0, FontUtils.getDerivedFontCacheSize());
}
}
|