Ejemplo n.º 1
0
void  TestHistory::run_014 (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);
   }

   {
      Document document (Model2::use (), 123456789UL, 'appl', 'gui ');
      History <HistoryStoreFile> history (document, path_0);

      flip_TEST (document.data_model ().version () != history.version ());

      history.clear ();

      flip_TEST (document.data_model ().version () == history.version ());
   }
}
Ejemplo n.º 2
0
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 ());
   }
}