Search in sources :

Example 1 with Base

use of musicxmltestsuite.tests.base.Base in project Zong by Xenoage.

the class LayoutTest method getScoreFrameLayoutOrException.

default ScoreFrameLayout getScoreFrameLayoutOrException() throws Exception {
    Base base = (Base) this;
    String filepath = Base.dirPath + base.getFileName();
    ScoreDoc doc = new MusicXmlScoreDocFileInput().read(jsePlatformUtils().openFile(filepath), filepath);
    ScoreLayout layout = new ScoreLayouter(doc, targetA4()).createScoreLayout();
    return layout.getScoreFrameLayout(0);
}
Also used : MusicXmlScoreDocFileInput(com.xenoage.zong.desktop.io.musicxml.in.MusicXmlScoreDocFileInput) ScoreLayouter(com.xenoage.zong.musiclayout.layouter.ScoreLayouter) ScoreLayout(com.xenoage.zong.musiclayout.ScoreLayout) Base(musicxmltestsuite.tests.base.Base) ScoreDoc(com.xenoage.zong.documents.ScoreDoc)

Example 2 with Base

use of musicxmltestsuite.tests.base.Base in project Zong by Xenoage.

the class VisualHtmlReport method collectTests.

/**
 * Gets all {@link Base} tests, except those who contain invalid scores (see {@link ErroneousScore}),
 * sorted by name.
 */
private void collectTests() throws Exception {
    List<Base> tests = alist();
    Reflections reflections = new Reflections("musicxmltestsuite.tests.base");
    for (Class<? extends Base> testClass : reflections.getSubTypesOf(Base.class)) {
        // ignore erroneous scores
        if (false == testClass.isAnnotationPresent(ErroneousScore.class)) {
            // easyMock library fails; it does not recognize the default methods; so we
            // use our own solution to instantiate the interface
            tests.add((Base) new InterfaceInstance(testClass).defineClass().newInstance());
        }
    }
    tests.sort(comparing(Base::getFileName));
    this.tests = tests;
}
Also used : InterfaceInstance(com.xenoage.utils.jse.reflection.InterfaceInstance) ErroneousScore(musicxmltestsuite.tests.utils.ErroneousScore) Base(musicxmltestsuite.tests.base.Base) Reflections(org.reflections.Reflections)

Example 3 with Base

use of musicxmltestsuite.tests.base.Base in project Zong by Xenoage.

the class VisualHtmlReport method start.

private void start() throws Throwable {
    collectTests();
    prepareDirectories();
    for (Base test : tests) {
        System.out.println("Processing " + test.getFileName() + " ...");
        File scoreFile = io().findNormalFile(Base.dirPath + test.getFileName());
        try {
            renderScore(scoreFile);
            copyLilypondImage(scoreFile);
        } catch (Exception ex) {
            throw new Exception("Error with " + scoreFile.getName(), ex);
        }
    }
    writeToHtmlFile();
}
Also used : File(java.io.File) Base(musicxmltestsuite.tests.base.Base) IOException(java.io.IOException)

Example 4 with Base

use of musicxmltestsuite.tests.base.Base in project Zong by Xenoage.

the class MusicXmlInTest method getScoreOrException.

default Score getScoreOrException() throws Exception {
    Base base = (Base) this;
    String filepath = Base.dirPath + base.getFileName();
    return new MusicXmlScoreFileInput().read(jsePlatformUtils().openFile(filepath), filepath);
}
Also used : MusicXmlScoreFileInput(com.xenoage.zong.io.musicxml.in.MusicXmlScoreFileInput) Base(musicxmltestsuite.tests.base.Base)

Aggregations

Base (musicxmltestsuite.tests.base.Base)4 InterfaceInstance (com.xenoage.utils.jse.reflection.InterfaceInstance)1 MusicXmlScoreDocFileInput (com.xenoage.zong.desktop.io.musicxml.in.MusicXmlScoreDocFileInput)1 ScoreDoc (com.xenoage.zong.documents.ScoreDoc)1 MusicXmlScoreFileInput (com.xenoage.zong.io.musicxml.in.MusicXmlScoreFileInput)1 ScoreLayout (com.xenoage.zong.musiclayout.ScoreLayout)1 ScoreLayouter (com.xenoage.zong.musiclayout.layouter.ScoreLayouter)1 File (java.io.File)1 IOException (java.io.IOException)1 ErroneousScore (musicxmltestsuite.tests.utils.ErroneousScore)1 Reflections (org.reflections.Reflections)1