Coredata - undo manager and inserting objects... (unit test)
Coredata - undo manager and inserting objects... (unit test)
- Subject: Coredata - undo manager and inserting objects... (unit test)
- From: email@hidden
- Date: Sat, 8 Jul 2006 22:58:22 -0700
Hi all.
I'm working on a test of my framework and ran into a slight problem.
I'm inserting an object into a new NSManagedObject context (clean
slate), and cheking the undo levels to make sure the undo is
incremented.
The problem: its not.
Here is the code: (the reason I test this is because I have a
convenience method to turn on and off undo registration)
- (void)testInsert
{
unsigned undoLevelsBeforeAnotherOperation = [[testContext
undoManager] levelsOfUndo];
id anotherManagedObject = [NSEntityDescription
insertNewObjectForEntityForName:@"Newstep"
inManagedObjectContext:testContext];
STAssertNotNil(anotherManagedObject,nil);
unsigned undoLevelsAfterAnotherOperation = [[testContext
undoManager] levelsOfUndo];
STAssertTrue
((undoLevelsAfterAnotherOperation>undoLevelsBeforeAnotherOperation),nil)
; ////////////////FAILS HERE//////////////
}
Am I right in assuming that because of undo grouping that the undo
count wont be incremented until the end of the run-loop?
If so, how do I test this from a unit test, where the end of the run-
loop == the end of the test??
Any help is appreciated!
Andre
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden