@@ -0,0 +1,2533 @@
+package graphics.epi.test;%0A%0Aimport android.graphics.Bitmap;%0Aimport android.graphics.BitmapFactory;%0Aimport android.os.Bundle;%0Aimport android.test.AndroidTestCase;%0Aimport android.util.Log;%0A%0Aimport org.opencv.android.BaseLoaderCallback;%0Aimport org.opencv.android.LoaderCallbackInterface;%0Aimport org.opencv.android.OpenCVLoader;%0A%0Aimport java.util.List;%0Aimport java.util.concurrent.RunnableFuture;%0A%0Aimport graphics.epi.R;%0Aimport graphics.epi.utils.Geometry;%0Aimport graphics.epi.vision.VisionAction;%0Aimport graphics.epi.vision.VisionExecutor;%0Aimport graphics.epi.vision.VisionListener;%0Aimport graphics.epi.vision.analyze.SquareFinder;%0A%0Apublic class SquareFinderTest extends AndroidTestCase implements VisionListener %7B%0A    private final static String TAG = %22SquareFinderTest%22; // FIXME from class name%0A%0A    boolean openCVLoaded;%0A    VisionExecutor executor;%0A    List%3CGeometry.Quad%3E squares = null;%0A%0A    @Override%0A    public void setUp() %7B%0A        openCVLoaded = false;%0A        OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_6, mContext, mLoaderCallback);%0A        while(!openCVLoaded) %7B%7D%0A%0A        executor = new VisionExecutor();%0A    %7D%0A%0A    public void testSquareFinder() %7B%0A        BitmapFactory bmpFactory = new BitmapFactory();%0A        Bitmap image = bmpFactory.decodeResource(mContext.getResources(), R.drawable.phone_bad);%0A%0A        assertNotNull(image);%0A%0A        RunnableFuture task = new SquareFinder(this, image); // FIXME load image from resources%0A        executor.execute(task);%0A%0A        while(squares == null) %7B%7D%0A%0A        Log.d(TAG, %22found %22 + squares.size() + %22 squares.%22);%0A        for(Geometry.Quad square: squares) %7B%0A            Log.d(TAG, square.toString());%0A        %7D%0A    %7D%0A%0A    @Override%0A    public void OnVisionActionComplete(VisionAction action) %7B%0A        try %7B%0A            Bundle result = (Bundle)action.get();%0A            squares = result.getParcelableArrayList(%22squares%22);%0A        %7D catch(Exception e) %7B%0A            Log.e(TAG, Log.getStackTraceString(e));%0A        %7D%0A    %7D%0A%0A    private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(mContext) %7B%0A        @Override%0A        public void onManagerConnected(int status) %7B%0A            switch (status) %7B%0A                case LoaderCallbackInterface.SUCCESS:%0A                %7B%0A                    openCVLoaded = true;%0A                    Log.d(TAG, %22OpenCV loaded successfully%22);%0A                %7D break;%0A                default:%0A                %7B%0A                    super.onManagerConnected(status);%0A                %7D break;%0A            %7D%0A        %7D%0A    %7D;%0A%7D%0A

Test of SquareFinder algorithm on sample image.