优化验证码效果

This commit is contained in:
whvcse@foxmail.com
2018-08-09 15:50:40 +08:00
parent 7defc7e727
commit 27af06eff5
9 changed files with 139 additions and 85 deletions

View File

@@ -13,37 +13,39 @@ public class CaptchaTest {
@Test
public void test() throws Exception {
for (int i = 0; i < 5; i++) {
/*for (int i = 0; i < 5; i++) {
SpecCaptcha specCaptcha = new SpecCaptcha();
//specCaptcha.setCharType(Captcha.TYPE_ONLY_NUMBER);
specCaptcha.setCharType(Captcha.TYPE_ONLY_UPPER);
System.out.println(specCaptcha.text());
//specCaptcha.out(new FileOutputStream(new File("D:/Java/aa" + i + ".png")));
}
specCaptcha.out(new FileOutputStream(new File("D:/Java/aa" + i + ".png")));
}*/
}
@Test
public void testGIf() throws Exception {
for (int i = 0; i < 5; i++) {
/*for (int i = 0; i < 5; i++) {
GifCaptcha gifCaptcha = new GifCaptcha();
System.out.println(gifCaptcha.text());
//gifCaptcha.out(new FileOutputStream(new File("D:/Java/aa" + i + ".gif")));
}
gifCaptcha.out(new FileOutputStream(new File("D:/Java/aa" + i + ".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("D:/Java/aa.png")));
/*for (int i = 0; i < 5; i++) {
ChineseCaptcha chineseCaptcha = new ChineseCaptcha();
System.out.println(chineseCaptcha.text());
chineseCaptcha.out(new FileOutputStream(new File("D:/Java/aa" + i + ".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("D:/Java/aa.gif")));
/*for (int i = 0; i < 5; i++) {
ChineseGifCaptcha chineseGifCaptcha = new ChineseGifCaptcha();
System.out.println(chineseGifCaptcha.text());
chineseGifCaptcha.out(new FileOutputStream(new File("D:/Java/aa" + i + ".gif")));
}*/
}
}