@@ -8,6 +8,7 @@ import { JsonConverter } from '@src/model/JsonConverter';
88import { ScoreLoader } from '@src/importer/ScoreLoader' ;
99import { ComparisonHelpers } from '@test/model/ComparisonHelpers' ;
1010import { AlphaTexImporter } from '@src/importer/AlphaTexImporter' ;
11+ import { expect } from 'chai' ;
1112
1213describe ( 'Gp7ExporterTest' , ( ) => {
1314 async function loadScore ( name : string ) : Promise < Score | null > {
@@ -137,6 +138,34 @@ describe('Gp7ExporterTest', () => {
137138 ComparisonHelpers . expectJsonEqual ( expectedJson , actualJson , '<alphatex>' , [ 'accidentalmode' ] ) ;
138139 } ) ;
139140
141+ it ( 'alphatex-drumps-to-gp7' , ( ) => {
142+ const tex = `\\track "Drums"
143+ \\instrument percussion
144+ \\clef neutral
145+ \\articulation Kick 36
146+ \\articulation Unused 46
147+ Kick.4 42.4 Kick.4 42.4
148+ ` ;
149+
150+ const importer = new AlphaTexImporter ( ) ;
151+ importer . initFromString ( tex , new Settings ( ) ) ;
152+ const expected = importer . readScore ( ) ;
153+ const exported = exportGp7 ( expected ) ;
154+
155+ const actual = prepareImporterWithBytes ( exported ) . readScore ( ) ;
156+
157+ const expectedJson = JsonConverter . scoreToJsObject ( expected ) ;
158+ const actualJson = JsonConverter . scoreToJsObject ( actual ) ;
159+
160+ ComparisonHelpers . expectJsonEqual ( expectedJson , actualJson , '<alphatex>' , [ 'accidentalmode' ] ) ;
161+
162+ expect ( actual . tracks [ 0 ] . percussionArticulations ) . to . have . length ( 2 ) ;
163+ expect ( actual . tracks [ 0 ] . staves [ 0 ] . bars [ 0 ] . voices [ 0 ] . beats [ 0 ] . notes [ 0 ] . percussionArticulation ) . to . equal ( 0 )
164+ expect ( actual . tracks [ 0 ] . staves [ 0 ] . bars [ 0 ] . voices [ 0 ] . beats [ 1 ] . notes [ 0 ] . percussionArticulation ) . to . equal ( 1 ) ;
165+ expect ( actual . tracks [ 0 ] . staves [ 0 ] . bars [ 0 ] . voices [ 0 ] . beats [ 2 ] . notes [ 0 ] . percussionArticulation ) . to . equal ( 0 )
166+ expect ( actual . tracks [ 0 ] . staves [ 0 ] . bars [ 0 ] . voices [ 0 ] . beats [ 3 ] . notes [ 0 ] . percussionArticulation ) . to . equal ( 1 ) ;
167+ } ) ;
168+
140169 it ( 'gp7-lyrics-null' , async ( ) => {
141170 await testRoundTripEqual ( 'guitarpro7/lyrics-null.gp' , null ) ;
142171 } ) ;
0 commit comments