File: TestFontUtils.java

package info (click to toggle)
libjide-oss-java 3.7.6%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,444 kB
  • sloc: java: 91,177; xml: 661; makefile: 35
file content (30 lines) | stat: -rw-r--r-- 816 bytes parent folder | download | duplicates (5)
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());
    }
}