Ejemplo n.º 1
0
 def test_middle_c_at_with_explicit_clefs(self):
     staff = Staff((Mm(0), Mm(0)), Mm(100), self.flowable)
     Clef(staff, Mm(0), "treble")
     Clef(staff, Mm(10), "bass")
     # Test between two clefs should be in treble mode
     assert staff.middle_c_at(Mm(1)) == staff.unit(5)
     # Test after bass clef goes into effect
     assert staff.middle_c_at(Mm(11)) == staff.unit(-1)
Ejemplo n.º 2
0
 def test_middle_c_at_with_active_octave_line(self):
     staff = Staff((Mm(0), Mm(0)), Mm(100), self.flowable)
     Clef(staff, Mm(0), "treble")
     octave_line = OctaveLine((Mm(20), Mm(0)),
                              staff,
                              Mm(80),
                              indication="8va")
     # Before octave_line goes into effect
     assert staff.middle_c_at(Mm(0)) == staff.unit(5)
     # While octave_line is in effect
     assert staff.middle_c_at(Mm(20)) == staff.unit(8.5)
     assert staff.middle_c_at(Mm(100)) == staff.unit(8.5)
     # After octave_line ends
     assert staff.middle_c_at(Mm(101)) == staff.unit(5)
Ejemplo n.º 3
0
 def test_middle_c_at_with_implicit_default_clef(self):
     staff = Staff((Mm(0), Mm(0)), Mm(100), self.flowable)
     with pytest.raises(NoClefError):
         staff.middle_c_at(Mm(5))