Iphone 测试目标动作接线
我偶然发现了以下解释该主题的内容。然而,我确实有麻烦与给定的样品 它验证目标操作绑定,如下所示:Iphone 测试目标动作接线,iphone,objective-c,tdd,Iphone,Objective C,Tdd,我偶然发现了以下解释该主题的内容。然而,我确实有麻烦与给定的样品 它验证目标操作绑定,如下所示: STAssertEquals([doSomethingButton action], @selector(doSomething:), @"The button should send -doSomething: to its target."); STAssertEquals([doSomethingButton target], _windowController, @"The but
STAssertEquals([doSomethingButton action], @selector(doSomething:),
@"The button should send -doSomething: to its target.");
STAssertEquals([doSomethingButton target], _windowController,
@"The button should send its action to the window controller.");
只要doSomethingButton是UIBarButton,此选项就有效。UISwitch或UIButton没有目标或操作属性。我尝试在他们的目标操作线路上断言以下内容:
GHAssertNotNil([[controller logSwitch] actionsForTarget:controller forControlEvent:UIControlEventValueChanged], nil);
然而,即使我已经确认在模拟器中正确调用了操作,它还是失败了。为UIControl断言目标操作连线的正确方式是什么
更新:
UIControl - (NSSet *)allTargets
似乎什么也不返回,即使调试应用程序并在调用的操作中执行它 这似乎真的是UIKit框架中的一个bug。我已经向苹果公司提交了一份缺陷报告