How to write test cases for drawing text / string in a box?

半腔热情 提交于 2019-12-13 14:20:52

问题


I am drawing strings in a rectangular frame. The string is drawing perfectly. Now I need to write test cases using sentesting kit. I have no ideas from where I should start. For help I have also seen the iPhone sample calculator application

But still out of sorts.

Any body having ideas please help.

Thanks,

Madhup


回答1:


GUI drawing code is often hard to test. In your case it depends how you draw your string. If you draw it into a custom view by using the -(void)drawRect: method and therein just drawing your NSString (I suppose), then I do not think your can test that this drawing happend properly. If you use a separate view like a UITextLabel you could test for its existance by using STAssertNotNil. You could also check the proper positioning by checking the view's bounds.

If you need more help, please be a bit more specific and adding clean code would help.



来源:https://stackoverflow.com/questions/2642889/how-to-write-test-cases-for-drawing-text-string-in-a-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!