Skip to content

Commit

Permalink
Fixed the change download files action accessing the old tree view (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
qstokkink authored Dec 11, 2023
1 parent 06e3dd6 commit a25df64
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
15 changes: 7 additions & 8 deletions scripts/application_tester/tribler_apptester/action_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ class ActionSelector:

def __init__(self):
self.actions_with_probabilities = {
'test_exception': (lambda: TestExceptionAction(), 0),
'random_page': (lambda: RandomPageAction(), 20),
'search': (lambda: RandomSearchAction(), 15),
'test_exception': (TestExceptionAction, 0),
'random_page': (RandomPageAction, 20),
'search': (RandomSearchAction, 15),
'start_download': (lambda: StartRandomDownloadAction(Path(__file__).parent / "data/torrent_links.txt"), 15),
'remove_download': (lambda: RemoveRandomDownloadAction(), 5),
'explore_download': (lambda: ExploreDownloadAction(), 10),
'screenshot': (lambda: ScreenshotAction(), 5),
'remove_download': (RemoveRandomDownloadAction, 5),
'explore_download': (ExploreDownloadAction, 10),
'screenshot': (ScreenshotAction, 5),
'change_anonymity': (lambda: ChangeAnonymityAction(allow_plain=True), 5),
# See: https://github.com/Tribler/tribler/issues/7750
# 'change_download_files': (lambda: ChangeDownloadFilesAction(), 10)
'change_download_files': (ChangeDownloadFilesAction, 10)
}

def get_random_action_with_probability(self) -> Optional[Action]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,27 @@ def __init__(self):
self.add_action(WaitAction(2000))
self.add_action(CustomAction("""
tree_view = window.download_files_list
if tree_view.topLevelItemCount() == 0:
if tree_view.rowCount() == 0:
exit_script()
item = tree_view.topLevelItem(randint(0, tree_view.topLevelItemCount() - 1))
check_state = Qt.Checked if item.checkState(CHECKBOX_COL) == Qt.Unchecked else Qt.Unchecked
item.setCheckState(CHECKBOX_COL, check_state)
QMetaObject.invokeMethod(tree_view, "itemClicked", Q_ARG(QTreeWidgetItem, item), Q_ARG(int, CHECKBOX_COL))
tree_view.selectRow(0)
item = tree_view.item(0, 1)
QMetaObject.invokeMethod(tree_view, "itemClicked", Q_ARG(QTableWidgetItem, item))
"""))
self.add_action(WaitAction(2000))
self.add_action(CustomAction("""
tree_view = window.download_files_list
if tree_view.rowCount() == 0:
exit_script()
item = tree_view.item(randint(0, tree_view.rowCount() - 1), 0)
check_state = Qt.Checked if item.checkState() == Qt.Unchecked else Qt.Unchecked
item.setCheckState(check_state)
QMetaObject.invokeMethod(tree_view, "itemClicked", Q_ARG(QTableWidgetItem, item))
"""))

def required_imports(self):
return [
"from random import randint",
"from PyQt5.QtCore import QMetaObject, Q_ARG, Qt",
"from PyQt5.QtWidgets import QTreeWidgetItem",
"from PyQt5.QtWidgets import QTableWidgetItem",
"from tribler.gui.widgets.torrentfiletreewidget import CHECKBOX_COL"
]
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ http://www.frostclick.com/torrents/video/animation/Big_Buck_Bunny_1080p_surround
https://linuxtracker.org/download.php?id=873dd05bd69f2626e4123887e7bb7922aaeb4efa&f=linuxmint-20.2-cinnamon-64bit.iso.torrent
https://linuxtracker.org/download.php?id=c91579570815c913b2bd2cd5dd76d8e165d8e57f&f=Kali+Linux+2021.3+Virtualbox+64Bit+OVA.torrent
https://linuxtracker.org/download.php?id=f62121927d19c7cedf4e41796166f937c698303f&f=CentOS+8.4.2105+x86-64+Boot.torrent
https://academictorrents.com/download/d9e554f4f0c3047d9f49e448a7004f7aa1701b69.torrent
https://academictorrents.com/download/d9e554f4f0c3047d9f49e448a7004f7aa1701b69.torrent

0 comments on commit a25df64

Please sign in to comment.