MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / main

Method main

src/test/Test_Font.java:23–50  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

21 */
22public class Test_Font {//extends Test_ {
23 public static void main(String[] args) {
24
25 JLabel c = new JLabel("testing");
26 Graphics2D g = (Graphics2D) c.getGraphics();
27 assert (g == null);
28 JFrame f = new JFrame();
29 g = (Graphics2D) f.getGraphics();
30 assert (g == null);
31 f.pack();
32 g = (Graphics2D) f.getGraphics();
33 assert (g != null);
34 FontRenderContext frc = g.getFontRenderContext();
35 System.out.println(c.getFont().getStringBounds("testing", frc));
36 FontMetrics gfm = g.getFontMetrics();
37 int a = gfm.getAscent();
38 System.out.println("ffm " + " A=" + a + " D=" + gfm.getDescent() + " =" + gfm.getHeight());
39 g.dispose();
40
41
42 for (int i = 0; i < 1; i++) {
43 test(frc, Font.DIALOG, i);
44// test(frc, Font.SERIF, i);
45// test(frc, Font.SANS_SERIF, i);
46 }
47
48 System.out.println("Test_Font OK");
49 System.exit(0);
50 }
51 private static void test(FontRenderContext frc, String name, int style) {
52 for (int i = 6 ; i < 50; i++) {
53 show(frc, name, style, i);

Callers

nothing calls this directly

Calls 11

testMethod · 0.95
getFontRenderContextMethod · 0.80
getStringBoundsMethod · 0.80
printlnMethod · 0.65
getFontMethod · 0.65
getHeightMethod · 0.65
disposeMethod · 0.65
getFontMetricsMethod · 0.45
getAscentMethod · 0.45
getDescentMethod · 0.45
exitMethod · 0.45

Tested by

no test coverage detected