问题
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