def test_repeatableAction(self): b = AwBrowser(None) b.setFields([{'name': 'Test'}, {'name': 'Item2'}]) b.setSelectionHandler(lambda a, b, c: print(a, b, c)) self.assertFalse(b._assignToLastField('Novo', False)) menuFn = b._makeMenuAction(b._fields[1], 'Test', False) menuFn() b._tryRepeat = True self.assertTrue(b._assignToLastField('Novo', False))
def test_textSelection(self): return b = AwBrowser(None) b.setFields([{'name': 'Test'}, {'name': 'Item2'}]) b.setSelectionHandler(lambda a, b, c: print(a, b, c)) b.selectedText = self.customSelected b.contextMenuEvent(FakeEvent())
def test_integratedView(self): app = QApplication(sys.argv) sys.argv.append("--disable-web-security") main = QMainWindow() view = AwBrowser(main, (900, 600)) view.setFields({0: 'Example', 1: 'Other'}) view.setInfoList(['No action available']) def handlerFn(f, v, l): print('Field: %s' % (f)) print('Link/Value: %s / %s' % (l, v)) view.setSelectionHandler(handlerFn) view.open('https://www.google.com/search?tbm=isch&tbs=isz:i&q={}', 'calendar', True) # view.open('file:///home/ricardo/mobel.md', 'calendar', True) sys.exit(app.exec_())
def test_close(self): b = AwBrowser(None, self.winSize) b.onClose()
def test_clearContext(self): global mw b = AwBrowser(None, self.winSize) b.clearContext()
def test_open(self): global mw b = AwBrowser(None, self.winSize) b.open('localhost/search?', 'ricardo')
def handlerFn(f, v, l): print('Field: %s' % (f)) print('Link/Value: %s / %s' % (l, v)) view.setSelectionHandler(handlerFn) view.open('https://www.google.com/search?tbm=isch&tbs=isz:i&q={}', 'calendar', True) # view.open('file:///home/ricardo/mobel.md', 'calendar', True) sys.exit(app.exec_()) if __name__ == '__main__': app = QApplication(sys.argv) # if '-view' in sys.argv: sys.argv.append("--disable-web-security") main = QMainWindow() view = AwBrowser(main, (800, 400)) view.setFields({0: 'Example', 1: 'Other'}) view.setInfoList(['No action available']) def handlerFn(f, v, l): print('Field: %s' % (f)) print('Link/Value: %s / %s' % (l, v)) view.setSelectionHandler(handlerFn) view.open('https://www.google.com/search?tbm=isch&tbs=isz:i&q={}', 'calendar', True) sys.exit(app.exec_()) # else: # sys.exit(unittest.main())
def test_close(self): b = AwBrowser(None) b.onClose()
def test_onContextMenu(self): b = AwBrowser(None) b.contextMenuEvent(FakeEvent())
def test_setFields(self): b = AwBrowser(None) b.setFields(TestNote().fields) self.assertTrue(b._fields)
def test_unload(self): global mw b = AwBrowser(None) b.unload()
b.setFields(TestNote().fields) self.assertTrue(b._fields) def test_onContextMenu(self): b = AwBrowser(None) b.contextMenuEvent(FakeEvent()) def test_close(self): b = AwBrowser(None) b.onClose() def test_installPage(self): pass if __name__ == '__main__': app = QApplication(sys.argv) if '-view' in sys.argv: main = QMainWindow() view = AwBrowser(main) view.setFields({0: 'Example'}) view.infoList = ['No action available'] def handlerFn(f, v, l): print(l) print(v) view._selectionHandler = handlerFn view.open('https://www.google.com/search?tbm=isch&tbs=isz:i&q={}', 'calendar') sys.exit(app.exec_()) else: unittest.main()