def testRowsCells (self): suffix = u'' dlg = TableDialog (self.wnd) controller = TableDialogController (dlg, suffix, self._application.config) dlg.colsCount = 5 dlg.rowsCount = 3 Tester.dialogTester.appendOk() controller.showDialog() result = controller.getResult() validResult = u'''(:table border="1":) (:row:) (:cell:) (:cell:) (:cell:) (:cell:) (:cell:) (:row:) (:cell:) (:cell:) (:cell:) (:cell:) (:cell:) (:row:) (:cell:) (:cell:) (:cell:) (:cell:) (:cell:) (:tableend:)''' self.assertEqual (result, validResult, result)
def testColsCount (self): dlg = TableDialog (self.wnd) Tester.dialogTester.appendOk() controller = TableDialogController (dlg, self._application.config) dlg.colsCount = 10 controller.showDialog() dlg2 = TableDialog (self.wnd) controller2 = TableDialogController (dlg2, self._application.config) self.assertEqual (dlg2.colsCount, 10) Tester.dialogTester.appendOk() controller2.showDialog()
def testBorder_02 (self): suffix = u'' dlg = TableDialog (self.wnd) controller = TableDialogController (dlg, suffix, self._application.config) Tester.dialogTester.appendOk() dlg.borderWidth = 0 controller.showDialog() result = controller.getResult() validResult = u'''(:table:) (:row:) (:cell:) (:tableend:)''' self.assertEqual (result, validResult, result)
def testBorder_02 (self): dlg = TableDialog (self.wnd) controller = TableDialogController (dlg, self._application.config) Tester.dialogTester.appendOk() dlg.borderWidth = 0 controller.showDialog() result = controller.getResult() validResult = u'''<table> <tr> <td></td> </tr> </table>''' self.assertEqual (result, validResult, result)
def testBorder_01(self): dlg = TableDialog(self.mainWindow) controller = TableDialogController(dlg, self.application.config) Tester.dialogTester.appendOk() dlg.borderWidth = 10 controller.showDialog() result = controller.getResult() validResult = '''<table border="10"> <tr> <td></td> </tr> </table>''' self.assertEqual(result, validResult, result)
def _insertTable(self, param): editor = self._application.mainWindow.pagePanel.pageView.codeEditor parent = self._application.mainWindow with TableDialog(parent) as dlg: controller = TableDialogController(dlg, self._application.config) if controller.showDialog() == wx.ID_OK: result = controller.getResult() editor.replaceText(result)
def testColsCount(self): suffix = '' dlg = TableDialog(self.mainWindow) Tester.dialogTester.appendOk() controller = TableDialogController(dlg, suffix, self.application.config) dlg.colsCount = 10 controller.showDialog() dlg2 = TableDialog(self.mainWindow) controller2 = TableDialogController(dlg2, suffix, self.application.config) self.assertEqual(dlg2.colsCount, 10) Tester.dialogTester.appendOk() controller2.showDialog()
def testBorder_02(self): suffix = u'' dlg = TableDialog(self.wnd) controller = TableDialogController(dlg, suffix, self._application.config) Tester.dialogTester.appendOk() dlg.borderWidth = 0 controller.showDialog() result = controller.getResult() validResult = u'''(:table:) (:row:) (:cell:) (:tableend:)''' self.assertEqual(result, validResult, result)
def testCells (self): dlg = TableDialog (self.wnd) controller = TableDialogController (dlg, self._application.config) dlg.colsCount = 5 Tester.dialogTester.appendOk() controller.showDialog() result = controller.getResult() validResult = u'''<table border="1"> <tr> <td></td> <td></td> <td></td> <td></td> <td></td> </tr> </table>''' self.assertEqual (result, validResult, result)
def testHCells(self): suffix = '' dlg = TableDialog(self.mainWindow) controller = TableDialogController(dlg, suffix, self.application.config) dlg.colsCount = 5 dlg.rowsCount = 3 dlg.headerCells = True Tester.dialogTester.appendOk() controller.showDialog() result = controller.getResult() validResult = '''(:table border="1":) (:row:) (:hcell:) (:hcell:) (:hcell:) (:hcell:) (:hcell:) (:row:) (:cell:) (:cell:) (:cell:) (:cell:) (:cell:) (:row:) (:cell:) (:cell:) (:cell:) (:cell:) (:cell:) (:tableend:)''' self.assertEqual(result, validResult, result)
def testHCells(self): dlg = TableDialog(self.mainWindow) controller = TableDialogController(dlg, self.application.config) dlg.colsCount = 5 dlg.rowsCount = 3 dlg.headerCells = True Tester.dialogTester.appendOk() controller.showDialog() result = controller.getResult() validResult = '''<table border="1"> <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> </table>''' self.assertEqual(result, validResult, result)
def testCells(self): suffix = u'' dlg = TableDialog(self.wnd) controller = TableDialogController(dlg, suffix, self._application.config) dlg.colsCount = 5 Tester.dialogTester.appendOk() controller.showDialog() result = controller.getResult() validResult = u'''(:table border="1":) (:row:) (:cell:) (:cell:) (:cell:) (:cell:) (:cell:) (:tableend:)''' self.assertEqual(result, validResult, result)
def testDefault_suffix(self): suffix = u'20' dlg = TableDialog(self.wnd) Tester.dialogTester.appendOk() controller = TableDialogController(dlg, suffix, self._application.config) controller.showDialog() result = controller.getResult() validResult = u'''(:table20 border="1":) (:row20:) (:cell20:) (:table20end:)''' self.assertEqual(result, validResult, result)
def testDefault(self): suffix = '' dlg = TableDialog(self.mainWindow) Tester.dialogTester.appendOk() controller = TableDialogController(dlg, suffix, self.application.config) controller.showDialog() result = controller.getResult() validResult = '''(:table border="1":) (:row:) (:cell:) (:tableend:)''' self.assertEqual(result, validResult, result)
def func(param): editor = pageView.codeEditor tableSuffix = getTableByPos(editor.GetText(), editor.GetCurrentPosition()) if tableSuffix is None: suffix = u'' elif tableSuffix == u'': suffix = u'2' else: try: suffix = unicode(int(tableSuffix) + 1) except ValueError: suffix = u'' with TableDialog(parent) as dlg: controller = TableDialogController(dlg, suffix, application.config) if controller.showDialog() == wx.ID_OK: result = controller.getResult() editor.replaceText(result)