示例#1
0
    def testGenerate(self):
        """
        Test generating new Overview-sheet from template, then assert that the
        sheet really exists and has generated content in it.
        """
        modifier1 = Modifier('aa')
        modifier2 = Modifier('bb')
        modifier3 = Modifier('cc')
        self.overview.modifiers = [modifier1, modifier2, modifier3]

        modAct1 = Action('attack 1', phases=2, hitPhase=1, default=True)
        modAct1.addModifier(0, Modifier('aa'))
        modAct1.addModifier(1, Modifier('bb'))
        self.overview.addAction(modAct1)

        formatter = OverviewFormatter(self.overview)
        formatter.generate(1)

        sheet = Sheet.getByName(names.getOverviewName(self.sheetName))
        data = cursor.getSheetContent(sheet)
        self.assertEqual(
            data, [['', '', '', '', '', '', '', '', '', '', ''],
                   [
                       'Action Name', 'Hit', 'Frames', 'Phase', 'DEF', 'aa',
                       'bb', 'cc', 'Notes 1', 'Notes 2', 'Notes 3'
                   ], ['attack 1', '', '', '0', 'x', 'x', '', '', '', '', ''],
                   ['attack 1', 'x', '', '1', 'x', '', 'x', '', '', '', '']])
 def testInputsConditionalFormats(self):
     inputSheet = Inputs(INPUT_LIST_SHEET_NAME)
     detailsUnoSheet = Sheet.getByName(self.detailsName)
     inputsConditionalFormat = conditionalFormat.createInputsConditionalFormat(
         detailsUnoSheet, inputSheet, self.view)
     self.assertGreater(inputsConditionalFormat.getCount(), 0)
     self.assertIn('Entry1', inputsConditionalFormat.getElementNames())
示例#3
0
 def _readSheetContent(self):
     self.sheet = Sheet.getByName(self.name)
     self.data = cursor.getSheetContent(self.sheet)
     self.headerRowIndex = helper.getHeaderRowPosition(self.data)
     self.dataBeginRow = self.headerRowIndex + 1
     self.nameColumnIndex = helper.getColumnPosition(
         self.data, 'Action Name', 0)
     self.hitColumnIndex = helper.getColumnPosition(self.data, 'Hit', 1)
     self.framesColumnIndex = helper.getColumnPosition(
         self.data, 'Frames', 2)
     self.phaseColumnIndex = helper.getColumnPosition(self.data, 'Phase', 3)
     self.defaultColumnIndex = helper.getColumnPosition(self.data, 'DEF', 4)
     self.notesIndex1 = helper.getColumnPosition(self.data, 'Notes 1', 5)
     self.notesIndex2 = helper.getColumnPosition(self.data, 'Notes 2', 6)
     self.notesIndex3 = helper.getColumnPosition(self.data, 'Notes 3', 7)
     self.dataHeader = self.data[self.headerRowIndex]
     self.dataRows = self._dataRows()
     self.modifierStartColumn = self.dataHeader.index(
         MODIFIER_START_COLUMN_NAME) + 1
     self.modifierEndColumn = self.dataHeader.index(
         MODIFIER_END_COLUMN_NAME)
     self.modifiers = self._readModifiers()
     self.actionNames = self._getUniqueActionNames()
     self._actions = self._readActions()
     self._highestPhase = self._getHighestPhase()
 def testResultsConditionalFormats(self):
     resultsSheet = Results(RESULT_LIST_SHEET_NAME)
     detailsUnoSheet = Sheet.getByName(self.detailsName)
     resultsConditionalFormat = conditionalFormat.createResultsConditionalFormat(
         detailsUnoSheet, resultsSheet)
     self.assertGreater(resultsConditionalFormat.getCount(), 0)
     self.assertIn('Entry1', resultsConditionalFormat.getElementNames())
 def testActionConditionalFormats(self):
     masterSheet = Master(MASTER_LIST_SHEET_NAME)
     detailsUnoSheet = Sheet.getByName(self.detailsName)
     actionConditionalFormat = conditionalFormat.createActionConditionalFormats(
         detailsUnoSheet, masterSheet, self.view)
     self.assertGreater(actionConditionalFormat.getCount(), 0)
     self.assertIn('Entry1', actionConditionalFormat.getElementNames())
示例#6
0
 def __init__(self, sheetName):
     self.name = sheetName
     self.sheet = Sheet.getByName(sheetName)
     self.data = cursor.getSheetContent(self.sheet)
     self.dataBeginRow = 2
     self.optionsColumnIndex = 0
     self.generateNamedRangesIndex = helper.getRowPosition(
         self.data, 'Generate Named Ranges:', self.optionsColumnIndex)
     self.showEntriesAscendingIndex = helper.getRowPosition(
         self.data, 'Show entries ascending when generating validation:',
         self.optionsColumnIndex)
     self.OptionsColors = helper.getCellColorsFromColumn(
         self.sheet, 1, self.dataBeginRow, len(self.data))
示例#7
0
 def __init__(self, sheetName):
     self.name = sheetName
     self.sheet = Sheet.getByName(sheetName)
     self.data = cursor.getSheetContent(self.sheet)
     self.headerRowIndex = helper.getHeaderRowPosition(self.data)
     self.dataBeginRow = self.headerRowIndex + 1
     self.resultColumnIndex = helper.getColumnPosition(
         self.data, 'Results', 0)
     self.colorColumnIndex = helper.getColumnPosition(self.data, 'Color', 1)
     self.dataRows = self.data[self.dataBeginRow:]
     self.resultNames = self._parseResults()
     self.resultColors = helper.getCellColorsFromColumn(
         self.sheet, self.colorColumnIndex, self.dataBeginRow,
         len(self.data))
示例#8
0
 def __init__(self, sheetName):
     self.name = sheetName
     self.sheet = Sheet.getByName(sheetName)
     self.data = cursor.getSheetContent(self.sheet)
     self.headerRowIndex = helper.getHeaderRowPosition(self.data)
     self.dataBeginRow = self.headerRowIndex + 1
     self.inputsColumnIndex = helper.getColumnPosition(
         self.data, 'Input List', 0)
     self.nameColumnIndex = helper.getColumnPosition(
         self.data, 'Input Name', 1)
     self.buttonColumnIndex = helper.getColumnPosition(
         self.data, 'Button', 2)
     self.colorColumnIndex = helper.getColumnPosition(self.data, 'Color', 3)
     self.dataHeader = self.data[self.headerRowIndex]
     self.dataRows = self.data[self.dataBeginRow:]
     self.inputColors = helper.getCellColorsFromColumn(
         self.sheet, self.colorColumnIndex, self.dataBeginRow,
         len(self.data))
     self.inputs = self._parseInputs()
示例#9
0
 def setUp(self):
     super().setUp()
     self.detailsUnoSheet = Sheet.getByName('Details (Default)')
示例#10
0
 def testGetSheetContent(self):
     masterSheet = Sheet.getByName(MASTER_LIST_SHEET_NAME)
     data = cursor.getSheetContent(masterSheet)
     for row in data:
         self.assertIsInstance(row, list)
示例#11
0
 def __init__(self, activeSheetName, message):
     Exception.__init__(self, message)
     self.activeSheet = Sheet.getByName(activeSheetName)