update method name (has typo)

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1903161 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2022-08-01 11:16:19 +00:00
parent eabb9a5999
commit ee65a6655d
2 changed files with 15 additions and 2 deletions

View File

@ -1495,8 +1495,21 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun {
*
* @return {@link STHighlightColor} for the run.
* @since 4.0.0
* @deprecated use {@link #getTextHighlightColor()} instead
*/
@Deprecated
@Removal(version = "7.0.0")
public STHighlightColor.Enum getTextHightlightColor() {
return getTextHighlightColor();
}
/**
* Gets the highlight color for the run
*
* @return {@link STHighlightColor} for the run.
* @since 5.2.3
*/
public STHighlightColor.Enum getTextHighlightColor() {
CTRPr pr = getRunProperties(true);
CTHighlight highlight = pr.sizeOfHighlightArray() > 0 ? pr.getHighlightArray(0) : pr.addNewHighlight();
STHighlightColor color = highlight.xgetVal();

View File

@ -678,10 +678,10 @@ class TestXWPFRun {
void testSetGetTextHighlightColor() throws IOException {
try (XWPFDocument document = new XWPFDocument()) {
final XWPFRun run = document.createParagraph().createRun();
assertSame(STHighlightColor.NONE, run.getTextHightlightColor());
assertSame(STHighlightColor.NONE, run.getTextHighlightColor());
assertFalse(run.isHighlighted());
run.setTextHighlightColor("darkGreen"); // See 17.18.40 ST_HighlightColor (Text Highlight Colors)
assertSame(STHighlightColor.DARK_GREEN, run.getTextHightlightColor());
assertSame(STHighlightColor.DARK_GREEN, run.getTextHighlightColor());
assertTrue(run.isHighlighted());
run.setTextHighlightColor("none");
assertFalse(run.isHighlighted());