Esempio n. 1
0
    def test_revert_end(self):
        history = UndoHistory()
        self._populate_history(history)

        with self.assertTraitChanges(history, 'redoable', count=2):
            with self.assertTraitChanges(history, 'undoable', count=1):
                with self.assertTraitChanges(self._example,
                                             'anytrait',
                                             count=3):  # noqa: E501
                    history.revert()

        self.assertEqual(history.now, 0)
        self.assertFalse(history.can_undo)
        self.assertFalse(history.can_redo)
Esempio n. 2
0
    def test_revert_start(self):
        history = UndoHistory()
        self._populate_history(history)
        history.undo()
        history.undo()
        history.undo()

        with self.assertTraitDoesNotChange(history, 'undoable'):
            with self.assertTraitChanges(history, 'redoable', count=1):
                with self.assertTraitDoesNotChange(self._example, 'anytrait'):
                    history.revert()

        self.assertEqual(history.now, 0)
        self.assertFalse(history.can_undo)
        self.assertFalse(history.can_redo)