View Javadoc

1   /*
2    * JCaptcha, the open source java framework for captcha definition and integration
3    * Copyright (c)  2007 jcaptcha.net. All Rights Reserved.
4    * See the LICENSE.txt file distributed with this package.
5    */
6   
7   /*
8    * jcaptcha, the open source java framework for captcha definition and integration
9    * copyright (c)  2007 jcaptcha.net. All Rights Reserved.
10   * See the LICENSE.txt file distributed with this package.
11   */
12  
13  /*
14   * jcaptcha, the open source java framework for captcha definition and integration
15   * copyright (c)  2007 jcaptcha.net. All Rights Reserved.
16   * See the LICENSE.txt file distributed with this package.
17   */
18  package com.octo.captcha.component.sound.wordtosound;
19  
20  import junit.framework.TestCase;
21  import com.octo.captcha.component.sound.soundconfigurator.FreeTTSSoundConfigurator;
22  
23  /***
24   * <p/>
25   * Description: </p>
26   *
27   * @author Benoit Doumas
28   * @version 1.0
29   */
30  public class CleanFreeTTSWordToSoundTest extends TestCase {
31  
32      private CleanFreeTTSWordToSound cleanFreeTTSwordToSound;
33  
34      private String voiceName = "kevin16";
35  
36      private String voicePackage = "com.sun.speech.freetts.en.us.cmu_time_awb.AlanVoiceDirectory,com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory";
37  
38      /***
39       * Constructor for SimpleWordToImageTest.
40       */
41      public CleanFreeTTSWordToSoundTest(String name) {
42          super(name);
43      }
44  
45      public void setUp() {
46          this.cleanFreeTTSwordToSound = new CleanFreeTTSWordToSound(new FreeTTSSoundConfigurator(voiceName, voicePackage, 1.0f, 100, 100), 3, 6);
47  
48      }
49  
50      public void testConfiguration() {
51          this.cleanFreeTTSwordToSound.getSound("test");
52      }
53  
54  
55      public void testGetMaxAcceptedWordLength() {
56          assertEquals(this.cleanFreeTTSwordToSound.getMaxAcceptedWordLength(), 6);
57      }
58  
59      public void testGetMinAcceptedWordLength() {
60          assertEquals(this.cleanFreeTTSwordToSound.getMinAcceptedWordLength(), 3);
61      }
62  }