Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I haven't seen a good unit testing solution to this yet and I'm going to need to find one soon so I would love to see or have a better answer.</p> <p>As @tooluser suggested you might be able to supply "nice" mocks for UITouch objects. Since there's no public constructor for UITouch supplying "real" UITouch instances is tricky and would rely on private API calls. Unfortunately since those touch mocks need to pass through framework code you cannot see or control you have to hope that your mocks actually match all of the expected behaviors of the UITouches they double (including any private behavior we can't see). That makes me nervous.</p> <p>Alternately you can follow @Sulthan's solution and test your gesture recognizers via UI driving integration tests. This is the approach I have used so far. Use UIAutomation or a third party test framework like <a href="http://testingwithfrank.com/" rel="nofollow">Frank</a> or <a href="https://github.com/square/KIF" rel="nofollow">KIF</a> to generate interactions with views and assert that the gesture recognizers fire as expected. That can at least allow you to test the recognizer in isolation (even if not in a true unit test).</p> <p>I usually want to have some integration tests to verify that interactions between multiple recognizers in custom views are behaving correctly so I don't find this approach too bad but it would be nice to really be able to test drive the development of a recognizer at the unit level (for test execution time if nothing else).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload