def test_ChangeProgram(self): cmd = CommandManager() machine = self.model.modules['machine'] cmd.add_prog(machine.properties['program_table'], 'p4', 4, {'change': {'length': 1}}) p = machine.properties['program_table']['p4'] cmd.change_prog_time(p, 12) self.assertEqual(p.time(), 12) cmd.undo() self.assertEqual(p.time(), 4) cmd.redo() self.assertEqual(p.time(), 12)
def test_RemoveProg(self): cmd = CommandManager() machine = self.model.modules['machine'] cmd.add_prog(machine.properties['program_table'], 'p4', 4, {'change': {'length': 1}}) p = machine.properties['program_table']['p4'] cmd.del_prog(machine.properties['program_table'], 'p4') self.assertNotIn('p4', machine.properties['program_table']) cmd.undo() self.assertIn('p4', machine.properties['program_table']) self.assertIs(machine.properties['program_table']['p4'], p) cmd.redo() self.assertNotIn('p4', machine.properties['program_table'])