@@ -26,6 +26,7 @@ const KeySignatureTests = {
26
26
run ( 'Altered key test' , majorKeysAltered ) ;
27
27
run ( 'End key with clef test' , endKeyWithClef ) ;
28
28
run ( 'Key Signature Change test' , changeKey ) ;
29
+ run ( 'Key Signature with/without clef symbol' , clefKeySignature ) ;
29
30
} ,
30
31
} ;
31
32
@@ -370,5 +371,33 @@ function changeKey(options: TestOptions): void {
370
371
options . assert . ok ( true , 'all pass' ) ;
371
372
}
372
373
374
+ function clefKeySignature ( options : TestOptions ) : void {
375
+ const f = VexFlowTests . makeFactory ( options , 900 ) ;
376
+ const stave = f . Stave ( { x : 10 , y : 10 , width : 800 } ) . addClef ( 'bass' ) . addTimeSignature ( 'C|' ) . setClefLines ( 'bass' ) ;
377
+
378
+ const voice = f
379
+ . Voice ( )
380
+ . setStrict ( false )
381
+ . addTickables ( [
382
+ f . KeySigNote ( { key : 'Bb' } ) ,
383
+ f . StaveNote ( { keys : [ 'c/4' ] , duration : '1' , clef : 'bass' } ) ,
384
+ f . BarNote ( ) ,
385
+ f . KeySigNote ( { key : 'D' , cancelKey : 'Bb' } ) ,
386
+ f . StaveNote ( { keys : [ 'c/4' ] , duration : '1' , clef : 'bass' } ) ,
387
+ f . BarNote ( ) ,
388
+ f . KeySigNote ( { key : 'Bb' } ) ,
389
+ f . StaveNote ( { keys : [ 'c/4' ] , duration : '1' , clef : 'bass' } ) ,
390
+ f . BarNote ( ) ,
391
+ f . KeySigNote ( { key : 'D' , alterKey : [ 'b' , 'n' ] } ) ,
392
+ f . StaveNote ( { keys : [ 'c/4' ] , duration : '1' , clef : 'bass' } ) ,
393
+ ] ) ;
394
+
395
+ f . Formatter ( ) . joinVoices ( [ voice ] ) . formatToStave ( [ voice ] , stave ) ;
396
+
397
+ f . draw ( ) ;
398
+
399
+ options . assert . ok ( true , 'all pass' ) ;
400
+ }
401
+
373
402
VexFlowTests . register ( KeySignatureTests ) ;
374
403
export { KeySignatureTests } ;
0 commit comments