@@ -194,3 +194,62 @@ test("say statement", async () => {
194
194
subScene : [ ]
195
195
} ) ;
196
196
} ) ;
197
+
198
+ test ( "wait command" , async ( ) => {
199
+ const parser = new SceneParser ( ( assetList ) => {
200
+ } , ( fileName , assetType ) => {
201
+ return fileName ;
202
+ } , ADD_NEXT_ARG_LIST , SCRIPT_CONFIG ) ;
203
+
204
+ const result = parser . parse ( `wait:1000;` , 'test' , 'test' ) ;
205
+ expect ( result . sentenceList ) . toContainEqual ( {
206
+ command : commandType . wait ,
207
+ commandRaw : "wait" ,
208
+ content : "1000" ,
209
+ args : [ ] ,
210
+ sentenceAssets : [ ] ,
211
+ subScene : [ ]
212
+ } ) ;
213
+ } ) ;
214
+
215
+ test ( "changeFigure with duration and animation args" , async ( ) => {
216
+ const parser = new SceneParser ( ( assetList ) => {
217
+ } , ( fileName , assetType ) => {
218
+ return fileName ;
219
+ } , ADD_NEXT_ARG_LIST , SCRIPT_CONFIG ) ;
220
+
221
+ const result = parser . parse ( `changeFigure:stand.png -duration=1000 -enter=fadeIn -exit=fadeOut;` , 'test' , 'test' ) ;
222
+ expect ( result . sentenceList ) . toContainEqual ( {
223
+ command : commandType . changeFigure ,
224
+ commandRaw : "changeFigure" ,
225
+ content : "stand.png" ,
226
+ args : [
227
+ { key : 'duration' , value : 1000 } ,
228
+ { key : 'enter' , value : 'fadeIn' } ,
229
+ { key : 'exit' , value : 'fadeOut' }
230
+ ] ,
231
+ sentenceAssets : [ { name : "stand.png" , url : 'stand.png' , type : fileType . figure , lineNumber : 0 } ] ,
232
+ subScene : [ ]
233
+ } ) ;
234
+ } ) ;
235
+
236
+ test ( "changeBg with animation parameters" , async ( ) => {
237
+ const parser = new SceneParser ( ( assetList ) => {
238
+ } , ( fileName , assetType ) => {
239
+ return fileName ;
240
+ } , ADD_NEXT_ARG_LIST , SCRIPT_CONFIG ) ;
241
+
242
+ const result = parser . parse ( `changeBg:background.jpg -duration=2000 -enter=slideIn -transform={"alpha":0.8};` , 'test' , 'test' ) ;
243
+ expect ( result . sentenceList ) . toContainEqual ( {
244
+ command : commandType . changeBg ,
245
+ commandRaw : "changeBg" ,
246
+ content : "background.jpg" ,
247
+ args : [
248
+ { key : 'duration' , value : 2000 } ,
249
+ { key : 'enter' , value : 'slideIn' } ,
250
+ { key : 'transform' , value : '{"alpha":0.8}' }
251
+ ] ,
252
+ sentenceAssets : [ { name : "background.jpg" , url : 'background.jpg' , type : fileType . background , lineNumber : 0 } ] ,
253
+ subScene : [ ]
254
+ } ) ;
255
+ } ) ;
0 commit comments