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.Filter;
20import androidx.media.filterfw.FrameValue;
21import androidx.media.filterfw.FrameType;
22import androidx.media.filterfw.MffContext;
23import androidx.media.filterfw.MffFilterTestCase;
24import androidx.media.filterfw.samples.simplecamera.FloatArrayToStrFilter;
25
26import java.util.concurrent.ExecutionException;
27import java.util.concurrent.TimeoutException;
28
29
30public class FloatArrayToStrFilterTest extends MffFilterTestCase {
31
32    @Override
33    protected Filter createFilter(MffContext mffContext) {
34        return new FloatArrayToStrFilter(mffContext, "floatArrayToStrFilter");
35    }
36
37    public void testToStr() throws Exception {
38        FrameValue floatArray = createFrame(FrameType.array(float.class), new int[] { 1 }).
39                asFrameValue();
40        float[] floatArr = { 10f, 15f, 25f };
41        floatArray.setValue(floatArr);
42
43        injectInputFrame("array", floatArray);
44
45        process();
46
47        assertEquals("[10.0, 15.0, 25.0]", (String) getOutputFrame("string").asFrameValue().
48                getValue());
49    }
50}