Skip to content

Commit 6c5a4fb

Browse files
author
Daniel Kuschny
committed
Fixed MusicXML tests for JS
1 parent 8c6cf16 commit 6c5a4fb

9 files changed

Lines changed: 182 additions & 201 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ _ReSharper*/
5959
/Source/AlphaTab.Test.Js/test/TestFiles*
6060
/Source/AlphaTab.Test.Js/test/alphaTab.tests.js
6161
/Source/AlphaTab.Test.Js/test/alphaTab.tests.js.map
62+
/Source/AlphaTab.Test.Js/test/Results.trx
6263
/Build/CSharp/**/*.dll
6364
/Build/CSharp/**/*.pdb
6465
/Build/CSharp/**/*.xml

Source/AlphaTab.Test.Js/test/alphaTab.tests.specs.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,12 +667,8 @@ describe("alphaTab.test.importer.GpxImporterTest", function() {
667667
__instance.TestColors();
668668
});
669669
});
670-
xdescribe("alphaTab.test.importer.MusicXmlImporterSamplesTests", function() {
670+
describe("alphaTab.test.importer.MusicXmlImporterSamplesTests", function() {
671671
var __instance = new alphaTab.test.importer.MusicXmlImporterSamplesTests();
672-
it("Test_ActorPreludeSample", function(done) {
673-
alphaTab.test.TestPlatform.Done = done;
674-
__instance.Test_ActorPreludeSample();
675-
});
676672
it("Test_BeetAnGeSample", function(done) {
677673
alphaTab.test.TestPlatform.Done = done;
678674
__instance.Test_BeetAnGeSample();
@@ -742,7 +738,7 @@ xdescribe("alphaTab.test.importer.MusicXmlImporterSamplesTests", function() {
742738
__instance.Test_Telemann();
743739
});
744740
});
745-
xdescribe("alphaTab.test.importer.MusicXmlImporterTestSuiteTests", function() {
741+
describe("alphaTab.test.importer.MusicXmlImporterTestSuiteTests", function() {
746742
var __instance = new alphaTab.test.importer.MusicXmlImporterTestSuiteTests();
747743
it("Test_01a_Pitches_Pitches", function(done) {
748744
alphaTab.test.TestPlatform.Done = done;

Source/AlphaTab.Test.Js/test/karma.conf.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// Karma configuration
2-
process.env.CHROME_BIN = require('puppeteer').executablePath()
2+
try {
3+
process.env.CHROME_BIN = require('puppeteer').executablePath()
4+
}
5+
catch(e) { }
36

47
module.exports = function(config) {
58
config.set({

Source/AlphaTab.Test/Importer/MusicXmlImporterSamplesTest.cs

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,111 +12,103 @@ public class MusicXmlImporterSamplesTests : MusicXmlImporterTestBase
1212
[TestMethod, AsyncTestMethod]
1313
public void Test_BeetAnGeSample()
1414
{
15-
TestReference();
15+
TestReferenceFile("TestFiles/MusicXmlSamples/BeetAnGeSample.xml");
1616
}
1717

1818
[TestMethod, AsyncTestMethod]
1919
public void Test_Binchois()
2020
{
21-
TestReference();
21+
TestReferenceFile("TestFiles/MusicXmlSamples/Binchois.xml");
2222
}
2323

2424
[TestMethod, AsyncTestMethod]
2525
public void Test_BrahWiMeSample()
2626
{
27-
TestReference();
27+
TestReferenceFile("TestFiles/MusicXmlSamples/BrahWiMeSample.xml");
2828
}
2929

3030
[TestMethod, AsyncTestMethod]
3131
public void Test_BrookeWestSample()
3232
{
33-
TestReference();
33+
TestReferenceFile("TestFiles/MusicXmlSamples/BrookeWestSample.xml");
3434
}
3535

3636
[TestMethod, AsyncTestMethod]
3737
public void Test_Chant()
3838
{
39-
TestReference();
39+
TestReferenceFile("TestFiles/MusicXmlSamples/Chant.xml");
4040
}
4141

4242
[TestMethod, AsyncTestMethod]
4343
public void Test_DebuMandSample()
4444
{
45-
TestReference();
45+
TestReferenceFile("TestFiles/MusicXmlSamples/DebuMandSample.xml");
4646
}
4747

4848
[TestMethod, AsyncTestMethod]
4949
public void Test_Dichterliebe01()
5050
{
51-
TestReference();
51+
TestReferenceFile("TestFiles/MusicXmlSamples/Dichterliebe01.xml");
5252
}
5353

5454
[TestMethod, AsyncTestMethod]
5555
public void Test_Echigo()
5656
{
57-
TestReference();
57+
TestReferenceFile("TestFiles/MusicXmlSamples/Echigo.xml");
5858
}
5959

6060
[TestMethod, AsyncTestMethod]
6161
public void Test_FaurReveSample()
6262
{
63-
TestReference();
63+
TestReferenceFile("TestFiles/MusicXmlSamples/FaurReveSample.xml");
6464
}
6565

6666
[TestMethod, AsyncTestMethod]
6767
public void Test_MahlFaGe4Sample()
6868
{
69-
TestReference();
69+
TestReferenceFile("TestFiles/MusicXmlSamples/MahlFaGe4Sample.xml");
7070
}
7171

7272
[TestMethod, AsyncTestMethod]
7373
public void Test_MozaChloSample()
7474
{
75-
TestReference();
75+
TestReferenceFile("TestFiles/MusicXmlSamples/MozaChloSample.xml");
7676
}
7777

7878
[TestMethod, AsyncTestMethod]
7979
public void Test_MozartPianoSonata()
8080
{
81-
TestReference();
81+
TestReferenceFile("TestFiles/MusicXmlSamples/MozartPianoSonata.xml");
8282
}
8383

8484
[TestMethod, AsyncTestMethod]
8585
public void Test_MozartTrio()
8686
{
87-
TestReference();
87+
TestReferenceFile("TestFiles/MusicXmlSamples/MozartTrio.xml");
8888
}
8989

9090
[TestMethod, AsyncTestMethod]
9191
public void Test_MozaVeilSample()
9292
{
93-
TestReference();
93+
TestReferenceFile("TestFiles/MusicXmlSamples/MozaVeilSample.xml");
9494
}
9595

9696
[TestMethod, AsyncTestMethod]
9797
public void Test_Saltarello()
9898
{
99-
TestReference();
99+
TestReferenceFile("TestFiles/MusicXmlSamples/Saltarello.xml");
100100
}
101101

102102
[TestMethod, AsyncTestMethod]
103103
public void Test_SchbAvMaSample()
104104
{
105-
TestReference();
105+
TestReferenceFile("TestFiles/MusicXmlSamples/SchbAvMaSample.xml");
106106
}
107107

108108
[TestMethod, AsyncTestMethod]
109109
public void Test_Telemann()
110110
{
111-
TestReference();
112-
}
113-
114-
private void TestReference([CallerMemberName] string caller = null, string renderLayout = "page", bool renderAllTracks = true)
115-
{
116-
var fileId = caller.Split('_')[1];
117-
const string path = "TestFiles/MusicXmlSamples/";
118-
var file = path + fileId + ".xml";
119-
TestReferenceFile(file, score => { }, renderLayout, renderAllTracks);
111+
TestReferenceFile("TestFiles/MusicXmlSamples/Telemann.xml");
120112
}
121113
}
122114
}

Source/AlphaTab.Test/Importer/MusicXmlImporterTestBase.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ internal MusicXmlImporter PrepareImporterWithBytes(byte[] buffer)
7575
// }, false);
7676
// }
7777

78-
protected void TestReferenceFile(string file, Action<Score> done, string renderLayout = "page", bool renderAllTracks = false)
78+
protected void TestReferenceFile(string file, Action<Score> done = null, string renderLayout = "page", bool renderAllTracks = false)
7979
{
8080
TestPlatform.LoadFile(file, fileData =>
8181
{
@@ -99,8 +99,10 @@ protected void TestReferenceFile(string file, Action<Score> done, string renderL
9999
}
100100

101101
#endif
102-
103-
done(score);
102+
if (done != null)
103+
{
104+
done(score);
105+
}
104106
TestPlatform.Done();
105107
}
106108
catch (UnsupportedFormatException e)

0 commit comments

Comments
 (0)