Skip to content

Commit bb7eee5

Browse files
Ebaron96smarasca5
authored andcommitted
tests for psname and size within PFontTest.java
1 parent 32ef5d5 commit bb7eee5

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed
Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,31 @@
11
package processing.core;
22

3+
import java.awt.Font; //Javas built in font class
4+
import org.junit.Test; //Using Junit4 test implementation
5+
import static org.junit.Assert.assertEquals; //To compare expected vs actual values
6+
37
public class PFontTest {
4-
//this is a new class to see if I can push to my fork
58

9+
@Test
10+
public void getsFontNameCorrectly() {
11+
Font trueFont = new Font("Name", Font.PLAIN, 16);
12+
PFont font = new PFont(trueFont, true, null);
13+
assertEquals("Name", font.getName());
14+
}
15+
16+
17+
@Test
18+
public void test_psname_getCorrectName() {
19+
Font awtFont = new Font("Dialog", Font.PLAIN, 16); //Truth, what PFont size should be
20+
PFont font = new PFont(awtFont, true, null);
21+
assertEquals(awtFont.getPSName(), font.getPostScriptName()); //test, expecting
22+
}
23+
24+
@Test
25+
public void test_size_getCorrectSize() {
26+
Font awtFont = new Font("Dialog", Font.PLAIN, 16); //Truth, what PFont size should be
27+
PFont font = new PFont(awtFont, true, null);
28+
assertEquals(awtFont.getSize(), font.getSize()); //test, expecting
29+
}
630
}
31+

0 commit comments

Comments
 (0)