2021-01-19 20:02:58 +00:00
|
|
|
import os
|
2018-11-30 00:40:18 +00:00
|
|
|
import vorta.models
|
2018-12-04 02:58:12 +00:00
|
|
|
import vorta.views
|
2021-01-19 20:02:58 +00:00
|
|
|
from PyQt5.QtWidgets import QApplication
|
|
|
|
from PyQt5 import QtCore
|
2018-11-30 00:40:18 +00:00
|
|
|
|
|
|
|
|
2020-03-03 05:19:36 +00:00
|
|
|
def test_add_folder(qapp, qtbot, tmpdir, monkeypatch, choose_file_dialog):
|
2018-12-04 02:58:12 +00:00
|
|
|
monkeypatch.setattr(
|
2018-12-05 09:05:47 +00:00
|
|
|
vorta.views.source_tab, "choose_file_dialog", choose_file_dialog
|
2018-12-04 02:58:12 +00:00
|
|
|
)
|
2020-03-03 05:19:36 +00:00
|
|
|
main = qapp.main_window
|
2018-11-30 00:40:18 +00:00
|
|
|
main.tabWidget.setCurrentIndex(1)
|
|
|
|
tab = main.sourceTab
|
|
|
|
|
2020-08-10 07:57:13 +00:00
|
|
|
tab.sourceAddFolder.click()
|
2020-10-30 08:30:52 +00:00
|
|
|
qtbot.waitUntil(lambda: tab.sourceFilesWidget.rowCount() == 2, timeout=5000)
|
2021-01-19 20:02:58 +00:00
|
|
|
|
|
|
|
# Test paste button
|
|
|
|
QApplication.clipboard().setText(os.path.expanduser('~')) # Load clipboard
|
|
|
|
qtbot.mouseClick(tab.paste, QtCore.Qt.LeftButton)
|
|
|
|
assert tab.sourceFilesWidget.rowCount() == 3
|