1/* 2 * Copyright 2013 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 17package androidx.media.filterfw.samples.simplecamera; 18 19import androidx.media.filterfw.samples.simplecamera.FloatArrayToSizeFilter; 20import androidx.media.filterfw.Filter; 21import androidx.media.filterfw.FrameValue; 22import androidx.media.filterfw.FrameType; 23import androidx.media.filterfw.MffContext; 24import androidx.media.filterfw.MffFilterTestCase; 25 26import java.util.concurrent.ExecutionException; 27import java.util.concurrent.TimeoutException; 28 29 30public class FloatArrayToSizeFilterTest extends MffFilterTestCase { 31 32 @Override 33 protected Filter createFilter(MffContext mffContext) { 34 return new FloatArrayToSizeFilter(mffContext, "floatArrayToSizeFilter"); 35 } 36 37 38 public void testToSize() throws Exception { 39 FrameValue floatArray = createFrame(FrameType.array(float.class), new int[] { 1 }). 40 asFrameValue(); 41 float[] floatArr = { 10f, 15f, 25f }; 42 floatArray.setValue(floatArr); 43 44 injectInputFrame("array", floatArray); 45 46 process(); 47 assertEquals(3, ((Integer) getOutputFrame("size").asFrameValue().getValue()).intValue()); 48 } 49} 50