• 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: Programmatically setting the value of a bound TextField
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Programmatically setting the value of a bound TextField


  • Subject: Re: Programmatically setting the value of a bound TextField
  • From: Chris Hanson <email@hidden>
  • Date: Thu, 2 Mar 2006 21:46:29 -0800

On Mar 1, 2006, at 6:29 AM, Felix Franz wrote:

In my program I have NSTextField bound to an object using the "value"-Binding.
I would like to test the functionality in a unit-test. I tried using setStringValue:
of the NSTextField but the bound object is not updated. Do I have to call some
methods before/after changing the value?

Rather than trying to test pushing information through a control and into your model, you can test how the connection between the control and your model is configured and trust that the control will do the right thing if it's configured correctly. I call this a "trust but verify" approach to testing, and it makes it straightforward to do test-driven development of non-code artifacts like data models and human interfaces.


In Cocoa, it works well with both target-action and bindings (via Tiger's -infoForBinding: which you've already discovered). It lets you separate the testing of how your human interface is laid out and configured from the testing of how your model objects and business logic work, which can make it easier to safely change one of those without changing the other. And as I said above, you can even expand this to other artifacts like data models.

  -- Chris

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Programmatically setting the value of a bound TextField
      • From: "Keith Ray" <email@hidden>
References: 
 >Programmatically setting the value of a bound TextField (From: Felix Franz <email@hidden>)

  • Prev by Date: Re: does transformedValueClass matter?
  • Next by Date: Re: does transformedValueClass matter?
  • Previous by thread: Re: Programmatically setting the value of a bound TextField
  • Next by thread: Re: Programmatically setting the value of a bound TextField
  • Index(es):
    • Date
    • Thread