Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在一个矩形框架中绘制字符串。绳子画得很完美。现在我需要使用 sentesting kit 编写测试用例。我不知道应该从哪里开始。为了获得帮助,我还看到了iPhone 示例计算器应用程序
但还是不顺。
任何有想法的人请帮忙。
谢谢,
马杜普
GUI 绘图代码通常很难测试。在您的情况下,这取决于您如何绘制字符串。如果您使用该方法将其绘制到自定义视图中-(void)drawRect:并在其中仅绘制您的 NSString(我想),那么我认为您无法测试该绘制是否正确发生。如果您使用像 a 这样的单独视图,UITextLabel您可以使用STAssertNotNil. 您还可以通过检查视图的边界来检查正确的定位。
-(void)drawRect:
UITextLabel
STAssertNotNil
如果您需要更多帮助,请更具体一点,添加干净的代码会有所帮助。