void TestHistory::run_015 (const char * path_0) { remove (path_0); Document document (Model::use (), 123456789UL, 'appl', 'gui '); { History <HistoryStoreFile> history (document, path_0); Root & root = document.root <Root> (); root._a._int = 2LL; root._a._float = 3.5; auto tx = document.commit (); history.add_undo_step (tx); } { History <HistoryStoreFile> history (document, path_0); Root & root = document.root <Root> (); bool ok_flag = history.execute_undo (); flip_TEST (ok_flag); flip_TEST (root._a._int == 0LL); flip_TEST (root._a._float== 0.0); } }
void TestUseCaseUndo::run_004 () { 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); 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 == 2.0); }