Skip to content

Commit

Permalink
Increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelbl committed May 31, 2024
1 parent acc709f commit 1ab8808
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Unit tests for {@link FontMetrics} class
*/
@DisplayName("Font metrics / line wrapping")
@SuppressWarnings("java:S5976")
class FontMetricsTest {

private FontMetrics fontMetrics;
Expand Down Expand Up @@ -118,4 +119,20 @@ void newlines_hasWidth0() {
assertEquals(0, fontMetrics.getTextWidth("\n", 10, false));
assertEquals(0, fontMetrics.getTextWidth("\r", 10, false));
}

@Test
void fontFamilyWithQuotes_works() {
FontMetrics metrics = new FontMetrics("\"Liberation Sans\"");
assertEquals(5.70089, metrics.getTextWidth("ďīŊ", 10, false), 0.0001);
}

@Test
void latinExtendedBChars_textWidthWork() {
assertEquals(1.76389, fontMetrics.getTextWidth("ș", 10, false), 0.0001);
}

@Test
void euroSign_textWidthWork() {
assertEquals(2.62467, fontMetrics.getTextWidth("€", 10, false), 0.0001);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ void setReference() {
assertEquals(Bill.REFERENCE_TYPE_CRED_REF, bill.getReferenceType());
}

@Test
void setReferenceToEmpty() {
Bill bill = new Bill();
bill.setReference("");
assertEquals("", bill.getReference());
assertEquals(Bill.REFERENCE_TYPE_NO_REF, bill.getReferenceType());
}

@Test
void createCreditorReference() {
Bill bill = new Bill();
Expand Down Expand Up @@ -184,6 +192,7 @@ void setCharacterSet() {
assertEquals(SPSCharacterSet.EXTENDED_LATIN, bill.getCharacterSet());
}

@SuppressWarnings({"EqualsWithItself", "AssertBetweenInconvertibleTypes"})
@Test
void testEqualsTrivial() {
Bill bill = new Bill();
Expand Down

0 comments on commit 1ab8808

Please sign in to comment.