• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Coredata - undo manager and inserting objects... (unit test)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: NSDocument with NSMatrix crasher (10.4)
  • Next by Date: Determining login privileges
  • Previous by thread: Re: [Solved] NSDocument with NSMatrix crasher (10.4)
  • Next by thread: Determining login privileges
  • Index(es):
    • Date
    • Thread