示例#1
0
 def test_selection_file_type(self):
     self.window.file_pattern = u"Does not exist (*.never)"
     self.window.ui_FileType.addItem(self.window.file_pattern)
     QtWidgets.QApplication.processEvents()
     self.window.selection_file_type()
     QtWidgets.QApplication.processEvents()
     QtWidgets.QApplication.processEvents()
     self.window.browse_folder()
     self.window.selection_directory()
     QtWidgets.QApplication.processEvents()
     assert self.window.filename is None
     self.window.ui_FileType.addItem(u"Text Files (*.txt)")
     QtWidgets.QApplication.processEvents()
     self.window.selection_file_type()
     QtWidgets.QApplication.processEvents()
     self.window.ui_FileList.setFocus()
     QtWidgets.QApplication.processEvents()
     self.window.ui_SelectedName.setText(u"example.txt")
     QtWidgets.QApplication.processEvents()
     self.window.action()
     QtWidgets.QApplication.processEvents()
     filename = u"{}{}{}".format(force_dir(ROOT_DIR),
                                 fs.path.forcedir(TESTDATA_DIR),
                                 u"example.txt")
     assert self.window.filename[7:] == filename
示例#2
0
 def test_filename_save_newname(self):
     self.window.ui_SelectedName.setText(u"newexample.txt")
     QtWidgets.QApplication.processEvents()
     self.window.action()
     QtWidgets.QApplication.processEvents()
     filename = u"{}{}{}".format(force_dir(ROOT_DIR),
                                 fs.path.forcedir(TESTDATA_DIR),
                                 u"newexample.txt")
     assert self.window.filename[7:] == filename
示例#3
0
 def test_select_directory(self):
     self.window.ui_FileList.selectRow(0)
     QtWidgets.QApplication.processEvents()
     self.window.onCellClicked(0, 0)
     QtWidgets.QApplication.processEvents()
     self.window.action()
     filename = u"{}{}{}".format(force_dir(ROOT_DIR),
                                 fs.path.forcedir(TESTDATA_DIR),
                                 self.window.ui_SelectedName.text())
     assert self.window.filename[7:] == filename
示例#4
0
 def test_default_filename(self):
     self.window.default_filename = u"abc.txt"
     self.window.show_action()
     QtWidgets.QApplication.processEvents()
     self.window.action()
     QtWidgets.QApplication.processEvents()
     filename = u"{}{}{}".format(force_dir(ROOT_DIR),
                                 fs.path.forcedir(TESTDATA_DIR),
                                 self.window.default_filename)
     assert self.window.filename[7:] == filename
示例#5
0
 def test_open_file_on_doubleClick(self):
     _names = [
         list(name)[0] for name in self.window.dir_list_items +
         self.window.file_list_items
     ]
     index = _names.index(u'example.csv')
     self.window.onCellDoubleClicked(index, 0)
     QtWidgets.QApplication.processEvents()
     filename = u"{}{}{}".format(force_dir(ROOT_DIR),
                                 fs.path.forcedir(TESTDATA_DIR),
                                 u"example.csv")
     assert self.window.filename[7:] == filename
示例#6
0
 def test_action(self, mockwarning, mockinformation):
     self.window.ui_SelectedName.setText(u"foo")
     QtWidgets.QApplication.processEvents()
     assert self.window.show_save_action is True
     self.window.action()
     assert QtWidgets.QMessageBox.No
     self.window.ui_SelectedName.setText(u"example.csv")
     QtWidgets.QApplication.processEvents()
     self.window.action()
     QtWidgets.QApplication.processEvents()
     assert QtWidgets.QMessageBox.Yes
     filename = u"{}{}{}".format(force_dir(ROOT_DIR),
                                 fs.path.forcedir(TESTDATA_DIR),
                                 u"example.csv")
     assert self.window.filename[7:] == filename
示例#7
0
 def test_action_in_subdir(self, mockwarning, mockinformation):
     self.window.ui_FileList.selectRow(0)
     QtWidgets.QApplication.processEvents()
     self.window.onCellDoubleClicked(0, 0)
     QtWidgets.QApplication.processEvents()
     self.window.ui_FileList.selectRow(0)
     QtWidgets.QApplication.processEvents()
     self.window.onCellClicked(0, 0)
     QtWidgets.QApplication.processEvents()
     self.window.action()
     QtWidgets.QApplication.processEvents()
     assert QtWidgets.QMessageBox.Yes
     filename = u"{}{}{}".format(
         force_dir(ROOT_DIR), fs.path.forcedir(TESTDATA_DIR),
         fs.path.join(self.window.selected_dir, u"foo.txt"))
     assert self.window.filename[7:] == filename
示例#8
0
 def test_subdirectory(self):
     _folder_names = [list(name)[0] for name in self.window.dir_list_items]
     index = _folder_names.index(u'bar')
     self.window.onCellDoubleClicked(index, 0)
     QtWidgets.QApplication.processEvents()
     _file_names = [list(name)[0] for name in self.window.file_list_items]
     assert _file_names[0] == fs.path.join(u"bar", u"foo.txt")
     self.window.onCellClicked(0, 0)
     QtWidgets.QApplication.processEvents()
     self.window.action()
     QtWidgets.QApplication.processEvents()
     self.window.close()
     filename = u"{}{}{}".format(
         force_dir(ROOT_DIR), fs.path.forcedir(TESTDATA_DIR),
         fs.path.join(self.window.selected_dir, u"foo.txt"))
     assert self.window.filename[7:] == filename