Search in sources :

Example 1 with GenericScore

use of blue.soundObject.GenericScore in project blue by kunstmusik.

the class LiveDataTest method testSerialization.

public void testSerialization() {
    LiveData liveData = new LiveData();
    final LiveObjectBins liveObjectBins = liveData.getLiveObjectBins();
    liveObjectBins.setLiveObject(0, 0, new LiveObject(new GenericScore()));
    liveObjectBins.setLiveObject(0, 2, new LiveObject(new GenericScore()));
    liveObjectBins.setLiveObject(0, 4, new LiveObject(new GenericScore()));
    liveObjectBins.setLiveObject(0, 6, new LiveObject(new GenericScore()));
    Element elem1 = liveData.saveAsXML(null);
    Element elem2;
    try {
        elem2 = LiveData.loadFromXML(elem1, null).saveAsXML(null);
        System.out.println(elem1.toString() + "\n\n" + elem2.toString());
        assertEquals(elem1.toString(), elem2.toString());
    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Did not load from xml");
    }
}
Also used : LiveObjectBins(blue.blueLive.LiveObjectBins) Element(electric.xml.Element) GenericScore(blue.soundObject.GenericScore) LiveObject(blue.blueLive.LiveObject)

Example 2 with GenericScore

use of blue.soundObject.GenericScore in project blue by kunstmusik.

the class LiveObjectBinsTest method testRemoveRow_Column.

@Test
public void testRemoveRow_Column() {
    LiveObjectBins instance = new LiveObjectBins();
    LiveObject liveObject = new LiveObject(new GenericScore());
    instance.setLiveObject(0, 2, liveObject);
    instance.insertColumn(0);
    instance.insertRow(0);
    assertEquals(1, instance.getColumnForObject(liveObject));
    assertEquals(3, instance.getRowForObject(liveObject));
    instance.removeRow(0);
    assertEquals(1, instance.getColumnForObject(liveObject));
    assertEquals(2, instance.getRowForObject(liveObject));
    instance.removeColumn(-1);
    assertEquals(1, instance.getColumnForObject(liveObject));
    assertEquals(2, instance.getRowForObject(liveObject));
    instance.removeColumn(0);
    assertEquals(0, instance.getColumnForObject(liveObject));
    assertEquals(2, instance.getRowForObject(liveObject));
    instance.removeColumn(0);
    assertEquals(1, instance.getColumnCount());
    assertEquals(8, instance.getRowCount());
}
Also used : GenericScore(blue.soundObject.GenericScore)

Example 3 with GenericScore

use of blue.soundObject.GenericScore in project blue by kunstmusik.

the class LiveObjectBinsTest method testSetLiveObject.

/**
 * Test of setLiveObject method, of class LiveObjectBins.
 */
@Test
public void testSetLiveObject() {
    System.out.println("setLiveObject");
    int column = 0;
    int row = 2;
    LiveObjectBins instance = new LiveObjectBins();
    LiveObject liveObject = new LiveObject(new GenericScore());
    instance.setLiveObject(column, row, liveObject);
    assertEquals(liveObject, instance.getLiveObject(column, row));
}
Also used : GenericScore(blue.soundObject.GenericScore)

Example 4 with GenericScore

use of blue.soundObject.GenericScore in project blue by kunstmusik.

the class LiveObjectBinsTest method testInsertColumn.

/**
 * Test of insertColumn method, of class LiveObjectBins.
 */
@Test
public void testInsertColumn() {
    LiveObjectBins instance = new LiveObjectBins();
    LiveObject liveObject = new LiveObject(new GenericScore());
    instance.setLiveObject(0, 2, liveObject);
    instance.insertColumn(1);
    assertEquals(2, instance.getColumnCount());
    assertEquals(liveObject, instance.getLiveObject(0, 2));
    instance.insertColumn(-1);
    assertEquals(3, instance.getColumnCount());
    assertEquals(liveObject, instance.getLiveObject(1, 2));
}
Also used : GenericScore(blue.soundObject.GenericScore)

Example 5 with GenericScore

use of blue.soundObject.GenericScore in project blue by kunstmusik.

the class LiveObjectTest method testSerialization.

/**
 * Test of getSoundObject method, of class blue.blueLive.LiveObject.
 */
public void testSerialization() {
    LiveObject liveObj = new LiveObject();
    liveObj.setSObj(new GenericScore());
    Element elem1 = liveObj.saveAsXML(null);
    Element elem2;
    try {
        elem2 = liveObj.loadFromXML(elem1, null).saveAsXML(null);
        assertEquals(elem1.toString(), elem2.toString());
    } catch (Exception ex) {
        ex.printStackTrace();
        fail("Did not load from xml");
    }
}
Also used : Element(electric.xml.Element) GenericScore(blue.soundObject.GenericScore)

Aggregations

GenericScore (blue.soundObject.GenericScore)15 SoundLayer (blue.SoundLayer)5 NoteList (blue.soundObject.NoteList)4 PolyObject (blue.soundObject.PolyObject)3 Test (org.junit.Test)3 CompileData (blue.CompileData)2 Score (blue.score.Score)2 ScoreObject (blue.score.ScoreObject)2 Layer (blue.score.layers.Layer)2 Element (electric.xml.Element)2 ArrayList (java.util.ArrayList)2 BlueData (blue.BlueData)1 SoundObjectLibrary (blue.SoundObjectLibrary)1 LiveObject (blue.blueLive.LiveObject)1 LiveObjectBins (blue.blueLive.LiveObjectBins)1 Instance (blue.soundObject.Instance)1 NoteParseException (blue.soundObject.NoteParseException)1 SoundObject (blue.soundObject.SoundObject)1 SoundObjectException (blue.soundObject.SoundObjectException)1 IOException (java.io.IOException)1