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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to