mardi 4 octobre 2016

Test program that tries drag and drop in Android

Me and some dudes have made an app for a school project which contains some minigames. It is required to have some tests and we have been able to make these for all the minigames except for one minigame in which you have to drag and drop some pictures to certain locations.

So basically we have three ImageButtons which need to go to three Buttons (in which the correct order is randomized). The ImageButtons got onDragListeners which just uses view.startDrag() when MotionEvent.ACTION_DOWN and the normal Buttons got onDragListeners which just reacts on DragEvent.ACTION_DROP.

So my question is, how do I make a instrumentation test for this? I've already searched and found:

Android - perform drag and drop programmatically

How to create a DragEvent in Android

but they didn't really help me, but it feels like that I have to use ImageButton[0 to 2]. view.dispatchDragEvent(some DragEvent), but I really don't understand how to make a DragEvent Test for this?

Aucun commentaire:

Enregistrer un commentaire