-
Notifications
You must be signed in to change notification settings - Fork 366
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For #28 - Add method to builder to set character break iterator.
- Loading branch information
Showing
7 changed files
with
141 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
openhtmltopdf-core/src/test/java/com/openhtmltopdf/layout/TextTransformersTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.openhtmltopdf.layout; | ||
|
||
import java.util.Locale; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import static org.hamcrest.CoreMatchers.*; | ||
|
||
import com.openhtmltopdf.extend.FSTextTransformer; | ||
|
||
public class TextTransformersTest { | ||
@Test | ||
public void testSimpleToUpperTransform() { | ||
FSTextTransformer tr = new TextUtil.DefaultToUpperTransformer(Locale.US); | ||
Assert.assertThat(tr.transform("this is a Test"), equalTo("THIS IS A TEST")); | ||
} | ||
|
||
@Test | ||
public void testSimpleToLowerTransform() { | ||
FSTextTransformer tr = new TextUtil.DefaultToLowerTransformer(Locale.US); | ||
Assert.assertThat(tr.transform("THIS IS a TEST"), equalTo("this is a test")); | ||
} | ||
|
||
@Test | ||
public void testSimpleToTitleTransform() { | ||
FSTextTransformer tr = new TextUtil.DefaultToTitleTransformer(); | ||
Assert.assertThat(tr.transform("this iS a teST"), equalTo("This IS A TeST")); | ||
} | ||
|
||
@Test | ||
public void testPunctuationUnchanged() { | ||
FSTextTransformer[] trs = new FSTextTransformer[] { | ||
new TextUtil.DefaultToUpperTransformer(Locale.US), | ||
new TextUtil.DefaultToLowerTransformer(Locale.US), | ||
new TextUtil.DefaultToTitleTransformer() }; | ||
|
||
for (FSTextTransformer tr : trs) { | ||
Assert.assertThat(tr.transform("!@#$%^&&*()_-+=?/><,.~`"), equalTo("!@#$%^&&*()_-+=?/><,.~`")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters