mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-18 04:29:22 +00:00
Merge pull request #3333 from enquora/integration-test-document-based-app
Undo functionality: verify behaviour, fix accidentally disclosed edge…
This commit is contained in:
3 files changed
+26
-3
No files matched your search
@@ -347,8 +347,12 @@ if (_currentGroup == nil)
|
||||
*/
|
||||
- (void)undo
|
||||
{
|
||||
// Closing the grouping here also cancels the run loop's scheduled close of the event grouping.
|
||||
if ([self groupingLevel] === 1)
|
||||
{
|
||||
[self endUndoGrouping];
|
||||
[self _unregisterWithRunLoop];
|
||||
}
|
||||
|
||||
[self undoNestedGroup];
|
||||
}
|
||||
|
||||
@@ -57,6 +57,26 @@
|
||||
[[CPNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
- (void)testUndoInSameRunLoopCycleAsChange
|
||||
{
|
||||
[self doIt];
|
||||
|
||||
// The change opened an event grouping that the run loop is scheduled to close. Undo closes it first.
|
||||
[undoManager undo];
|
||||
|
||||
[self assertFalse:itIsDone message:@"undo should revert the change"];
|
||||
|
||||
// The scheduled close must not run against the grouping that undo already closed.
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
|
||||
[self assert:0 equals:[undoManager groupingLevel]];
|
||||
[self assertTrue:[undoManager canRedo] message:@"the undone change should be available to redo"];
|
||||
|
||||
[undoManager redo];
|
||||
|
||||
[self assertTrue:itIsDone message:@"redo should reapply the change"];
|
||||
}
|
||||
|
||||
- (void)receiveNotification:(CPNotification)aNotification
|
||||
{
|
||||
[receivedNotifications addObject:aNotification];
|
||||
@@ -74,7 +94,7 @@
|
||||
- (void)undoIt
|
||||
{
|
||||
[undoManager registerUndoWithTarget:self
|
||||
selector:@selector(doit)
|
||||
selector:@selector(doIt)
|
||||
object:nil];
|
||||
|
||||
itIsDone = NO;
|
||||
|
||||
@@ -25,7 +25,6 @@ TextEditor is a document-based test application and a tutorial. When the app use
|
||||
|
||||
### Undo and redo
|
||||
|
||||
- **Redo is unreliable or does not work.** Not yet investigated.
|
||||
- **Undo stays enabled when `allowsUndo` is `NO`.** `-[CPTextView undo:]` then does nothing (`CPTextView.j:679`). The text view must disable the menu item in that case.
|
||||
|
||||
### Clipboard
|
||||
@@ -66,7 +65,7 @@ TextEditor is a document-based test application and a tutorial. When the app use
|
||||
|
||||
- One window for each document, each loaded from its own cib.
|
||||
- Insert Lorem Ipsum through the responder chain.
|
||||
- Undo over several levels, separate for each document.
|
||||
- Undo and redo over several levels, separate for each document.
|
||||
- Text colour through `CPColorPanel`.
|
||||
- Paragraph indents through the ruler markers.
|
||||
- The "save changes" alert when a document closes.
|
||||
|
||||
Reference in new issue
Block a user