本文整理汇总了C++中History::execute_undo方法的典型用法代码示例。如果您正苦于以下问题:C++ History::execute_undo方法的具体用法?C++ History::execute_undo怎么用?C++ History::execute_undo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类History
的用法示例。
在下文中一共展示了History::execute_undo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: document
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);
}
}
示例2: document
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);
}