PhotoCaptureHelper extends CaptureHelper { public void setCaptureTime() { application.getSharedPreferences().edit().putLong("capture_start_time", Calendar.getInstance().getTimeInMillis()).commit(); } PhotoCaptureHelper(RapidFtrApplication context); File getTempCaptureFile(); Calendar getCaptureTime(); void setCaptureTime(); Bitmap getCapture(); void deleteCaptures(); Bitmap getDefaultThumbnail(); void savePhoto(Bitmap original, int rotationDegree, String fileNameWithoutExtension); void saveThumbnail(Bitmap original, int rotationDegree, String fileNameWithoutExtension); Bitmap loadThumbnail(String fileNameWithoutExtension); Bitmap loadPhoto(String fileNameWithoutExtension); InputStream getDecodedImageStream(String fileNameWithoutExtension); Bitmap getThumbnailOrDefault(String fileNameWithoutExtension); int getPictureRotation(); void convertPhoto(String photo, String existingKey, String newKey); static final int THUMBNAIL_WIDTH; static final int THUMBNAIL_HEIGHT; static final int JPEG_QUALITY; static final int PHOTO_WIDTH; static final int PHOTO_HEIGHT; static final int QUALITY; }
@Test public void testSaveCaptureTimeInSharedPreferences() { long time1 = System.currentTimeMillis(); photoCaptureHelper.setCaptureTime(); long time2 = System.currentTimeMillis(); long time = application.getSharedPreferences().getLong("capture_start_time", 0); assertTrue(time >= time1 && time <= time2); }