• 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: Difficulty Calling NSTableView's validateDrop: Method for Unit Testing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Difficulty Calling NSTableView's validateDrop: Method for Unit Testing


  • Subject: Re: Difficulty Calling NSTableView's validateDrop: Method for Unit Testing
  • From: Dave Fernandes <email@hidden>
  • Date: Tue, 07 Feb 2012 11:57:12 -0500

tableView:validateDrop:proposedRow:proposedDropOperation: is an NSTableViewDataSource method (not an NSTableView method). So whatever class is implementing the data source methods is probably the class you want to test with your unit test code.

Dave

On 2012-02-06, at 9:22 PM, Mark Szymczyk wrote:

> I'm trying to unit test drag and drop rearranging of items in a table view. In my unit testing code I have an object of a NSDocument subclass.
>
> MyDocument* testDoc;
>
> The NSDocument subclass has a table view outlet.
>
> IBOutlet NSTableView* myTableView;
>
> I start my unit test by creating a mock object that implements the NSDraggingInfo protocol.
>
> id mock = [OCMockObject mockForProtocol:@protocol(NSDraggingInfo)];
>
> I use the mock object as an argument to NSTableView's validateDrop: method, like the following code:
>
> NSDragOperation theDrag = [xyz
> 	tableView:myTableView
> 	validateDrop:mock
> 	proposedRow:1
> 	proposedDropOperation:NSTableViewDropAbove];
>
> What do I replace xyz with in my call to validateDrop:? I tried supplying testDoc, myTableView, NSDocument, and NSTableView, but they generate syntax errors. I searched Google for examples, but all I found were examples on how to write a validateDrop: method to handle drag and drop in my code. I didn't find any examples of calling validateDrop:.
>
> Mark
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Difficulty Calling NSTableView's validateDrop: Method for Unit Testing (From: Mark Szymczyk <email@hidden>)

  • Prev by Date: Re: TextEdit - Open Recent - slow
  • Next by Date: Re: Sandbox, 10.6, Core Duo, XCode 4.... where is the entitlement page?
  • Previous by thread: Difficulty Calling NSTableView's validateDrop: Method for Unit Testing
  • Next by thread: Sandbox, 10.6, Core Duo, XCode 4.... where is the entitlement page?
  • Index(es):
    • Date
    • Thread