My goal is to test some Android App code that gets a list of image files that are on the device and then does some work on that list.
I am new to Android and Android Unit testing.
I am attempting to add images to the MediaStore within a Robolectric unit test, but I am not sure how to proceed.
These are the steps I think I need to perform:
- Add the Test Images to a known directory on the local system.
- Copy the images to the Robolectric Temp directory that the Media Service will expect or can be pointed to.
-
Then run insertImage and add the images to the MediaStore.
MediaStore.Images.Media.insertImage(...);
When I attempt to insert the image however the method returns null.
I have images, but I am not sure where to copy them for the MediaStore to understand, and I am not sure why when I run the insertImage on a known image path I get a null return. I am not longer getting a FileNotFound exception so I believe it is finding the file.
Aucun commentaire:
Enregistrer un commentaire