1 /* 2 * Copyright 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.hardware.camera2.cts; 18 19 import android.hardware.camera2.cts.testcases.Camera2AndroidTestCase; 20 import android.util.Log; 21 22 import org.junit.Test; 23 24 import static junit.framework.Assert.*; 25 26 /** 27 * <p>Basic test for CameraManager class.</p> 28 */ 29 import org.junit.runner.RunWith; 30 import org.junit.runners.Parameterized; 31 @RunWith(Parameterized.class) 32 public class NativeImageReaderTest extends Camera2AndroidTestCase { 33 private static final String TAG = "NativeImageReaderTest"; 34 private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE); 35 36 /** Load jni on initialization */ 37 static { 38 Log.i("NativeImageReaderTest", "before loadlibrary"); 39 System.loadLibrary("ctscamera2_jni"); 40 Log.i("NativeImageReaderTest", "after loadlibrary"); 41 } 42 43 @Test testJpeg()44 public void testJpeg() { 45 assertTrue("testJpeg fail, see log for details", 46 testJpegNative(mDebugFileNameBase, mOverrideCameraId)); 47 } 48 49 @Test testY8()50 public void testY8() { 51 assertTrue("testY8 fail, see log for details", 52 testY8Native(mDebugFileNameBase, mOverrideCameraId)); 53 } 54 55 @Test testHeic()56 public void testHeic() { 57 assertTrue("testHeic fail, see log for details", 58 testHeicNative(mDebugFileNameBase, mOverrideCameraId)); 59 } 60 61 @Test testDepthJpeg()62 public void testDepthJpeg() { 63 assertTrue("testDepthJpeg fail, see log for details", 64 testDepthJpegNative(mDebugFileNameBase, mOverrideCameraId)); 65 } 66 67 @Test testImageReaderCloseAcquiredImages()68 public void testImageReaderCloseAcquiredImages() { 69 assertTrue("testImageReaderClose fail, see log for details", 70 testImageReaderCloseAcquiredImagesNative(mOverrideCameraId)); 71 } 72 testJpegNative(String filePath, String overrideCameraId)73 private static native boolean testJpegNative(String filePath, String overrideCameraId); testY8Native(String filePath, String overrideCameraId)74 private static native boolean testY8Native(String filePath, String overrideCameraId); testHeicNative(String filePath, String overrideCameraId)75 private static native boolean testHeicNative(String filePath, String overrideCameraId); testDepthJpegNative(String filePath, String overrideCameraId)76 private static native boolean testDepthJpegNative(String filePath, String overrideCameraId); testImageReaderCloseAcquiredImagesNative(String overrideCameraId)77 private static native boolean testImageReaderCloseAcquiredImagesNative(String overrideCameraId); 78 } 79