def test_consoleClose(self): self.plugin = ciaa_plugin.mnu_EDUCIAA() self.plugin.item_Console(None,self.editor.plugin_interface) self.plugin.console.closeConsole() self.assertIsNone(self.plugin.console.ser)
def test_openSnippets(self): plugin = ciaa_plugin.mnu_EDUCIAA() plugin.item_Snippets(None,self.editor.plugin_interface) plugin.snippetsW.listW.set_cursor(1) # select 2nd snippet buff = plugin.snippetsW.txtSrc.get_buffer() text = buff.get_text(buff.get_start_iter(), buff.get_end_iter()) #compare text inserted in text field snippets window self.assertEqual("#Number to String example\n# Integer variable\nn = 5\n#n to String\nnString = str(n)\nprint(nString)\t\t\n#___________",text)
def test_sendScript_without_file(self): plugin = ciaa_plugin.mnu_EDUCIAA() plugin.item_Load_Script(None,self.editor.plugin_interface) timeout=15 while(plugin.loadScriptWindow.lblStatus.get_text()!="ERROR: Save File first" and timeout>0): time.sleep(1) print(plugin.loadScriptWindow.lblStatus.get_text()) timeout-=1 self.assertGreater(timeout,0)
def test_addSnippet(self): plugin = ciaa_plugin.mnu_EDUCIAA() plugin.item_Snippets(None,self.editor.plugin_interface) plugin.snippetsW.listW.set_cursor(1) # select 2nd snippet plugin.snippetsW.buttonOk.clicked() #compare text inserted in editor buff = self.editor.text_view.get_buffer() text = buff.get_text(buff.get_start_iter(), buff.get_end_iter()) self.assertEqual("#Number to String example\n# Integer variable\nn = 5\n#n to String\nnString = str(n)\nprint(nString)\t\t\n#___________",text)
def test_selectPort(self): plugin = ciaa_plugin.mnu_EDUCIAA() plugin.item_Configuration(None,self.editor.plugin_interface) plugin.configW.buttonOk.clicked() if hasattr(plugin.configW,"portSelected"): ps = plugin.configW.portSelected else: self.fail("There is not a serial terminal in the system") self.assertEquals("/dev/tty",ps[0:8])
def test_consoleRemoveText(self): self.plugin = ciaa_plugin.mnu_EDUCIAA() self.plugin.item_Console(None,self.editor.plugin_interface) buff = self.plugin.console.textbuffer textBefore = buff.get_text(buff.get_start_iter(), buff.get_end_iter()) self.plugin.console.removeText() textAfter = buff.get_text(buff.get_start_iter(), buff.get_end_iter()) self.assertEquals(textBefore[0:len(textBefore)-1],textAfter)
def test_consoleAddText(self): self.plugin = ciaa_plugin.mnu_EDUCIAA() self.plugin.item_Console(None,self.editor.plugin_interface) buff = self.plugin.console.textbuffer textBefore = buff.get_text(buff.get_start_iter(), buff.get_end_iter()) self.plugin.console.addText("Test String") textAfter = buff.get_text(buff.get_start_iter(), buff.get_end_iter()) self.assertEquals(textBefore+"Test String",textAfter)
def test_sendScript_wrong_port(self): self.editor.load_file("tests/test.py") self.cm.writeConfig("/dev/ttyUSBXXXXXX","") # wrong port plugin = ciaa_plugin.mnu_EDUCIAA() plugin.item_Load_Script(None,self.editor.plugin_interface) timeout=15 while(plugin.loadScriptWindow.lblStatus.get_text()!="Invalid PORT" and timeout>0): time.sleep(1) print(plugin.loadScriptWindow.lblStatus.get_text()) timeout-=1 self.assertGreater(timeout,0)
def test_sendScript(self): self.editor.load_file("tests/test.py") plugin = ciaa_plugin.mnu_EDUCIAA() plugin.item_Load_Script(None,self.editor.plugin_interface) print(">>>>>>>>>>>>>>> PRESS RESET BUTTON MANUALLY") timeout=15 while(plugin.loadScriptWindow.lblStatus.get_text()!="File copied" and timeout>0): time.sleep(1) print(plugin.loadScriptWindow.lblStatus.get_text()) timeout-=1 self.assertGreater(timeout,0)
def test_consoleRemoveTextLastLine(self): self.plugin = ciaa_plugin.mnu_EDUCIAA() self.plugin.item_Console(None,self.editor.plugin_interface) buff = self.plugin.console.textbuffer self.plugin.console.addText("\r\nTest String") textBefore = buff.get_text(buff.get_start_iter(), buff.get_end_iter()) self.plugin.console.removeTextLastLine() textAfter = buff.get_text(buff.get_start_iter(), buff.get_end_iter()) #print("Texto antes:") #print(textBefore) #print("Texto despues") #print(textAfter) self.assertEquals(textBefore.split("\r\n")[0]+"\r\n>>> ",textAfter)
def test_createConsoleWindow(self): self.plugin = ciaa_plugin.mnu_EDUCIAA() self.plugin.item_Console(None,self.editor.plugin_interface) self.assertIsNotNone(self.plugin.console)
def test_openConfig(self): plugin = ciaa_plugin.mnu_EDUCIAA() plugin.item_Configuration(None,self.editor.plugin_interface) portsLen = len(plugin.configW.ports) self.assertGreater(portsLen,0,"There is not a serial terminal in the system")