//package com.iplatform.base;
|
//
|
//import com.iplatform.base.captcha.BlockPuzzleCaptchaProvider;
|
//import com.iplatform.base.captcha.JigsawResult;
|
//import com.iplatform.base.util.VerifyImgUtil;
|
//
|
//import java.io.File;
|
//import java.util.concurrent.TimeUnit;
|
//
|
//public class TestCaptcha {
|
//
|
//// @Test
|
// public void testBlockPuzzle() throws Exception{
|
// BlockPuzzleCaptchaProvider puzzleCaptchaProvider = new BlockPuzzleCaptchaProvider();
|
// this.runBlockPuzzleOnce(puzzleCaptchaProvider, "001");
|
// TimeUnit.SECONDS.sleep(3);
|
// long startTime = System.nanoTime();
|
// this.runBlockPuzzleOnce(puzzleCaptchaProvider, "002");
|
// System.out.println("total times = " + (System.nanoTime() - startTime));
|
// }
|
//
|
// private void runBlockPuzzleOnce(BlockPuzzleCaptchaProvider puzzleCaptchaProvider, String filePrefix){
|
// JigsawResult result = (JigsawResult) puzzleCaptchaProvider.generateCaptcha(null);
|
// VerifyImgUtil.writeBase64ToFile(result.getImageSourceBase64(), new File("d:/tmp/" + filePrefix + "_src.png"));
|
// VerifyImgUtil.writeBase64ToFile(result.getImageBlockBase64(), new File("d:/tmp/" + filePrefix + "_block.png"));
|
// System.out.println(result.getX() + ", " + result.getY());
|
// }
|
//}
|