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.Camera2SurfaceViewTestCase; 20 import android.util.Log; 21 import android.util.Size; 22 import android.view.Surface; 23 24 import org.junit.runners.Parameterized; 25 import org.junit.runner.RunWith; 26 import org.junit.Test; 27 28 import static org.junit.Assert.assertTrue; 29 30 /** 31 * <p>Basic test for CameraManager class.</p> 32 */ 33 34 @RunWith(Parameterized.class) 35 public class NativeStillCaptureTest extends Camera2SurfaceViewTestCase { 36 private static final String TAG = "NativeStillCaptureTest"; 37 private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE); 38 39 /** Load jni on initialization */ 40 static { 41 Log.i("NativeStillCaptureTest", "before loadlibrary"); 42 System.loadLibrary("ctscamera2_jni"); 43 Log.i("NativeStillCaptureTest", "after loadlibrary"); 44 } 45 46 @Test testStillCapture()47 public void testStillCapture() { 48 // Init preview surface to a guaranteed working size 49 updatePreviewSurface(new Size(640, 480)); 50 assertTrue("testStillCapture fail, see log for details", 51 testStillCaptureNative(mDebugFileNameBase, mPreviewSurface, mOverrideCameraId)); 52 } 53 testStillCaptureNative( String filePath, Surface previewSurface, String overrideCameraId)54 private static native boolean testStillCaptureNative( 55 String filePath, Surface previewSurface, String overrideCameraId); 56 } 57