Hi list!

I'm writing a RubyCocoa app, but my question is on the Cocoa API...

I'm trying to unit test a view class.  As it is very thin (just delegates all 
work to the controller), all I want to check is that my connections (e.g. 
outlets and actions) are hooked up correctly.

I've been trying to:
1. Create an instance of my class
2. use NSBundle::loadNibFile: externalNameTable: withZone: to load the nib
3. check the connections

The docs for loadNibFile 
(http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSBundle_AppKitAdditions/Reference/Reference.html)
 seem to suggest that you can pass objects in:
"A name table whose keys identify objects associated with your program or the 
nib file. The newly unarchived objects from the nib file use this table to 
connect to objects in your program."

But I can't get it to work after hours!

This code is in ruby, but it's just bridged to the corresponding Cocoa calls:
        view = MyView.new # subclass of NSWindowController
        NSApplication.sharedApplication
        top_level = [] # I've tried passing everything I could think of here:
                                - view # the object instance
                                - "My View" => view # NSDictionary with key 
object name in IB and value object instance
                                - MyView => view # NSDictionary with class name 
/ object entry

        # I Also tried passing the object, and object-containing dictionaries 
below
        # e.g. dictionaryWithObjects_forKeys [NSApp, top_level, view], 
[NSNibOwner, NSNibTopLevelObjects, "My View"]
        context = NSDictionary::dictionaryWithObjects_forKeys [NSApp, 
top_level], [NSNibOwner, NSNibTopLevelObjects]

        NibPath = 
".../RandomAppRuby.app/Contents/Resources/English.lproj/MainMenu.nib"
        
        OSX::NSBundle::loadNibFile_externalNameTable_withZone NibPath, context, 
NSApp.zone

Thanks in advance for any guidance!

Sean DeNigris
s...@clipperadams.com



_______________________________________________

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

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

Reply via email to