def importAudioCheck(self, timeout): log('## importAudioCheck') if not exists('importAudioOK.png', timeout): self.importDrawing.testInfo.failed('importAudioCheck: No popup found after %s seconds.' % timeout) else: log('- Found popup after importing audio.') click('importAudioOK.png') sikuliUtils.saveVersion(self.importDrawing.testInfo, 'Imported audio.') # Check mp3 file is in the editorial directory checkUtils.newAudioFile(self.importDrawing.testInfo, methodName='importAudioCheck') # Check mp3 is in the shotEdit shotEdit = self.importDrawing.testInfo.getShotEdit() if shotEdit: mp3Found = pyUtils.findOccurences('.mp3', shotEdit) if mp3Found != 1: self.importDrawing.testInfo.failed('importAudioCheck: Expected 1 audio file in the shotEdit, ' 'found %s instead.' % mp3Found) else: log('- Found imported audio file in the current shotEdit.') self.importDrawing.testInfo.editAudio = 1 else: self.importDrawing.testInfo.failed('importAudioCheck: shotEdit not found, cannot check for audio.') log('All checks performed for importAudio.')
def openInPhotoshopCheck(testInfo, panel): """Checker function to verify if the panel in Flix was edited properly panel -- Image (.png) of the original panel that was edited """ log('## openInPhotoshopCheck:') panelName = panel.split('.')[0] if not exists(panelName + '_edited.png', 5): testInfo.failed('openInPhotoshopCheck: Could not find %s edited in Flix.' % panelName) else: log('- %s was edited.' % panelName) sikuliUtils.saveVersion(testInfo, 'Edited 1 panel in Photoshop.') """ # Check there's one more panel in the beats directory allPanels = pythonHelper.findBeat(testInfo, 'p') if (allPanels - len(testInfo.allPanels['p'])) != 1: testInfo.failed('openInPhotoshopCheck: Could not find 1 new panel in the beats directory.') else: log('- Found all 1 new panel in the beats directory.') #testInfo.allPanels['p'] = allPanels """ # Check it didn't create more panels in the current shotEdit newPanels = checkUtils.newPanelsInShotEdit(testInfo, {'p': 0}, methodName='openInPhotoshopCheck', beats=['p']) checkUtils.checkPanelDir(testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'openInPhotoshopCheck') log('All checks performed for openInPhotoshop.')
def importPanelsCheck(self, ext, nPanels, panelList, checkImage=True, replace=0): log('## importPanelsCheck') if checkImage: self.__checkImage(ext, nPanels, panelList) else: self.__checkDoneProcessing(ext, nPanels) sikuliUtils.saveVersion(self.importDrawing.testInfo, 'Imported %s %ss.' % (nPanels, ext)) # Check there's nPanels more panels in the current shotEdit if ext == 'mov': beat = 'a' else: beat = 'p' newPanels = checkUtils.newPanelsInShotEdit(self.importDrawing.testInfo, {beat: nPanels}, replace, beats=[beat], methodName='importPanelsCheck') checkUtils.checkPanelDir(self.importDrawing.testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'importPanelsCheck') # Check the pose for each panel was copied checkUtils.checkPanelPose(self.importDrawing.testInfo, newPanels, 'importPanelsCheck') if not replace: self.__checkDuration(ext, nPanels, panelList) log('All checks performed for importPanels.')
def replaceStillCheck(self): """After replacing a panel from Maya, this method checks the thumbnails have finished processing, the new panel(s) are present in the new saved shotEdit, the multitrack, jpeg, xml and json files have been created for the new panel(s). :return: None """ log('## replaceStillCheck') # Need to wait until Flix is done processing checkUtils.doneProcessing(self.fromMaya.testInfo, 10, methodName="replaceStillCheck") sikuliUtils.saveVersion(self.fromMaya.testInfo, 'Replaced a panel by a still from Maya.') # Check there's not more panels in the current shotEdit newPanels = checkUtils.newPanelsInShotEdit(self.fromMaya.testInfo, {'s': 0}, methodName='replaceStillCheck', beats=['s']) checkUtils.checkPanelDir(self.fromMaya.testInfo, newPanels, ['multitrack', 'jpg', 'xml', 'json'], 'replaceStillCheck') expectedDur = self.fromMaya.testInfo.editDuration foundDur = self.fromMaya.testInfo.getDurationFromShotEdit() if foundDur != expectedDur: self.fromMaya.testInfo.failed('replaceStillCheck: Expected duration to be %s, is %s instead.' % (expectedDur, foundDur)) else: log('- Edit duration unchanged as expected.') self.fromMaya.testInfo.editDuration = foundDur log('All checks performed for replaceStill.')
def addPlayblastCheck(self, duration): """After sending a playblast from Maya, this method checks the thumbnails have finished processing, the new panel(s) are present in the new saved shotEdit, the multitrack, jpeg, xml and json files have been created for the new panel(s). :param duration: Duration in frames of the playblast sent from Maya :return: None """ log('## addPlayblastCheck') # Need to wait until Flix is done processing, assuming 2 sec/frame for timeout timeout = 2*duration checkUtils.doneProcessing(self.fromMaya.testInfo, timeout, methodName="addPlayblastCheck") sikuliUtils.saveVersion(self.fromMaya.testInfo, 'Sent a playblast from Maya.') # Check there's 1 more panel in the current shotEdit newPanel = checkUtils.newPanelsInShotEdit(self.fromMaya.testInfo, {'a': 1}, beats=['a'], methodName='addPlayblastCheck') checkUtils.checkPanelDir(self.fromMaya.testInfo, newPanel, ['multitrack', 'jpg', 'xml', 'json'], 'addPlayblastCheck') expectedDur = self.fromMaya.testInfo.editDuration + duration foundDur = self.fromMaya.testInfo.getDurationFromShotEdit() if foundDur != expectedDur: self.fromMaya.testInfo.failed('addPlayblastCheck: Expected duration to be %s, is %s instead.' % (expectedDur, foundDur)) else: log('- Edit duration increased by %s frames as expected.' % duration) self.fromMaya.testInfo.editDuration = foundDur log('All checks performed for addPlayblast.')
def addStillsCheck(self, frames): """After sending a still from Maya to Flix, this method checks the thumbnail has stopped processing, the new panel(s) are present in the saved shotEdit, the multitrack, jpeg, xml and json files have been created for the new panel(s). :param frames: List of all the frames to be sent from Maya to Flix :return: None """ log('## addStillsCheck') # Need to wait until Flix is done processing checkUtils.doneProcessing(self.fromMaya.testInfo, 10, methodName="addStillsCheck") sikuliUtils.saveVersion(self.fromMaya.testInfo, 'Sent %s stills from Maya.' % len(frames)) # Check there's len(frames) more panels in the current shotEdit newPanels = checkUtils.newPanelsInShotEdit(self.fromMaya.testInfo, {'s': len(frames)}, beats=['s'], methodName='addStillsCheck') checkUtils.checkPanelDir(self.fromMaya.testInfo, newPanels, ['multitrack', 'jpg', 'xml', 'json'], 'addStillsCheck') expectedDur = self.fromMaya.testInfo.editDuration + (12*len(frames)) foundDur = self.fromMaya.testInfo.getDurationFromShotEdit() if foundDur != expectedDur: self.fromMaya.testInfo.failed('addStillsCheck: Expected duration to be %s, is %s instead.' % (expectedDur, foundDur)) else: log('- Edit duration increased by %s frames as expected.' % (12*len(frames))) self.fromMaya.testInfo.editDuration = foundDur log('All checks performed for addStills.')
def replaceSequencerShotCheck(self, duration): """After replacing a Flix panel with a shot from Maya, this method checks the thumbnails have finished processing, the new panel(s) are present in the new saved shotEdit, the multitrack, jpeg, xml and json files have been created for the new panel(s). :param duration: Total duration in frames of the shot sent from Maya :return: None """ log('## replaceSequencerShotCheck') # Need to wait until Flix is done processing, assuming 2 sec/frame for timeout timeout = 2*duration checkUtils.doneProcessing(self.fromMaya.testInfo, timeout, methodName="replaceSequencerShotCheck") sikuliUtils.saveVersion(self.fromMaya.testInfo, 'Replaced a panel by an animated panel from Maya.') # Check there's not more panels in the current shotEdit newPanel = checkUtils.newPanelsInShotEdit(self.fromMaya.testInfo, {'a': 0}, methodName='replaceSequencerShotCheck', beats=['a']) checkUtils.checkPanelDir(self.fromMaya.testInfo, newPanel, ['multitrack', 'jpg', 'xml', 'json'], 'replaceSequencerShotCheck') expectedDur = self.fromMaya.testInfo.editDuration foundDur = self.fromMaya.testInfo.getDurationFromShotEdit() if foundDur != expectedDur: self.fromMaya.testInfo.failed('replaceSequencerShotCheck: Expected duration to be %s, is %s instead.' % (expectedDur, foundDur)) else: log('- Edit duration unchanged as expected.') self.fromMaya.testInfo.editDuration = foundDur log('All checks performed for replaceSequencerShot.')
def sbpToFlixCheck(self, sbpShow): log('## sbpToFlixCheck') # SBP creates an extra version for some reason self.fromSbp.testInfo.incrementEditVersion() if not self.__checkStartProcessing(): return # Read the CSV settings file for the given show to know what to expect self.settings = checkUtils.readSbpSettings(self.fromSbp.testInfo, sbpShow) if not self.__waitPopup(): return self.__waitProcessed() # Save the edit after the SBP import was successful sikuliUtils.saveVersion(self.fromSbp.testInfo, 'Imported %s from SBP.' % sbpShow) self.__waitEmptyDir() self.__countNewPanels() editPanels = self.fromSbp.testInfo.getPanelsFromShotEdit() self.__checkNewPanels(editPanels) self.__checkMarkers() # TODO: Check audio file was created and audio tracks were copied over self.__updateTestInfo(editPanels) log('All checks performed for sbpToFlix.')
def duplicatePanelCheck(self, panel): log('## duplicatePanelCheck') # Make sure the duplicated panel is found twice on screen try: matches = list(sikuli.findAll(panel)) n = len(matches) if n != 2: self.editTools.testInfo.failed('duplicatePanelCheck: Expected 2 instances of %s, found %s instead.' % (panel, n)) else: log('- Found both instances of the duplicated panel on screen.') except FindFailed: self.editTools.testInfo.failed('duplicatePanelCheck: Could not find any instance of %s on screen.' % panel) sikuliUtils.saveVersion(self.editTools.testInfo, 'Duplicated one panel.') # Check there's 1 more panel in the new shotEdit newPanels = checkUtils.newPanelsInShotEdit(self.editTools.testInfo, {'p': 1}, beats=['p'], methodName='copyPastePanelCheck') # Check the new panel has everything in its directory checkUtils.checkPanelDir(self.editTools.testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'duplicatePanelCheck') log('All checks performed for duplicatePanelCheck.')
def createNewPanelsCheck(self, n): """Checker function to verify the n new panels were created n -- Number of panels created """ log('## createNewPanelsCheck') if not exists('%sblankPanels.png' % n): self.editTools.testInfo.failed('createNewPanelsCheck: Could not find the %s new created panels on screen.' % n) else: log('- Found all %s new panels on screen.' % n) sikuliUtils.saveVersion(self.editTools.testInfo, 'Created %s new blank panels.' % n) """ # Check there's n more panels in the beats directory allPanels = pythonHelper.findBeat(self.editTools.testInfo, 'p') if (allPanels - len(self.editTools.testInfo.allPanels['p'])) != n: self.editTools.testInfo.failed('createNewPanelsCheck: Expected %s new panels in the beats directory, found %s instead.' % (n, allPanels - len(self.editTools.testInfo.allPanels['p']))) else: log('- Found all %s new panels in the beats directory.' % n) """ # Check there's n more panels in the current shotEdit newPanels = checkUtils.newPanelsInShotEdit(self.editTools.testInfo, {'p': n}, beats=['p'], methodName='createNewPanelsCheck') checkUtils.checkPanelDir(self.editTools.testInfo, newPanels, ['multitrack', 'jpg', 'xml'], 'createNewPanelsCheck') log('All checks performed for createNewPanels.')
def addDialogueCheck(self, panels, dialogue): """Checks the dialogue has been saved in each panel's multitrack :param panels: Array of panel indices to check for dialogue :param dialogue: String added to each panel as dialogue :return: None """ log('## addDialogueCheck') sikuliUtils.saveVersion(self.editTools.testInfo, 'Added dialogue to %s panels.' % len(panels)) editPanels = self.editTools.testInfo.getPanelsFromShotEdit(perBeat=False) missing = [] for panel in panels: multitrackDialogue = self.editTools.testInfo.getPanelDialogue(editPanels[panel-1]) if dialogue.replace("[panelIndex]", str(panel)) == multitrackDialogue: log("addDialogueCheck: Found dialogue in %s's multitrack." % editPanels[panel-1], "debug") else: missing.append(editPanels[panel-1]) log("addDialogueCheck: Couldn't find dialogue in %s's multitrack." % editPanels[panel-1], "error") self.editTools.testInfo.dialogue[editPanels[panel-1]] = multitrackDialogue if len(missing): self.editTools.testInfo.failed("addDialogue: Failed to find dialogue in the following panels' multitracks: " "%s" % missing) else: log("addDialogueCheck: Found dialogue in every panel's multitrack.") log('All checks performed for addDialogue.')
def copyPastePanelCheck(self, panel): log('## copyPastePanelCheck') # Make sure the copy/pasted panel is found twice on screen try: matches = list(sikuli.findAll(panel)) n = len(matches) if n != 2: self.editTools.testInfo.failed('copyPastePanelCheck: Expected 2 instances of %s, found %s instead.' % (panel, n)) else: log('- Found both instances of the copy/pasted panel on screen.') except FindFailed: self.editTools.testInfo.failed('copyPastePanelCheck: Could not find any instance of %s on screen.' % panel) sikuliUtils.saveVersion(self.editTools.testInfo, 'Copy/pasted one panel.') # Check there's 1 more panel in the new shotEdit checkUtils.newPanelsInShotEdit(self.editTools.testInfo, {'p': 1}, beats=['p'], methodName='copyPastePanelCheck') log('All checks performed for copyPastePanelCheck.')