JavaFX reflective access + Javadoc + @delvh
All checks were successful
zdm/undo-redo/pipeline/head This commit looks good
All checks were successful
zdm/undo-redo/pipeline/head This commit looks good
* Allow reflective access to the JavaFX module for javafx.base * Add space to the unit test orders * Improve Javadoc * Add @delvh as developer
This commit is contained in:
@ -6,6 +6,10 @@ import java.util.*;
|
||||
* A change manager keeps track of subsequent changes and allows un- and redoing them. A specific
|
||||
* change can be marked using {@link #mark()} to keep track of a saved state in the application that
|
||||
* uses the manager.
|
||||
* <p>
|
||||
* If you intend to listen to the state of a change manager, consider writing a wrapper
|
||||
* implementation for an existing change manager that adds the necessary hooks. If you use JavaFX,
|
||||
* take a look at the {@code dev.kske.undoredo.javafx} module.
|
||||
*
|
||||
* @param <C> the change type to store in this change manager
|
||||
* @author Maximilian Käfer
|
||||
|
@ -24,7 +24,7 @@ public final class UnlimitedChangeManager<C extends Change> implements ChangeMan
|
||||
|
||||
@Override
|
||||
public Optional<C> getLastChange() {
|
||||
return index == -1 ? Optional.empty() : Optional.of(changes.get(index));
|
||||
return index < 0 ? Optional.empty() : Optional.of(changes.get(index));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -27,7 +27,7 @@ class ChangeManagerTest {
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Test
|
||||
@Order(1)
|
||||
@Order(10)
|
||||
void testAddChange() {
|
||||
assertSame(0, wrapper.value);
|
||||
manager.addChange(change);
|
||||
@ -40,7 +40,7 @@ class ChangeManagerTest {
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Test
|
||||
@Order(2)
|
||||
@Order(20)
|
||||
void testLastChange() {
|
||||
assertTrue(manager.getLastChange().isEmpty());
|
||||
manager.addChange(change);
|
||||
@ -53,7 +53,7 @@ class ChangeManagerTest {
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Test
|
||||
@Order(3)
|
||||
@Order(30)
|
||||
void testGetChanges() {
|
||||
assertTrue(manager.getChanges().isEmpty());
|
||||
manager.addChange(change);
|
||||
@ -67,7 +67,7 @@ class ChangeManagerTest {
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Test
|
||||
@Order(4)
|
||||
@Order(40)
|
||||
void testUndo() {
|
||||
assertFalse(manager.isUndoAvailable());
|
||||
assertFalse(manager.undo());
|
||||
@ -85,7 +85,7 @@ class ChangeManagerTest {
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Test
|
||||
@Order(5)
|
||||
@Order(50)
|
||||
void testRedo() {
|
||||
assertFalse(manager.isRedoAvailable());
|
||||
assertFalse(manager.redo());
|
||||
@ -106,7 +106,7 @@ class ChangeManagerTest {
|
||||
* @since 0.0.1
|
||||
*/
|
||||
@Test
|
||||
@Order(6)
|
||||
@Order(60)
|
||||
void testMark() {
|
||||
assertTrue(manager.isAtMarkedIndex());
|
||||
manager.addChange(change);
|
||||
|
Reference in New Issue
Block a user