Пример #1
0
    def testHCells(self):
        suffix = u''
        dlg = TableRowsDialog(self.wnd)
        controller = TableRowsDialogController(dlg, suffix,
                                               self._application.config)

        dlg.colsCount = 5
        dlg.rowsCount = 3
        dlg.headerCells = True
        Tester.dialogTester.appendOk()

        controller.showDialog()

        result = controller.getResult()

        validResult = u'''(:row:)
(:hcell:)
(:hcell:)
(:hcell:)
(:hcell:)
(:hcell:)
(:row:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:row:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)'''

        self.assertEqual(result, validResult, result)
Пример #2
0
    def testRowsCells(self):
        dlg = TableRowsDialog(self.mainWindow)
        controller = TableRowsDialogController(dlg, self._application.config)

        dlg.colsCount = 5
        dlg.rowsCount = 3
        Tester.dialogTester.appendOk()

        controller.showDialog()

        result = controller.getResult()

        validResult = '''<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>'''

        self.assertEqual(result, validResult, result)
Пример #3
0
    def testRowsCells(self):
        suffix = ''
        dlg = TableRowsDialog(self.mainWindow)
        controller = TableRowsDialogController(dlg, suffix,
                                               self.application.config)

        dlg.colsCount = 5
        dlg.rowsCount = 3
        Tester.dialogTester.appendOk()

        controller.showDialog()

        result = controller.getResult()

        validResult = '''(:row:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:row:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:row:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)'''

        self.assertEqual(result, validResult, result)
Пример #4
0
    def testRowsCells(self):
        dlg = TableRowsDialog(self.mainWindow)
        controller = TableRowsDialogController(dlg, self._application.config)

        dlg.colsCount = 5
        dlg.rowsCount = 3
        Tester.dialogTester.appendOk()

        controller.showDialog()

        result = controller.getResult()

        validResult = '''<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>'''

        self.assertEqual(result, validResult, result)
Пример #5
0
    def testRowsCells (self):
        suffix = u''
        dlg = TableRowsDialog (self.wnd)
        controller = TableRowsDialogController (dlg, suffix, self._application.config)

        dlg.colsCount = 5
        dlg.rowsCount = 3
        Tester.dialogTester.appendOk()

        controller.showDialog()

        result = controller.getResult()

        validResult = u'''(:row:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:row:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:row:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)
(:cell:)'''

        self.assertEqual (result, validResult, result)
Пример #6
0
    def testColsCount(self):
        dlg = TableRowsDialog(self.mainWindow)
        Tester.dialogTester.appendOk()

        controller = TableRowsDialogController(dlg, self._application.config)
        dlg.colsCount = 10
        controller.showDialog()

        dlg2 = TableRowsDialog(self.mainWindow)
        controller2 = TableRowsDialogController(dlg2, self._application.config)

        self.assertEqual(dlg2.colsCount, 10)

        Tester.dialogTester.appendOk()
        controller2.showDialog()
Пример #7
0
    def testColsCount(self):
        dlg = TableRowsDialog(self.mainWindow)
        Tester.dialogTester.appendOk()

        controller = TableRowsDialogController(dlg, self._application.config)
        dlg.colsCount = 10
        controller.showDialog()

        dlg2 = TableRowsDialog(self.mainWindow)
        controller2 = TableRowsDialogController(dlg2, self._application.config)

        self.assertEqual(dlg2.colsCount, 10)

        Tester.dialogTester.appendOk()
        controller2.showDialog()
Пример #8
0
    def _insertTableRows(self, param):
        editor = self.codeEditor
        parent = Application.mainWindow

        with TableRowsDialog(parent) as dlg:
            controller = TableRowsDialogController(dlg, Application.config)
            if controller.showDialog() == wx.ID_OK:
                result = controller.getResult()
                editor.replaceText(result)
Пример #9
0
    def testDefault(self):
        dlg = TableRowsDialog(self.wnd)
        Tester.dialogTester.appendOk()

        controller = TableRowsDialogController(dlg, self._application.config)
        controller.showDialog()

        result = controller.getResult()

        validResult = u'''<tr>
<td></td>
</tr>'''

        self.assertEqual(result, validResult, result)
Пример #10
0
    def testHCells(self):
        dlg = TableRowsDialog(self.wnd)
        controller = TableRowsDialogController(dlg, self._application.config)

        dlg.colsCount = 5
        dlg.rowsCount = 3
        dlg.headerCells = True
        Tester.dialogTester.appendOk()

        controller.showDialog()

        result = controller.getResult()

        validResult = u'''<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>'''

        self.assertEqual(result, validResult, result)
Пример #11
0
    def testDefault_suffix(self):
        suffix = '20'
        dlg = TableRowsDialog(self.mainWindow)
        Tester.dialogTester.appendOk()

        controller = TableRowsDialogController(dlg, suffix,
                                               self.application.config)
        controller.showDialog()

        result = controller.getResult()

        validResult = '''(:row20:)
(:cell20:)'''

        self.assertEqual(result, validResult, result)
Пример #12
0
    def testDefault(self):
        suffix = u''
        dlg = TableRowsDialog(self.wnd)
        Tester.dialogTester.appendOk()

        controller = TableRowsDialogController(dlg, suffix,
                                               self._application.config)
        controller.showDialog()

        result = controller.getResult()

        validResult = u'''(:row:)
(:cell:)'''

        self.assertEqual(result, validResult, result)
Пример #13
0
    def testHCells (self):
        dlg = TableRowsDialog (self.wnd)
        controller = TableRowsDialogController (dlg, self._application.config)

        dlg.colsCount = 5
        dlg.rowsCount = 3
        dlg.headerCells = True
        Tester.dialogTester.appendOk()

        controller.showDialog()

        result = controller.getResult()

        validResult = u'''<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>'''

        self.assertEqual (result, validResult, result)
Пример #14
0
    def func (param):
        editor = pageView.codeEditor
        tableSuffix = getTableByPos (editor.GetText(),
                                     editor.GetCurrentPosition())
        if tableSuffix is None:
            suffix = u''
        else:
            try:
                suffix = str(int(tableSuffix))
            except ValueError:
                suffix = u''

        with TableRowsDialog (parent) as dlg:
            controller = TableRowsDialogController (dlg, suffix, application.config)
            if controller.showDialog() == wx.ID_OK:
                result = controller.getResult()
                editor.replaceText(result)