def test_basic_search(qtbot, tmpdir): ''' test to ensure basic find files functionality is working. ''' tmpdir.join('video1.avi').ensure() tmpdir.join('video1.srt').ensure() tmpdir.join('video2.avi').ensure() tmpdir.join('video2.srt').ensure() window = Window() window.show() qtbot.addWidget(window) window.fileComboBox.clear() qtbot.keyClicks(window.fileComboBox, '*.avi') window.directoryComboBox.clear() qtbot.keyClicks(window.directoryComboBox, str(tmpdir)) qtbot.mouseClick(window.findButton, QtCore.Qt.LeftButton) assert window.filesTable.rowCount() == 2 assert window.filesTable.item(0, 0).text() == 'video1.avi' assert window.filesTable.item(1, 0).text() == 'video2.avi'
def test_basic_search(qtbot, tmpdir): ''' test to ensure basic find files functionality is working. ''' tmpdir.join('video1.avi').ensure() tmpdir.join('video1.srt').ensure() tmpdir.join('video2.avi').ensure() tmpdir.join('video2.srt').ensure() # we create the widget to test and register it window = Window() window.show() qtbot.addWidget(window) # qtbot.waitForWindowShown(window) # sleep(3) window.fileComboBox.clear() # use qtbot methods to simulate user interaction with the dialog qtbot.keyClicks(window.fileComboBox, '*.avi') window.directoryComboBox.clear() qtbot.keyClicks(window.directoryComboBox, str(tmpdir)) qtbot.mouseClick(window.findButton, QtCore.Qt.LeftButton) assert window.filesTable.rowCount() == 2 assert window.filesTable.item(0, 0).text() == 'video1.avi' assert window.filesTable.item(1, 0).text() == 'video2.avi'
__author__ = 'esmab' import sys from PyQt5.QtCore import Qt from PyQt5.QtGui import * from PyQt5.QtWidgets import QGridLayout, QLabel, QLineEdit from PyQt5.QtWidgets import QTextEdit, QMenuBar,QWidget, QDialog, QApplication,QMainWindow #from PyQt5.QtWidgets.QMainWindow import QMainWindow from findfiles import Window class MRATFindFile(Window): def __init__(self, parent=None): super(MRATFindFile, self).__init__(parent) self.setupUi(self) if __name__ == '__main__': app = QApplication(sys.argv) form1 = Window() form1.show() sys.exit(app.exec_())