Search in sources :

Example 6 with LayoutSettings

use of com.xenoage.zong.musiclayout.settings.LayoutSettings in project Zong by Xenoage.

the class ScoreLayouterTest method testSampleFiles.

/**
 * Try to layout all official MusicXML 1.1 and 2.0 sample files.
 * We can not test for the correct layout of course, but at least
 * we want to have no exceptions.
 */
@Test
public void testSampleFiles() throws Exception {
    SymbolPool symbolPool = sync(new SymbolPoolReader("default"));
    LayoutSettings layoutSettings = LayoutSettingsReader.read(jsePlatformUtils().openFile("data/test/layout/LayoutSettingsTest.xml"));
    for (String file : MusicXmlScoreFileInputTest.getSampleFiles()) {
        try {
            // System.out.println(file);
            Score score = new MusicXmlScoreFileInput().read(jsePlatformUtils().openFile(file), file);
            Size2f areaSize = new Size2f(150, 10000);
            Context context = new Context(score, symbolPool, layoutSettings);
            Target target = Target.completeLayoutTarget(new ScoreLayoutArea(areaSize));
            ScoreLayouter layouter = new ScoreLayouter(context, target);
            layouter.createLayoutWithExceptions();
        } catch (Exception ex) {
            ex.printStackTrace();
            fail("Failed to layout file: " + file);
        }
    }
}
Also used : SymbolPoolReader(com.xenoage.zong.io.symbols.SymbolPoolReader) Score(com.xenoage.zong.core.Score) LayoutSettings(com.xenoage.zong.musiclayout.settings.LayoutSettings) Size2f(com.xenoage.utils.math.geom.Size2f) SymbolPool(com.xenoage.zong.symbols.SymbolPool) MusicXmlScoreFileInput(com.xenoage.zong.io.musicxml.in.MusicXmlScoreFileInput) MusicXmlScoreFileInputTest(com.xenoage.zong.io.musicxml.in.MusicXmlScoreFileInputTest) Test(org.junit.Test)

Aggregations

LayoutSettings (com.xenoage.zong.musiclayout.settings.LayoutSettings)6 SymbolPool (com.xenoage.zong.symbols.SymbolPool)4 Size2f (com.xenoage.utils.math.geom.Size2f)3 Score (com.xenoage.zong.core.Score)2 SymbolPoolReader (com.xenoage.zong.io.symbols.SymbolPoolReader)2 ScoreLayout (com.xenoage.zong.musiclayout.ScoreLayout)2 Context (com.xenoage.zong.musiclayout.layouter.Context)2 ScoreLayoutArea (com.xenoage.zong.musiclayout.layouter.ScoreLayoutArea)2 Target (com.xenoage.zong.musiclayout.layouter.Target)2 ChordWidths (com.xenoage.zong.musiclayout.settings.ChordWidths)2 IOException (java.io.IOException)2 Canvas (com.google.gwt.canvas.client.Canvas)1 Context2d (com.google.gwt.canvas.dom.client.Context2d)1 EntryPoint (com.google.gwt.core.client.EntryPoint)1 Element (com.google.gwt.dom.client.Element)1 BLOCK (com.google.gwt.dom.client.Style.Display.BLOCK)1 NONE (com.google.gwt.dom.client.Style.Display.NONE)1 PX (com.google.gwt.dom.client.Style.Unit.PX)1 DOM (com.google.gwt.user.client.DOM)1 Window (com.google.gwt.user.client.Window)1