Example #1
0
def test_serialize_chart_hold():
    chart = models.Chart()
    chart.author = 'foo'
    chart.difficulty = 'Beginner'
    chart.rating = 3

    measure = models.Measure(
        time=0.00,
        bpms=[(0.00, 240.00)],
        rows=8
    )
    measure.notes.append(Hold(
        position=Hold.POSITION_DOWN,
        note_type=Hold.TYPE_ROLL,
        offset=1,
        duration=0.25
    ))
    measure.notes.append(Hold(
        position=Hold.POSITION_UP,
        note_type=Hold.TYPE_HOLD,
        offset=2,
        duration=0.625
    ))

    chart.measures.append(measure)

    assert serialize.serialize_chart(chart) == CHART_HOLD
Example #2
0
def test_serialize_chart_hold_long_different_lens():
    chart = models.Chart()
    chart.author = 'foo'
    chart.difficulty = 'Beginner'
    chart.rating = 3

    first_measure = models.Measure(
        time=0.00,
        bpms=[(0.00, 240.00)],
        rows=4
    )
    first_measure.notes.append(Hold(
        position=Hold.POSITION_DOWN,
        note_type=Hold.TYPE_ROLL,
        offset=3,
        duration=0.375
    ))
    first_measure.notes.append(Hold(
        position=Hold.POSITION_LEFT,
        note_type=Hold.TYPE_HOLD,
        offset=1,
        duration=0.75
    ))
    second_measure = models.Measure(
        time=1.00,
        bpms=[(0.00, 240.00)],
        rows=8
    )

    chart.measures.append(first_measure)
    chart.measures.append(second_measure)

    assert serialize.serialize_chart(chart) == CHART_HOLD_LONG_DIFFERENT_LENS
Example #3
0
def test_serialize_chart_simple():
    chart = models.Chart()
    chart.author = 'foo'
    chart.difficulty = 'Beginner'
    chart.rating = 3

    measure = models.Measure(
        time=0.00,
        bpms=[(0.00, 240.00)],
        rows=4
    )
    measure.notes.append(Tap(
        position=Tap.POSITION_LEFT,
        note_type=Tap.TYPE_MINE,
        offset=0
    ))
    measure.notes.append(Tap(
        position=Tap.POSITION_RIGHT,
        note_type=Tap.TYPE_NORMAL,
        offset=3
    ))
    measure.notes.append(Tap(
        position=Tap.POSITION_UP,
        note_type=Tap.TYPE_NORMAL,
        offset=2
    ))

    chart.measures.append(measure)

    assert serialize.serialize_chart(chart) == CHART_SIMPLE