Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.tools;
|
---|
3 |
|
---|
4 | import static org.junit.jupiter.api.Assertions.fail;
|
---|
5 |
|
---|
6 | import java.awt.Font;
|
---|
7 | import java.awt.GraphicsEnvironment;
|
---|
8 |
|
---|
9 | import org.junit.jupiter.api.extension.RegisterExtension;
|
---|
10 | import org.junit.jupiter.api.Test;
|
---|
11 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
12 |
|
---|
13 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
14 | import net.trajano.commons.testing.UtilityClassTestUtil;
|
---|
15 |
|
---|
16 | /**
|
---|
17 | * Unit tests of {@link FontsManager} class.
|
---|
18 | */
|
---|
19 | class FontsManagerTest {
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * Setup test.
|
---|
23 | */
|
---|
24 | @RegisterExtension
|
---|
25 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
26 | public JOSMTestRules test = new JOSMTestRules();
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Test method for {@code FontsManager#initialize}
|
---|
30 | */
|
---|
31 | @Test
|
---|
32 | void testFontsManager() {
|
---|
33 | FontsManager.initialize();
|
---|
34 | boolean found = false;
|
---|
35 | for (Font f : GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts()) {
|
---|
36 | if (f.getName().contains("Droid")) {
|
---|
37 | System.out.println(f);
|
---|
38 | found = true;
|
---|
39 | }
|
---|
40 | }
|
---|
41 | if (!found) {
|
---|
42 | fail("DroidSans font not found");
|
---|
43 | }
|
---|
44 | }
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * Tests that {@code FontsManager} satisfies utility class criteria.
|
---|
48 | * @throws ReflectiveOperationException if an error occurs
|
---|
49 | */
|
---|
50 | @Test
|
---|
51 | void testUtilityClass() throws ReflectiveOperationException {
|
---|
52 | UtilityClassTestUtil.assertUtilityClassWellDefined(FontsManager.class);
|
---|
53 | }
|
---|
54 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.