mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-03 21:58:59 +00:00
When you add an observer to an object first time, its class is implicitly changed to a KVO_originalClassName (subclass of original class). This subclass adds willChange…/didChange… methods for observable properties. If you send willChange… before you add an observer, it does nothing. But if you send didChange… just after, the app will crash, because new KVO_originalClassName nerver receives willChange… The idea is to maintain counter of all received willChange… messages (per key) and decrease it in didChange… When KVO_originalClassName is created and didChange… is received (without opening willChange… to new class), exception is not thrown immediately, but the counter is checked first. If it's greater than 0, then didChange… just closes an unboserved willChange… Otherwise exception is thrown, as expected.
Requires objj be installed, as well as ojunit, located at http://github.com/cappuccino/ojunit
Run individual tests using a command similar to the following:
objj ojunit/OJTestRunnerText.j cappuccino/Tests/Foundation/CPDateTest.j