Test-driven development with bindings
Test-driven development with bindings
- Subject: Test-driven development with bindings
- From: Chris Hanson <email@hidden>
- Date: Fri, 16 Jan 2004 14:17:09 -0600
I'm trying to figure out how to do test-driven development with
bindings and OCUnit.
I have a controller (not NSController) "myController" that has an
outlet "textField" to an NSTextField, and an instance variable "ivar"
the NSTextField is bound to via an NSObjectController.
Here's the kind of test I was hoping I could write:
- (void)testMyFieldInput
{
NSTextField *textField = [myController valueForKey:@"textField"];
[textField setStringValue:@"testValue"];
shouldBeEqual(@"testValue", [myController valueForKey:@"ivar"]);
}
But setting the NSTextField's value using -setStringValue: doesn't
actually cause the value to be reflected in the binding. Which makes
sense, it prevents looping. But I'm unsure of how to write a test for
this now that will ensure the binding is actually set up and doing what
it's supposed to.
Is there any message I can send to an object that has a binding to tell
it to update the value at its binding?
-- Chris
--
Chris Hanson <email@hidden>
bDistributed.com, Inc.
Outsourcing Vendor Evaluation
Custom Mac OS X Development
Cocoa Developer Training
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.