Android: replace camera preview with image

I do black box automation tests (with appium and ruby) for an application that use the camera in several cases: - take a photo - scan a QR code - scan a PDF code

I am looking for a way to set an image in a preview image to scan it. This is a (perfect) word for emulators and real devices.

+4
source share
1 answer

I was ready to do the same for my application (which scann QR code), and the solution I used was to add an EditText (which appears only in test mode) to put a line that matches the QR code and then processing the string as a result of the scan.

The problem with this solution is that you cannot test the camera or the functions / methods that you made for decoding, but this is the only problem, so if you use a library (like ZXing), this is not very important, because I I assume that you only need the line corresponding to the QR code.

0
source

All Articles