def test_remove_component_by_instance(self): queue = core.ComponentQueue() comp = Component() queue.add(comp) removed_comp = queue.remove(comp) self.assertEqual(0, queue.length()) self.assertIs(comp, removed_comp)
def test_remove_component_by_index(self): queue = core.ComponentQueue() comp = Component('sphere1') queue.add(comp) removed_comp = queue.remove(0) self.assertEqual(0, queue.length()) self.assertIs(comp, removed_comp)
def __init__(self, queue=None, parent=None): super(QueueWidget, self).__init__(parent) self.setAcceptDrops(True) self.queue_layout = QtGui.QVBoxLayout(self) self.queue_layout.addStretch() self.queue = queue if queue else core.ComponentQueue() self.drop_indicator = DropIndicator() self.hide_indicator()
def test_component_break_point(self): queue = core.ComponentQueue() comp = Component(sphere_name='sphere1', break_point=True) queue.add(comp) comp = Component(sphere_name='sphere2') queue.add(comp) queue.execute() self.assertTrue(cmds.objExists('sphere1')) self.assertFalse(cmds.objExists('sphere2'))
def test_disable_component(self): queue = core.ComponentQueue() comp = Component(sphere_name='sphere1', enabled=False) queue.add(comp) comp = Component(sphere_name='sphere2') queue.add(comp) queue.execute() self.assertFalse(cmds.objExists('sphere1')) self.assertTrue(cmds.objExists('sphere2'))
def test_execute_queue(self): queue = core.ComponentQueue() comp = Component(sphere_name='sphere1') queue.add(comp) comp = Component(sphere_name='sphere2') queue.add(comp) queue.execute() self.assertTrue(cmds.objExists('sphere1')) self.assertTrue(cmds.objExists('sphere2'))
def test_load_queue_from_data(self): queue = core.ComponentQueue() comp1 = Component(sphere_name='sphere1') queue.add(comp1) comp2 = Component(sphere_name='sphere2') queue.add(comp2) data = queue.data() queue = core.load_data(data) queue.execute() self.assertTrue(cmds.objExists('sphere1')) self.assertTrue(cmds.objExists('sphere2'))
def test_export_queue(self): queue = core.ComponentQueue() comp1 = Component(sphere_name='sphere1') queue.add(comp1) comp2 = Component(sphere_name='sphere2') queue.add(comp2) file_path = self.get_temp_filename('queue.json') queue.export(file_path) queue = core.load_queue(file_path) queue.execute() self.assertTrue(cmds.objExists('sphere1')) self.assertTrue(cmds.objExists('sphere2'))
def test_queue_data(self): queue = core.ComponentQueue() comp1 = Component('sphere1') queue.add(comp1) comp2 = Component('sphere2') queue.add(comp2) data = queue.data() expected = [{ 'component_name': 'test_cmt_cqueue', 'enabled': True, 'break_point': False, 'uuid': comp1.uuid, 'sphere_name': 'sphere1', }, { 'component_name': 'test_cmt_cqueue', 'enabled': True, 'break_point': False, 'uuid': comp2.uuid, 'sphere_name': 'sphere2', }] self.assertEqual(expected, data)
def test_add_component_to_queue(self): queue = core.ComponentQueue() comp = Component() queue.add(comp) self.assertEqual(1, queue.length()) self.assertEqual(0, queue.index(comp))
def new_queue(self): """Clears the current queue and makes a new queue.""" self.queue_widget.set_queue(core.ComponentQueue())