def test_merge_after_clean(self): with self.assert_n_commands_pushed(self.stack, 2): command = MergeableCommand() self.stack.push(command) self.stack.clean = True command = MergeableCommand() with self.assertTraitChanges(self.stack.undo_manager, 'stack_updated', count=1): self.stack.push(command)
def test_n_merge_command_pushed(self): n = 4 with self.assert_n_commands_pushed(self.stack, 1): self.command = MergeableCommand() self.stack.push(self.command) for i in range(n): command = MergeableCommand() with self.assertTraitChanges(self.stack.undo_manager, 'stack_updated', count=1): self.stack.push(command) self.assertEqual(self.command.amount, n + 1)
def test_merge_after_undo(self): with self.assert_n_commands_pushed(self.stack, 2): self.stack.push(self.command) command = MergeableCommand() self.stack.push(command) command = SimpleCommand() self.stack.push(command) self.stack.undo() command = MergeableCommand() with self.assertTraitChanges(self.stack.undo_manager, 'stack_updated', count=1): self.stack.push(command)
def test_1_merge_command_pushed(self): self.command = MergeableCommand() with self.assert_n_commands_pushed(self.stack, 1): with self.assertTraitChanges(self.stack.undo_manager, 'stack_updated', count=1): self.stack.push(self.command)