增加中文验证码功能

This commit is contained in:
synchronized
2018-07-28 00:22:49 +08:00
parent fda509dfe3
commit eeb7045f4d
9 changed files with 406 additions and 10 deletions

View File

@@ -14,11 +14,11 @@ public class CaptchaTest {
@Test
public void test() throws Exception {
for (int i = 0; i < 100; i++) {
for (int i = 0; i < 5; i++) {
SpecCaptcha specCaptcha = new SpecCaptcha();
specCaptcha.setCharType(Captcha.TYPE_ONLY_NUMBER);
//specCaptcha.setCharType(Captcha.TYPE_ONLY_NUMBER);
System.out.println(specCaptcha.text());
specCaptcha.out(new FileOutputStream(new File("D:/a/aa" + i + ".png")));
//specCaptcha.out(new FileOutputStream(new File("C:/aa" + i + ".png")));
}
}
@@ -26,6 +26,22 @@ public class CaptchaTest {
public void testGIf() throws Exception {
GifCaptcha gifCaptcha = new GifCaptcha(130, 48, 5);
System.out.println(gifCaptcha.text());
//gifCaptcha.out(new FileOutputStream(new File("D:/a/aa.gif")));
//gifCaptcha.out(new FileOutputStream(new File("C:/aa.gif")));
}
@Test
public void testHan() throws Exception {
ChineseCaptcha chineseCaptcha = new ChineseCaptcha();
//chineseCaptcha.setFont(new Font("微软雅黑", Font.PLAIN, 25));
System.out.println(chineseCaptcha.text());
//chineseCaptcha.out(new FileOutputStream(new File("C:/Java/aa.png")));
}
@Test
public void testGifHan() throws Exception {
ChineseGifCaptcha chineseGifCaptcha = new ChineseGifCaptcha();
//chineseGifCaptcha.setFont(new Font("微软雅黑", Font.PLAIN, 30));
System.out.println(chineseGifCaptcha.text());
chineseGifCaptcha.out(new FileOutputStream(new File("C:/Java/aa.gif")));
}
}