summaryrefslogtreecommitdiff
path: root/sfx2/qa
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-10-19 22:23:16 +0200
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2010-10-19 22:23:16 +0200
commit626f341e6133c4d8e24551bc7563f512a32422fe (patch)
tree7a0b20327c6a588c87ff6987f2190d026466b85f /sfx2/qa
parent870b17d7ed1397a48ad8699cdaa1847af2344911 (diff)
undoapi: added isUndo/RedoPossible / getCurrent/AllUndo/RedoTitle(s) to XUndoManager
Diffstat (limited to 'sfx2/qa')
-rwxr-xr-xsfx2/qa/complex/sfx2/UndoManager.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/sfx2/qa/complex/sfx2/UndoManager.java b/sfx2/qa/complex/sfx2/UndoManager.java
index 21433cd07336..f70e486bffb3 100755
--- a/sfx2/qa/complex/sfx2/UndoManager.java
+++ b/sfx2/qa/complex/sfx2/UndoManager.java
@@ -38,6 +38,7 @@ import com.sun.star.document.XUndoManagerListener;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
+import com.sun.star.util.InvalidStateException;
import complex.sfx2.undo.DocumentTest;
import complex.sfx2.undo.DrawDocumentTest;
import complex.sfx2.undo.ImpressDocumentTest;
@@ -174,6 +175,15 @@ public class UndoManager
final XUndoManager undoManager = getUndoManager( test.getDocument() );
undoManager.clear();
+ assertFalse( "clearing the Undo manager should result in the impossibility to undo anything", undoManager.isUndoPossible() );
+ assertFalse( "clearing the Undo manager should result in the impossibility to redo anything", undoManager.isRedoPossible() );
+
+ // try retrieving the comments for the current Undo/Redo - this should fail
+ boolean caughtExpected = false;
+ try { undoManager.getCurrentUndoActionTitle(); undoManager.getCurrentRedoActionTitle(); }
+ catch( final InvalidStateException e ) { caughtExpected = true; }
+ assertTrue( "trying the title of the current Undo/Redo action is expected to fail for an empty stack", caughtExpected );
+
final UndoListener listener = new UndoListener();
undoManager.addUndoManagerListener( listener );
@@ -226,6 +236,9 @@ public class UndoManager
test.verifyInitialDocumentState();
listener.reset();
+ // test various comment-related functions
+
+ // close the document, ensure the Undo manager listener gets notified
m_currentDocument.close();
assertTrue( "document is closed, but the UndoManagerListener has not been notified of the disposal", listener.isDisposed() );
m_currentDocument = null;