Exemple #1
0
class EditTools:
    def __init__(self, testInfo):
        self.testInfo = testInfo
        self.editToolsCheck = EditToolsCheck(self)

    def createNewPanels(self, n=3):
        """Creates n new panels using the New Button panel in Flix

        :param n: Number of new panels to be created
        :return: None
        """
        log('##### createNewPanels')

        for _ in range(0, n):
            click('newPanelBtn.png'); wait(2)

        self.editToolsCheck.createNewPanelsCheck(n)

    def copyPastePanel(self, panel="panel1.png"):
        """Copies and pastes a panel, given the name of its screenshot

        :param panel: Name of the Sikuli screenshot associated with the panel to be copy/pasted
        :return: None
        """
        log('##### copyPastePanel')

        if not click(panel):
            log('copyPastePanel: Could not find %s on screen, exiting test.' % panel, 'error')
            return

        click('copyBtn.png'); wait(1)
        click('pasteBtn.png'); wait(1)

        self.editToolsCheck.copyPastePanelCheck(panel)

    def duplicatePanel(self, panel="panel1.png"):
        """Duplicate a panel, given the name of its screenshot

        :param panel: Name of the Sikuli screenshot associated with the panel to be copy/pasted
        :return: None
        """
        log('##### duplicatePanel')

        if not click(panel):
            log('duplicatePanel: Could not find %s on screen, exiting test.' % panel, 'error')
            return

        click('duplicateBtn.png'); wait(1)

        self.editToolsCheck.duplicatePanelCheck(panel)

    def addDialogue(self, dialogue="Adding dialogue to panel [panelIndex].", firstPanel=1, lastPanel=3):
        """Adds dialogue to all of the panels currently in the sequence

        :param dialogue: String to add to every panel as the dialogue
        :param firstPanel: Panel index of first panel to add dialogue to
        :param lastPanel: Panel index of last panel to add dialogue to
        :return: None
        """
        log('##### addDialogue')

        panels = []
        for i in range(firstPanel, lastPanel+1):
            panels.append(i)
        log("addDialogue: Panel indices to add dialogue to: %s" % panels, "debug")
        url = "127.0.0.1:35980/html/index.html#show=%s;seq=%s;branch=%s;edit=%s;panel=%s" % \
              (self.testInfo.show,
               self.testInfo.sequence,
               self.testInfo.currentBranch,
               self.testInfo.getEditVersion(),
               panels[0])

        sikuliUtils.newChromeTab(url, closeCurrent=True); wait(5)

        click("dialogueField.png"); wait(1)
        for panel in panels:
            # Paste the dialogue (paste better than type as it keeps special characters)
            dial = dialogue.replace("[panelIndex]", str(panel))
            sikuli.paste(unicode(dial, "utf8")); wait(1)
            sikuli.type(sikuli.Key.ENTER, sikuli.KeyModifier.SHIFT); wait(1)

        self.editToolsCheck.addDialogueCheck(panels, dialogue)
Exemple #2
0
 def __init__(self, testInfo):
     self.testInfo = testInfo
     self.editToolsCheck = EditToolsCheck(self)