/*
 * Copyright (C) 2011 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.googlecode.leptonica.android.test;

import junit.framework.TestCase;

public class SkewTest extends TestCase {

}

@@ -677,49 +677,1711 @@
 se;%0A
-%0Apublic class SkewTest extends TestCase %7B%0A
+import android.graphics.Bitmap;%0Aimport android.graphics.Canvas;%0Aimport android.graphics.Color;%0Aimport android.graphics.Paint;%0Aimport android.graphics.Paint.Align;%0Aimport android.graphics.Paint.Style;%0Aimport android.test.suitebuilder.annotation.SmallTest;%0A%0Aimport com.googlecode.leptonica.android.GrayQuant;%0Aimport com.googlecode.leptonica.android.Pix;%0Aimport com.googlecode.leptonica.android.ReadFile;%0Aimport com.googlecode.leptonica.android.Skew;%0A%0Apublic class SkewTest extends TestCase %7B%0A%0A    private static final String SENTENCE = %22The quick brown fox jumps over the lazy dog.%22;%0A%0A    @SmallTest%0A    public void testFindSkew() %7B%0A        testFindSkew(SENTENCE, 640, 480, -15.0f);%0A        testFindSkew(SENTENCE, 640, 480, 0.0f);%0A        testFindSkew(SENTENCE, 640, 480, 15.0f);%0A    %7D%0A%0A    private void testFindSkew(String text, int width, int height, float requestedSkew) %7B%0A        Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);%0A        Paint paint = new Paint();%0A        Canvas canvas = new Canvas(bmp);%0A%0A        paint.setColor(Color.BLACK);%0A        paint.setStyle(Style.FILL);%0A        paint.setAntiAlias(true);%0A        paint.setTextAlign(Align.CENTER);%0A        paint.setTextSize(32.0f);%0A%0A        canvas.drawColor(Color.WHITE);%0A        canvas.rotate(requestedSkew, width / 2, height / 2);%0A        canvas.drawText(SENTENCE, width / 2, height / 2 , paint);%0A%0A        Pix pixs = ReadFile.readBitmap(bmp);%0A        Pix pixd = GrayQuant.pixThresholdToBinary(pixs, 1);%0A        float measuredSkew = -Skew.findSkew(pixd);%0A%0A        boolean isInRange = requestedSkew - 1 %3C measuredSkew && measuredSkew %3C requestedSkew + 1;%0A        assertTrue(%22Skew has incorrect value.%22, isInRange);%0A    %7D
 %0A%7D%0A

Add test for findSkew