diff --git a/Furious/Externals/GenTranslation.py b/Furious/Externals/GenTranslation.py index 6cc7861..14aed3c 100644 --- a/Furious/Externals/GenTranslation.py +++ b/Furious/Externals/GenTranslation.py @@ -549,14 +549,6 @@ TRANSLATION = { "ZH": "测试下行速度", "isReviewed": "True" }, - "Test Download Speed (Multithreaded)": { - "source": [ - "Furious.Widget.ServerTableView" - ], - "RU": "Измерить скорость загрузки (многопоточная)", - "ZH": "测试下行速度(多线程)", - "isReviewed": "True" - }, "Clear Test Results": { "source": [ "Furious.Widget.ServerTableView" diff --git a/Furious/Widget/ServerTableView.py b/Furious/Widget/ServerTableView.py index 06c4acc..4211703 100644 --- a/Furious/Widget/ServerTableView.py +++ b/Furious/Widget/ServerTableView.py @@ -1472,22 +1472,17 @@ class ServerTableView( QtCore.Qt.Key.Key_O, ), ), + # The context menu intentionally exposes only the multithreaded test. + # Keep the single-threaded methods as a programmatic API for callers + # that need that scheduler explicitly. AppQAction( - _('Test Download Speed (Multithreaded)'), + _('Test Download Speed'), callback=lambda: self.testSelectedItemDownloadSpeedMulti(), shortcut=QtCore.QKeyCombination( QtCore.Qt.KeyboardModifier.ControlModifier, QtCore.Qt.Key.Key_M, ), ), - AppQAction( - _('Test Download Speed'), - callback=lambda: self.testSelectedItemDownloadSpeed(), - shortcut=QtCore.QKeyCombination( - QtCore.Qt.KeyboardModifier.ControlModifier, - QtCore.Qt.Key.Key_T, - ), - ), AppQAction( _('Clear Test Results'), callback=lambda: self.clearSelectedItemTestResult(), @@ -2511,7 +2506,11 @@ class ServerTableView( ) def testSelectedItemDownloadSpeed(self): - """Handle test selected item download speed for the user servers Qt table view.""" + """Run the retained single-threaded download-test API for selected rows. + + The Home context menu uses the multithreaded variant; this method remains + available for programmatic callers that explicitly need serial scheduling. + """ self.testSelectedItemDownloadSpeedWithTimeout(5000) def testSelectedItemDownloadSpeedMulti(self): diff --git a/tests/test_qt_interactions.py b/tests/test_qt_interactions.py index 5bcb744..33c6ed6 100644 --- a/tests/test_qt_interactions.py +++ b/tests/test_qt_interactions.py @@ -35,7 +35,7 @@ from Furious.Window.SettingsPage import ( ) from Furious.Window.SubscriptionPage import _SubscriptionEditorDialog -from PySide6 import QtCore +from PySide6 import QtCore, QtGui from PySide6.QtTest import QTest from PySide6.QtWidgets import QLineEdit, QVBoxLayout, QWidget @@ -361,6 +361,48 @@ class ServerTableQtInteractionTest(unittest.TestCase): window.close() window.deleteLater() + def testContextMenuUsesOnlyMultithreadedDownloadSpeedAction(self): + """Expose one download command backed by the multithreaded scheduler.""" + with isolatedSettings(): + table = self._table(('one',)) + + try: + actions = tuple( + action + for action in table.contextMenu.actions() + if not action.isSeparator() + and action.textEnglish == 'Test Download Speed' + ) + + self.assertEqual(len(actions), 1) + self.assertEqual( + actions[0].shortcut(), + QtGui.QKeySequence( + QtCore.QKeyCombination( + QtCore.Qt.KeyboardModifier.ControlModifier, + QtCore.Qt.Key.Key_M, + ) + ), + ) + + with ( + mock.patch.object( + table, + 'testSelectedItemDownloadSpeedMulti', + ) as multithreaded, + mock.patch.object( + table, + 'testSelectedItemDownloadSpeed', + ) as singleThreaded, + ): + actions[0].trigger() + processQtEvents() + + multithreaded.assert_called_once_with() + singleThreaded.assert_not_called() + finally: + self._destroyTable(table) + def testHeaderSortPreservesSelectionCurrentAndActiveIdentity(self): """Remap Qt persistent indexes when a real header click sorts rows.""" with isolatedSettings():