• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017 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.media.misc.cts;
18 
19 import android.os.Build;
20 import android.platform.test.annotations.AppModeFull;
21 import android.test.AndroidTestCase;
22 import android.util.Log;
23 import android.view.Surface;
24 
25 import androidx.test.filters.SdkSuppress;
26 
27 /**
28  * Verification test for AImageReader.
29  */
30 @AppModeFull(reason = "TODO: evaluate and port to instant")
31 public class NativeImageReaderTest extends AndroidTestCase {
32     private static final String TAG = "NativeImageReaderTest";
33     private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
34 
35     /** Load jni on initialization */
36     static {
37         Log.i("NativeImageReaderTest", "before loadlibrary");
38         System.loadLibrary("ctsmediamisc_jni");
39         Log.i("NativeImageReaderTest", "after loadlibrary");
40     }
41 
testSucceedsWithSupportedUsageFormat()42     public void testSucceedsWithSupportedUsageFormat() {
43         assertTrue(
44                 "Native test failed, see log for details",
45                 testSucceedsWithSupportedUsageFormatNative());
46     }
47 
testTakePictures()48     public void testTakePictures() {
49         assertTrue("Native test failed, see log for details", testTakePicturesNative());
50     }
51 
testCreateSurface()52     public void testCreateSurface() {
53         Surface surface = testCreateSurfaceNative();
54         assertNotNull("Surface created is null.", surface);
55         assertTrue("Surface created is invalid.", surface.isValid());
56     }
57 
58     @SdkSuppress(minSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
testSucceedsWithHardwareBufferFormatAndDataSpace()59     public void testSucceedsWithHardwareBufferFormatAndDataSpace() {
60         assertTrue(
61                 "Native test failed, see log for details",
62                  testSucceedsWithHardwareBufferFormatAndDataSpaceNative());
63     }
64 
testSucceedsWithSupportedUsageFormatNative()65     private static native boolean testSucceedsWithSupportedUsageFormatNative();
testSucceedsWithHardwareBufferFormatAndDataSpaceNative()66     private static native boolean testSucceedsWithHardwareBufferFormatAndDataSpaceNative();
testTakePicturesNative()67     private static native boolean testTakePicturesNative();
testCreateSurfaceNative()68     private static native Surface testCreateSurfaceNative();
69 }
70