13
0

temporal: add rudimentary paste test

This commit is contained in:
Paul Davis 2023-06-07 13:39:22 -06:00
parent 1cf4f9293c
commit 01b8187cd3

View File

@ -31,8 +31,8 @@ TempoMapCutBufferTest::cutTest()
std::cerr << "\n\nBefore cut\n"; std::cerr << "\n\nBefore cut\n";
tmap->dump (std::cerr); tmap->dump (std::cerr);
TempoMapCutBuffer* cb = tmap->cut (timepos_t::from_superclock (tmap->superclock_at (BBT_Argument (8, 1, 0))), TempoMapCutBuffer* cb = tmap->cut (timepos_t::from_superclock (tmap->superclock_at (BBT_Argument (62, 1, 0))),
timepos_t::from_superclock (tmap->superclock_at (BBT_Argument (31, 1, 0))), timepos_t::from_superclock (tmap->superclock_at (BBT_Argument (300, 1, 0))),
false); false);
std::cerr << "Cut Buffer:\n"; std::cerr << "Cut Buffer:\n";
@ -52,4 +52,34 @@ TempoMapCutBufferTest::copyTest()
void void
TempoMapCutBufferTest::pasteTest() TempoMapCutBufferTest::pasteTest()
{ {
TempoMap::WritableSharedPtr tmap (TempoMap::write_copy());
(void) tmap->set_tempo (Tempo (180, 4), BBT_Argument (6, 1, 0));
(void) tmap->set_meter (Meter (6, 8), BBT_Argument (3, 1, 0));
(void) tmap->set_tempo (Tempo (180, 4), BBT_Argument (15, 1, 0));
(void) tmap->set_meter (Meter (3, 4), BBT_Argument (15, 1, 0));
(void) tmap->set_tempo (Tempo (180, 4), BBT_Argument (31, 1, 0));
(void) tmap->set_meter (Meter (5, 4), BBT_Argument (32, 1, 0));
TempoMapCutBuffer* cb = tmap->cut (timepos_t::from_superclock (tmap->superclock_at (BBT_Argument (8, 1, 0))),
timepos_t::from_superclock (tmap->superclock_at (BBT_Argument (31, 1, 0))),
false);
TempoMap* new_map = new TempoMap (Tempo (120, 4), Meter (7, 8));
std::cerr << "\n\nCut Buffer:\n";
cb->dump (std::cerr);
std::cerr << "Before paste\n";
new_map->dump (std::cerr);
new_map->paste (*cb, timepos_t::from_superclock (tmap->superclock_at (BBT_Argument (6, 1, 0))),
false);
std::cerr << "After paste\n";
new_map->dump (std::cerr);
delete new_map;
} }