From 790f2c88a7abb1b2d824077933d48410f7f3926d Mon Sep 17 00:00:00 2001 From: Elijah Baron Date: Mon, 30 Mar 2026 18:38:14 -0400 Subject: [PATCH 1/5] this is just a test --- core/test/processing/core/PFontTest.java | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 core/test/processing/core/PFontTest.java diff --git a/core/test/processing/core/PFontTest.java b/core/test/processing/core/PFontTest.java new file mode 100644 index 000000000..510830e98 --- /dev/null +++ b/core/test/processing/core/PFontTest.java @@ -0,0 +1,4 @@ +package processing.core; + +public class PFontTest { +} From 32ef5d548f3e37da654628c583b1dc5348aaa648 Mon Sep 17 00:00:00 2001 From: Elijah Baron Date: Mon, 30 Mar 2026 18:39:35 -0400 Subject: [PATCH 2/5] more test changes --- core/test/processing/core/PFontTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/test/processing/core/PFontTest.java b/core/test/processing/core/PFontTest.java index 510830e98..c7057ec57 100644 --- a/core/test/processing/core/PFontTest.java +++ b/core/test/processing/core/PFontTest.java @@ -1,4 +1,6 @@ package processing.core; public class PFontTest { + //this is a new class to see if I can push to my fork + } From b03769677e58e49e5b987afbc76328821ed365c4 Mon Sep 17 00:00:00 2001 From: Elijah Baron Date: Mon, 30 Mar 2026 19:09:25 -0400 Subject: [PATCH 3/5] Setup The Test File, Wrote up what should be tested first by chunks. --- core/test/processing/core/PFontTest.java | 3 +- core/test/processing/core/PFontTestHelp.txt | 45 +++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 core/test/processing/core/PFontTestHelp.txt diff --git a/core/test/processing/core/PFontTest.java b/core/test/processing/core/PFontTest.java index c7057ec57..e8b321e98 100644 --- a/core/test/processing/core/PFontTest.java +++ b/core/test/processing/core/PFontTest.java @@ -1,6 +1,7 @@ package processing.core; public class PFontTest { - //this is a new class to see if I can push to my fork } + +//Write Tests HERE! \ No newline at end of file diff --git a/core/test/processing/core/PFontTestHelp.txt b/core/test/processing/core/PFontTestHelp.txt new file mode 100644 index 000000000..edf97c940 --- /dev/null +++ b/core/test/processing/core/PFontTestHelp.txt @@ -0,0 +1,45 @@ + +What I think we need to test for broken up into chunks... trying to keep it organized + +Chunk A — Construction and initialization + +EED TO TEST IF... + +the object starts in the correct mode +important fields are initialized correctly +lookup structures are prepared correctly +lazy vs non-lazy behavior is set based on constructor input +charset input is handled safely and predictably + +SOME TEST EXAMPLES... + +charset == null should put the font in lazy mode +ascii array should start filled with -1 +provided charset should be sorted internally, without changing the caller’s original array +only displayable characters should become glyphs +ascent/descent get initialized one way or another + +Chunk B — Serialization and deserialization + +NEED TO TEST IF... + +font data can be saved and loaded without corruption +important metadata survives the round trip +glyph structure and bitmap data remain consistent +bad/invalid serialized data fails in the expected way + +SOME TEST EXAMPLES... + +save a font, reload it, compare glyphCount, size, name, psname, smooth +glyph widths/heights still match after reload +invalid stream data should throw instead of silently building a broken font + + + +Chunk C — Glyph insertion and ordering --will add more if we get through chunks A & B +Chunk D — Glyph lookup and lazy loading +Chunk E — Metrics and width calculations +Chunk F — Native font integration +Chunk G — Shape generation +Chunk H — Static charset and font listing +Chunk I — Glyph inner-class bitmap/header behavior \ No newline at end of file From 62259029ac1b26180a6cdbe45cf194bea9ce3e1b Mon Sep 17 00:00:00 2001 From: Elijah Baron Date: Wed, 1 Apr 2026 13:30:26 -0400 Subject: [PATCH 4/5] Added first test! added tons of comments. --- core/test/processing/core/PFontTest.java | 14 +++++++++++--- core/test/processing/core/PFontTestHelp.txt | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/test/processing/core/PFontTest.java b/core/test/processing/core/PFontTest.java index e8b321e98..5c5e46f06 100644 --- a/core/test/processing/core/PFontTest.java +++ b/core/test/processing/core/PFontTest.java @@ -1,7 +1,15 @@ package processing.core; -public class PFontTest { +import java.awt.Font; //Javas built in font class +import org.junit.Test; //Using Junit4 test implementation +import static org.junit.Assert.assertEquals; //To compare expected vs actual values -} +public class PFontTest { -//Write Tests HERE! \ No newline at end of file + @Test + public void constructor_setsSizeCorrectly() { + Font awtFont = new Font("Dialog", Font.PLAIN, 16); //Truth, what PFont size should be + PFont font = new PFont(awtFont, true, null); //call to constructor w specific values + assertEquals(16, font.getSize()); //actual test, expects 16 compares against actual value + } +} \ No newline at end of file diff --git a/core/test/processing/core/PFontTestHelp.txt b/core/test/processing/core/PFontTestHelp.txt index edf97c940..3c7f71cb1 100644 --- a/core/test/processing/core/PFontTestHelp.txt +++ b/core/test/processing/core/PFontTestHelp.txt @@ -3,7 +3,7 @@ What I think we need to test for broken up into chunks... trying to keep it orga Chunk A — Construction and initialization -EED TO TEST IF... +NEED TO TEST IF... the object starts in the correct mode important fields are initialized correctly From a44236c2982a707677893ac7f2ec2091a31b2a21 Mon Sep 17 00:00:00 2001 From: eliseferguson Date: Wed, 8 Apr 2026 09:12:31 -0400 Subject: [PATCH 5/5] Added some tests --- core/test/processing/data/FloatListTest.java | 135 +++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 core/test/processing/data/FloatListTest.java diff --git a/core/test/processing/data/FloatListTest.java b/core/test/processing/data/FloatListTest.java new file mode 100644 index 000000000..d9ba9aba3 --- /dev/null +++ b/core/test/processing/data/FloatListTest.java @@ -0,0 +1,135 @@ +package processing.data; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.*; + +public class FloatListTest { + @Test + public void testConstructorDefault(){ + FloatList testList = new FloatList(); + + assertEquals(0, testList.size()); + assertEquals(10, testList.data.length); + } + + @Test + public void testConstructorLength(){ + FloatList testList = new FloatList(15); + + assertEquals(0, testList.size()); + assertEquals(15, testList.data.length); + } + + @Test + public void testConstructorArray(){ + FloatList testList = new FloatList(new float[] {1.1F, 2.2F, 3.3F}); + + assertEquals(3, testList.size()); + assertEquals(3, testList.data.length); + + assertEquals(1.1F, testList.get(0), 0.0F); + assertEquals(3.3F, testList.get(2), 0.0F); + } + + @Test + public void testConstructorIterableObject(){ + List src = new ArrayList<>(Arrays.asList("String", 9, 10.4F, 3.7, null)); + FloatList testList = new FloatList(src); + assertEquals(5, testList.size()); + + float[] expected = {Float.NaN, 9.0F, 10.4F, 3.7F, Float.NaN}; + assertEquals(expected[0], testList.get(0), 0.0F); + assertEquals(expected[1], testList.get(1), 0.0F); + assertEquals(expected[2], testList.get(2), 0.0F); + assertEquals(expected[3], testList.get(3), 0.0F); + } + + @Test + public void testConstructorObject(){ + String typeStr = "String"; + int typeInt = 21; + float typeFlt = 4.5F; + Object typeObj = new Object(); + + FloatList testList = new FloatList(typeStr, typeInt, typeFlt, typeObj); + + float[] expected = {Float.NaN, 21.0F, 4.5F, Float.NaN}; + assertEquals(expected[0], testList.get(0), 0.0F); + assertEquals(expected[1], testList.get(1), 0.0F); + assertEquals(expected[2], testList.get(2), 0.0F); + assertEquals(expected[3], testList.get(3), 0.0F); + } + + @Test + public void testSize(){ + FloatList testList = new FloatList(new float[]{1.1F, 2.2F, 3.3F}); + + assertEquals(3, testList.size()); + } + + @Test + public void testResize(){ + FloatList testList = new FloatList(new float[]{3.3F, 4.4F, 5.5F}); + + assertEquals(3, testList.size()); + + testList.resize(10); + assertEquals(10, testList.size()); + assertEquals(10, testList.data.length); + } + + @Test + public void testClear(){ + FloatList testList = new FloatList(new float[]{45.8F, 5.6F, 9.8F}); + + assertEquals(3, testList.size()); + testList.clear(); + assertEquals(0, testList.size()); + } + + @Test + public void testGet(){ + FloatList testList = new FloatList(new float[]{4.5F, 7.8F}); + + assertEquals(4.5F, testList.get(0), 0.0F); + assertEquals(7.8F, testList.get(1), 0.0F); + } + + @Test + public void testSet(){ + FloatList testList = new FloatList(); + + testList.set(0, 18.0F); + assertEquals(1, testList.size()); + assertEquals(18.0F, testList.get(0), 0.0F); + + testList.set(500, 4.9F); + assertEquals(501, testList.size()); + assertEquals(4.9F, testList.get(500), 0.0F); + } + + @Test + public void testPush(){ + FloatList testList = new FloatList(); + testList.push(34.0F); + + assertEquals(1, testList.size()); + assertEquals(34.0F, testList.get(0), 0.0F); + } + + @Test + public void testPop(){ + FloatList testList = new FloatList(new float[]{6.0F, 7.0F}); + + assertEquals(7.0F, testList.pop(), 0.0F); + assertEquals(1, testList.size()); + + assertEquals(6.0F, testList.pop(), 0.0F); + assertEquals(0, testList.size()); + } +}