• 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
Re: unit testing NSDocument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unit testing NSDocument


  • Subject: Re: unit testing NSDocument
  • From: Chris Hanson <email@hidden>
  • Date: Wed, 29 Mar 2006 13:49:27 -0800


On Mar 29, 2006, at 10:20 AM, Jesse Grosjean wrote:

I've run into a problem unit testing my NSDocument classes. The problem is that trying to open a document using the document controller fails:

[[[NSDocumentController sharedDocumentController] openDocumentWithContentsOfURL:documentURL display:YES] retain];

I think the reason that this is failing is because the executable is /Developer/Tools/otest and that doesn't have any Info.plist associated with it that maps file extensions to my document classes. And so the sharedDocumentController doesn't know what class it should use to open the document URL. So my question is does anyone know how to make the sharedDocumentController load my apps Info.plist when run from within the otest tool?

You might be able to create a custom subclass of NSDocumentController that responds to methods like -documentClassForType:, - fileExtensionsFromType:, -typeForContentsOfURL:error:, and - typeFromFileExtension: (for example) with the appropriate information for your application -- possibly information loaded from your application's Info.plist file. See the NSDocumentController documentation for more details about these methods and how they might be called.


Running a test like this against an application rather than a framework should just work.

  -- Chris

_______________________________________________
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


References: 
 >unit testing NSDocument (From: Jesse Grosjean <email@hidden>)

  • Prev by Date: Re: Randomly shuffle my core data dataset?
  • Next by Date: Re: Need of an Apple Engineer. Core-Data Issues
  • Previous by thread: unit testing NSDocument
  • Next by thread: Replacing default CFAllocator breaks application?
  • Index(es):
    • Date
    • Thread