
    If                         d dl Z d dlZddlmZmZmZmZmZ  G d de j                        Z	 G d de	      Z
 G d d	e	      Zed
k(  r e j                          yy)    N   )PunctuationModeCallbackType
SSIPClientScopeSpeakerc                       e Zd Zd Zd Zy)_SSIPClientTestc                     t        d      | _        | j                  j                  d       | j                  j                  d       y )Ntesten   )r   _clientset_languageset_rateselfs    //usr/lib/python3/dist-packages/speechd/_test.pysetUpz_SSIPClientTest.setUp   s2    !&)!!$'b!    c                 8    | j                   j                          y )N)r   closer   s    r   tearDownz_SSIPClientTest.tearDown   s    r   N)__name__
__module____qualname__r   r    r   r   r
   r
      s    "
r   r
   c                       e Zd ZdZd Zy)AutomaticTestzA set of tests which may be evaluated automatically.

    Please put all tests which require a user to listen to their output to the
    VoiceTest below.

    c                    | j                   j                  d       t        j                  g t        j                  g t        j
                  g i| j                   j                  dfd       | j                   j                  dfd       t        j                  d       | j                   j                          | j                   j                  dfd	       t        j                  d
       t        j                  t        j                  t        j
                  fD cg c]  }|   	 c}\  }}}|ddgk(  r|dgk(  rd|v rd|v rd|vs	J df       y c c}w )Nflitez]This message should get interrupted.  It is hopefully long enough to last more than 1 second.c                 ,    |    j                  d      S )Nmsg1appendtypecalleds    r   <lambda>z.AutomaticTest.test_callbacks.<locals>.<lambda>8       1D1DV1L r   )callbackz0This second message should not be spoken at all.c                 ,    |    j                  d      S )Nmsg2r$   r&   s    r   r)   z.AutomaticTest.test_callbacks.<locals>.<lambda>:   r*   r   r   zHi.c                 ,    |    j                  d      S )Nmsg3r$   r&   s    r   r)   z.AutomaticTest.test_callbacks.<locals>.<lambda>>   r*   r      r#   r/   r-   zThis failure only indicates a possible error.  The test depends on proper timing and results may warry depending on the used output module and other conditions.  See the code of this test method if you want to investigate further.)
r   set_output_moduler   BEGINCANCELENDspeaktimesleepcancel)r   tstartedcanceledendedr(   s        @r   test_callbackszAutomaticTest.test_callbacks)   s\    	&&w/$$b%%r""B( 	 O$L 	 	N 	M$L 	 	N

15$L 	 	N 	

18D8J8J8D8K8K8D8H8H8J $K!F1I $K 5 66**u/@!f&8X%	 	 &%$Ks   $EN)r   r   r   __doc__r=   r   r   r   r   r   "   s    #r   r   c                   (    e Zd ZdZd Zd Zd Zd Zy)	VoiceTestzThis set of tests requires a user to listen to it.

    The success or failure of the tests defined here can not be detected
    automatically.

    c                     | j                   }|j                  d       |j                  t        j                         |j                  d       |j                  d       |j                  d       y )NzTesting data escapes:.zMarker at the end.
.
z.
Marker at the beginning.)r   r5   set_punctuationr   ALLr   cs     r   test_escapeszVoiceTest.test_escapesX   sQ    LL	'(	/--.		-.	/0r   c                 <   | j                   }|j                  d       |j                  d       |j                  d       |j                  d       |j                  d       |j                  d       |j                  d       |j                  d       |j                  d       |j                  d	       |j                  d       |j                  d       |j	                  d
       |j                  d       |j	                  d       |j                  d       y )NzTesting voice properties:izI am fat Billyd   zI am slim Willyr   zI am quick Dick.izI am slow Joe.izI am quiet Mariette.zI am noisy Daisy.)r   r5   	set_pitchr   
set_volumerE   s     r   test_voice_propertieszVoiceTest.test_voice_properties`   s    LL	+,	D	 !	C	!"	A	

3	"#	

3	 !	

1	C	S	&'	S	#$r   c                     | j                   }|j                  d       |j                  d       |j                  d       |j	                  d       y )NzTesting other commands:ashift_bempty)r   r5   charkey
sound_iconrE   s     r   test_other_commandszVoiceTest.test_other_commandss   s;    LL	)*	s	i	Wr   c           	         | j                   }|j                         D ]  }|j                  |       t        d|       |j	                  |dz          |j                         D ]=  \  }}}t        d||||       |j                  |       |j	                  |dz   |z          ? |j                  d      D ](  \  }}}t        d||||       |j                  d      r(J   y )Nz**zusing default voicez -z using voice fr)r   list_output_modulesr1   printr5   list_synthesis_voicesset_synthesis_voice
startswith)r   rF   modulenamelangvariants         r   
test_listszVoiceTest.test_listsz   s    \\--/ 

.V  (4 WWV223()(?(?(A 8$tWtVT49&&t,0$678 )*(?(?(E .$tWtVT49---.

.r   N)r   r   r   r>   rG   rL   rT   r`   r   r   r   r@   r@   P   s    1%&.r   r@   __main__)unittestr6   clientr   r   r   r   r   TestCaser
   r   r@   r   mainr   r   r   <module>rf      sY   $   M Mh'' *O *\6. 6.p zHMMO r   