• 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
Test-driven development with bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: How to force a Window to stay in front
  • Next by Date: Re: How to force a Window to stay in front
  • Previous by thread: Re: How to force a Window to stay in front
  • Next by thread: Crashes and logfiles
  • Index(es):
    • Date
    • Thread