Project

General

Profile

Download (1.42 KB) Statistics
| Branch: | Revision:

git_sitools_idoc / flarecast / workspace / libraries / fr.cnes.sitools.captcha_1.0 / test / src / fr / cnes / sitools / captcha / CaptchaMain.java @ master

1
 /*******************************************************************************
2
 * Copyright 2010-2014 CNES - CENTRE NATIONAL d'ETUDES SPATIALES
3
 *
4
 * This file is part of SITools2.
5
 *
6
 * SITools2 is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * SITools2 is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with SITools2.  If not, see <http://www.gnu.org/licenses/>.
18
 ******************************************************************************/
19
package fr.cnes.sitools.captcha;
20

    
21
import java.awt.image.BufferedImage;
22

    
23
import nl.captcha.Captcha;
24
import nl.captcha.CaptchaBean;
25

    
26
public class CaptchaMain {
27

    
28
        /**
29
         * @param args
30
         */
31
        public static void main(String[] args) {
32
                // TODO Auto-generated method stub
33
                int width = 100;
34
                int height = 100;
35
                CaptchaBean captcha = new CaptchaBean(width, height);
36
                captcha.build();
37
                String answer = captcha.getAnswer();
38
                BufferedImage image = captcha.getImage();
39
                
40
                String userAnswer = "toto";
41
                boolean authorize = captcha.isCorrect(userAnswer);
42
        }
43

    
44
}