-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make plain text edits via converting to StyledDocument first.
Fixes #183.
- Loading branch information
1 parent
94100e2
commit 8d4d1c7
Showing
4 changed files
with
105 additions
and
114 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
27 changes: 27 additions & 0 deletions
27
richtextfx/src/test/java/org/fxmisc/richtext/StyledTextAreaTest.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,27 @@ | ||
package org.fxmisc.richtext; | ||
|
||
import static org.junit.Assert.*; | ||
import javafx.embed.swing.JFXPanel; | ||
|
||
import org.junit.Test; | ||
|
||
public class StyledTextAreaTest { | ||
|
||
@Test | ||
public void testUndoWithWinNewlines() { | ||
new JFXPanel(); // initialize JavaFX | ||
|
||
String text1 = "abc\r\ndef"; | ||
String text2 = "A\r\nB\r\nC"; | ||
StyleClassedTextArea area = new StyleClassedTextArea(); | ||
|
||
area.replaceText(text1); | ||
area.getUndoManager().forgetHistory(); | ||
area.insertText(0, text2); | ||
assertEquals("A\nB\nCabc\ndef", area.getText()); | ||
|
||
area.undo(); | ||
assertEquals("abc\ndef", area.getText()); | ||
} | ||
|
||
} |