def fforwardMemento(self): ''' Redo through all items in memento. Make sure that the current selection match their respective registered selection in memento. ''' # Test initial self.assertEqual(self.memento[0][0], mayaUtils.getMayaSelectionList()) self.assertEqual(self.memento[0][1], ufeUtils.getUfeGlobalSelectionList()) # Skip first for m in self.memento[1:]: cmds.redo() self.assertEqual(m[0], mayaUtils.getMayaSelectionList()) self.assertEqual(m[1], ufeUtils.getUfeGlobalSelectionList())
def rewindMemento(self): ''' Undo through all items in memento. Make sure that the current selection match their respective registered selection in memento. ''' for m in reversed(self.memento[:-1]): cmds.undo() self.assertEqual(m[0], mayaUtils.getMayaSelectionList()) self.assertEqual(m[1], ufeUtils.getUfeGlobalSelectionList())
def snapShotAndTest(self, expectedResults=None): ''' Take a snapshot of the current selection in Maya and UFE. Test these selection on the expected results. If None are given, UFE and maya selections are equal. Args: expectedResults ([mayaSelection, ufeSelection]): Expected results to test on. ''' mayaSelection = mayaUtils.getMayaSelectionList() ufeSelection = ufeUtils.getUfeGlobalSelectionList() self.memento.append((mayaSelection, ufeSelection)) if expectedResults: self.assertEqual(self.memento[-1][0], expectedResults[0]) self.assertEqual(self.memento[-1][1], expectedResults[1]) else: self.assertEqual(self.memento[-1][0], self.memento[-1][1])