void TestHistory::run_014b () { { Document document (Model::use (), 123456789UL, 'appl', 'gui '); History <HistoryStoreMemory> history (document); Root & root = document.root <Root> (); root._a._int = 2LL; root._a._float = 3.5; auto tx = document.commit (); history.add_undo_step (tx); history.clear (); flip_TEST (history.begin () == history.end ()); flip_TEST (history.last_undo () == history.end ()); flip_TEST (history.first_redo () == history.end ()); } }
void TestUseCaseUndo::run_005 () { Document document (Model::use (), 123456789UL, 'appl', 'gui '); Song & song = document.root <Song> (); Track & track = *song._tracks.emplace (); Clip & clip1 = *track._clips.emplace (1.0, 1.0); Clip & clip2 = *track._clips.emplace (5.0, 1.0); track._clips.emplace (2.5, 2.0); song._selection.emplace (clip1); song._selection.emplace (clip2); document.commit (); document.push (); History <HistoryStoreMemory> history (document); clip1._position = 2.0; document.commit (); auto tx = document.squash (); history.add_undo_step (tx); clip1._position = 3.5; document.commit (); tx = document.squash (); *history.last_undo () = tx; bool ok_flag = history.execute_undo (); flip_TEST (ok_flag); flip_TEST (clip1._position == 1.0); ok_flag = history.execute_redo (); flip_TEST (ok_flag); flip_TEST (clip1._position == 3.5); }