mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-14 01:59:26 +03:00
Improve code spacing
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -1163,6 +1163,7 @@ class AppQMessageBox(AppQTransientDialog):
|
||||
| QtCore.Qt.WindowType.FramelessWindowHint
|
||||
| QtCore.Qt.WindowType.NoDropShadowWindowHint
|
||||
)
|
||||
|
||||
self.setWindowFlags(windowFlags)
|
||||
|
||||
self.setAttribute(
|
||||
@@ -1176,6 +1177,7 @@ class AppQMessageBox(AppQTransientDialog):
|
||||
QPalette.ColorRole.Window,
|
||||
QColor(QtCore.Qt.GlobalColor.transparent),
|
||||
)
|
||||
|
||||
self.setPalette(windowPalette)
|
||||
|
||||
self.setModal(True)
|
||||
|
||||
@@ -241,6 +241,7 @@ class SubscriptionSynchronizer:
|
||||
if profile.itemSubscription == groupId and profile.itemSubscriptionManaged
|
||||
]
|
||||
insertionIndex = min(managedIndexes) if managedIndexes else len(profiles)
|
||||
|
||||
existingByKey = {
|
||||
legacyKeys.get(
|
||||
id(profiles[index]),
|
||||
|
||||
@@ -727,6 +727,7 @@ class EndpointInfoWidget(Mixins.ThemeAware, Mixins.QTranslatable, QFrame):
|
||||
super().__init__(parent)
|
||||
|
||||
self.service = service
|
||||
|
||||
self.setObjectName('MetricsSection')
|
||||
self.setMinimumHeight(360)
|
||||
|
||||
@@ -899,6 +900,7 @@ class EndpointInfoWidget(Mixins.ThemeAware, Mixins.QTranslatable, QFrame):
|
||||
mapMessage = ''
|
||||
|
||||
self.mapWidget.setLocation(location, mapMessage, loading=mapLoading)
|
||||
|
||||
self._setLoadingAnimationsEnabled(self.isVisible())
|
||||
|
||||
def _setLoadingAnimationsEnabled(self, enabled):
|
||||
|
||||
Vendored
+2
@@ -209,6 +209,7 @@ def runShutdownProbe(mode, *, timeout=0.5, exitcode=0, idleMilliseconds=0):
|
||||
"""Return actual child reaping and exit classification, with a test failsafe."""
|
||||
with tempfile.TemporaryDirectory(prefix='furious-shutdown-') as directory:
|
||||
path = str(Path(directory) / 'events.txt')
|
||||
|
||||
# The child may be killed before publishing any events. Preserve an
|
||||
# empty log so the result still exposes its exit/deadline diagnostics.
|
||||
Path(path).touch()
|
||||
@@ -241,6 +242,7 @@ def runShutdownProbe(mode, *, timeout=0.5, exitcode=0, idleMilliseconds=0):
|
||||
|
||||
try:
|
||||
result = process.waitForExit()
|
||||
|
||||
return {
|
||||
'mode': mode,
|
||||
'exitcode': result,
|
||||
|
||||
@@ -247,6 +247,7 @@ class AppMainProcessTest(unittest.TestCase):
|
||||
ApplicationRunner.ExitCode.UnknownException.value,
|
||||
result,
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
diagnostic.count('Traceback (most recent call last):'), 1, result
|
||||
)
|
||||
|
||||
@@ -937,6 +937,7 @@ class RoutingControllerTest(unittest.TestCase):
|
||||
mock.patch('sys.excepthook') as exceptionHook,
|
||||
):
|
||||
AppSettings.set('Routing', 'Custom:active')
|
||||
|
||||
controller = RoutingController()
|
||||
|
||||
with mock.patch.object(app, 'routingController', controller):
|
||||
@@ -954,6 +955,7 @@ class RoutingControllerTest(unittest.TestCase):
|
||||
)
|
||||
|
||||
prompt = view.findChild(MBoxNewChangesNextTime)
|
||||
|
||||
self.assertIsNotNone(prompt)
|
||||
|
||||
prompt.button(AppQMessageBox.StandardButton.Yes).click()
|
||||
@@ -970,6 +972,7 @@ class RoutingControllerTest(unittest.TestCase):
|
||||
view.indexWidget(view.sourceModel.index(0, 2)).setCurrentIndex(
|
||||
0
|
||||
)
|
||||
|
||||
tray.rebuildMenu()
|
||||
|
||||
self.assertEqual(controller.routing, fallback)
|
||||
@@ -1013,6 +1016,7 @@ class RoutingControllerTest(unittest.TestCase):
|
||||
view.indexWidget(view.sourceModel.index(0, 2)).setCurrentIndex(
|
||||
0
|
||||
)
|
||||
|
||||
tray.rebuildMenu()
|
||||
|
||||
self.assertEqual(controller.routing, fallback)
|
||||
@@ -1021,13 +1025,17 @@ class RoutingControllerTest(unittest.TestCase):
|
||||
exceptionHook.assert_not_called()
|
||||
finally:
|
||||
connection.startDisconnection()
|
||||
|
||||
view.deleteLater()
|
||||
controller.deleteLater()
|
||||
|
||||
processQtEvents()
|
||||
|
||||
connection.deleteLater()
|
||||
logManager.deleteLater()
|
||||
|
||||
registry.shutdown()
|
||||
|
||||
processQtEvents()
|
||||
|
||||
def testOnlyExplicitInvalidationPersistsFallbackWithoutReconnecting(self):
|
||||
|
||||
@@ -841,6 +841,7 @@ class EndpointInfoServiceTest(unittest.TestCase):
|
||||
self.assertIsInstance(widget.mapWidget.webView, QWebEngineView)
|
||||
self.assertEqual(widget.mapWidget.webProfile.httpUserAgent(), 'Mozilla/5.0')
|
||||
self.assertNotIn('Furious', widget.mapWidget.webProfile.httpUserAgent())
|
||||
|
||||
self.assertTrue(widget.mapWidget._lastWebState['markerVisible'])
|
||||
self.assertEqual(
|
||||
widget.mapWidget._lastWebState['fontFamily'],
|
||||
@@ -942,6 +943,7 @@ class EndpointInfoServiceTest(unittest.TestCase):
|
||||
self.assertIn("'source-layer': 'place'", mapScript)
|
||||
self.assertIn("'source-layer': 'poi'", mapScript)
|
||||
self.assertIn("'text-field': nameField", mapScript)
|
||||
|
||||
self.assertIn('Number.isFinite(longitude)', mapScript)
|
||||
self.assertNotIn('lightStyleUrl', widget.mapWidget._lastWebState)
|
||||
self.assertNotIn('darkStyleUrl', widget.mapWidget._lastWebState)
|
||||
|
||||
@@ -286,6 +286,7 @@ class Hysteria2CompatibilityTest(unittest.TestCase):
|
||||
for theme in (AppStyleSheet.Light, AppStyleSheet.Dark):
|
||||
with self.subTest(theme=theme):
|
||||
app.setStyleSheet(AppStyleSheet.forTheme(theme))
|
||||
|
||||
editor = Hysteria2Editor()
|
||||
editor.show()
|
||||
app.processEvents()
|
||||
@@ -334,6 +335,7 @@ class Hysteria2CompatibilityTest(unittest.TestCase):
|
||||
editor.groupBoxSequence(), firstWidgets
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(len(set(firstPositions)), 1)
|
||||
|
||||
row = advanced.optionsRow._widget
|
||||
|
||||
@@ -204,11 +204,13 @@ def _assertManagerInvariants(testCase, manager, model=None):
|
||||
|
||||
for categoryId, categoryEntries in generation.entriesByCategory.items():
|
||||
category = manager._categories[categoryId]
|
||||
|
||||
testCase.assertIs(
|
||||
manager._generationForCategoryLocked(category), generation
|
||||
)
|
||||
|
||||
indexed = tuple(categoryEntries.entries.values())
|
||||
|
||||
testCase.assertTrue(indexed)
|
||||
testCase.assertEqual(
|
||||
tuple(entry.sequence for entry in indexed),
|
||||
@@ -901,35 +903,44 @@ class GenerationLogManagerContractTest(unittest.TestCase):
|
||||
|
||||
for message, categoryId in messages:
|
||||
manager.append(message, categoryId)
|
||||
|
||||
self.assertTrue(waitFor(lambda: not page._entriesDirty))
|
||||
self.assertPageMatchesManager(page, manager)
|
||||
|
||||
coreIndex = page.filterComboBox.findData(CORE_LOG_CATEGORY)
|
||||
page.filterComboBox.setCurrentIndex(coreIndex)
|
||||
|
||||
self.assertTrue(waitFor(lambda: not page._entriesDirty))
|
||||
self.assertPageMatchesManager(page, manager, CORE_LOG_CATEGORY)
|
||||
|
||||
manager.clear(CORE_LOG_CATEGORY)
|
||||
|
||||
self.assertTrue(waitFor(lambda: not page._entriesDirty))
|
||||
self.assertPageMatchesManager(page, manager, CORE_LOG_CATEGORY)
|
||||
|
||||
manager.append('runtime\ncore', CORE_LOG_CATEGORY)
|
||||
manager.append('runtime\rcomponent', TUN_LOG_CATEGORY)
|
||||
|
||||
self.assertTrue(waitFor(lambda: not page._entriesDirty))
|
||||
self.assertPageMatchesManager(page, manager, CORE_LOG_CATEGORY)
|
||||
|
||||
manager.clear(runtimeOnly=True)
|
||||
|
||||
self.assertTrue(waitFor(lambda: not page._entriesDirty))
|
||||
self.assertPageMatchesManager(page, manager, CORE_LOG_CATEGORY)
|
||||
|
||||
allIndex = page.filterComboBox.findData('all')
|
||||
page.filterComboBox.setCurrentIndex(allIndex)
|
||||
|
||||
self.assertTrue(waitFor(lambda: not page._entriesDirty))
|
||||
self.assertPageMatchesManager(page, manager)
|
||||
|
||||
manager.append('before\nfull clear')
|
||||
|
||||
self.assertTrue(waitFor(lambda: not page._entriesDirty))
|
||||
|
||||
manager.clear()
|
||||
|
||||
self.assertTrue(waitFor(lambda: not page._entriesDirty))
|
||||
self.assertPageMatchesManager(page, manager)
|
||||
|
||||
|
||||
@@ -1423,6 +1423,7 @@ assert not errors, errors
|
||||
profile.metadata.speed = f'{profile.itemRemark} speed'
|
||||
|
||||
manager = self._manager((retained, removed, other, manual))
|
||||
|
||||
latencyScheduler = manager._latencyScheduler
|
||||
pool = _ControlledThreadPool()
|
||||
latencyScheduler.threadPool = pool
|
||||
@@ -1434,6 +1435,7 @@ assert not errors, errors
|
||||
concurrent=False,
|
||||
)
|
||||
manager.testDownloadSpeed((retained,), concurrent=True)
|
||||
|
||||
processQtEvents()
|
||||
|
||||
activeLatency = pool.started[0]
|
||||
@@ -1487,6 +1489,7 @@ assert not errors, errors
|
||||
self.assertEqual(len(pool.started), 2)
|
||||
|
||||
otherLatency = pool.started[1]
|
||||
|
||||
otherLatency.finish('9ms')
|
||||
processQtEvents()
|
||||
|
||||
|
||||
@@ -103,6 +103,7 @@ class SingTUNLinuxHostTest(unittest.TestCase):
|
||||
Path(arguments[2]).parent.joinpath('ready').write_text(
|
||||
'77', encoding='utf-8'
|
||||
)
|
||||
|
||||
return process
|
||||
|
||||
link = {'ifname': 'utun101', 'ifindex': 77}
|
||||
@@ -117,8 +118,10 @@ class SingTUNLinuxHostTest(unittest.TestCase):
|
||||
self.module, '_command', return_value=json.dumps([link])
|
||||
):
|
||||
self.host.prepare()
|
||||
|
||||
with self.assertRaisesRegex(RuntimeError, 'already active'):
|
||||
self.host.execute([])
|
||||
|
||||
self.host.applyDNS('1.1.1.1')
|
||||
|
||||
self.assertEqual(self.host.index, 77)
|
||||
@@ -135,6 +138,7 @@ class SingTUNLinuxHostTest(unittest.TestCase):
|
||||
self.assertIn('/sys/class/net/utun101/ifindex', scripts[0])
|
||||
self.assertIn('resolvectl dns utun101 1.1.1.1', scripts[0])
|
||||
self.assertNotIn('socks5', ''.join(scripts))
|
||||
|
||||
self.assertIs(self.host._process, process)
|
||||
self.assertIsNotNone(self.host._directory)
|
||||
|
||||
@@ -157,6 +161,7 @@ class SingTUNLinuxHostTest(unittest.TestCase):
|
||||
checked = subprocess.run(
|
||||
[bash, '-n', '-c', script], capture_output=True, timeout=5
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
checked.returncode, 0, checked.stderr.decode(errors='replace')
|
||||
)
|
||||
|
||||
@@ -429,6 +429,7 @@ class StyleSheetStateRenderingTest(unittest.TestCase):
|
||||
buttons = edit.findChildren(QToolButton)
|
||||
self.assertEqual(len(buttons), 1)
|
||||
button = buttons[0]
|
||||
|
||||
self.assertTrue(edit.rect().contains(button.geometry()))
|
||||
self.assertLessEqual(
|
||||
abs(
|
||||
@@ -439,6 +440,7 @@ class StyleSheetStateRenderingTest(unittest.TestCase):
|
||||
)
|
||||
|
||||
self.assertFalse(button.icon().isNull())
|
||||
|
||||
pixmap = button.icon().pixmap(16, 16).toImage()
|
||||
colors = [
|
||||
pixmap.pixelColor(x, y)
|
||||
@@ -464,6 +466,7 @@ class StyleSheetStateRenderingTest(unittest.TestCase):
|
||||
|
||||
edit.setText('read only')
|
||||
edit.setReadOnly(True)
|
||||
|
||||
app.setStyleSheet(AppStyleSheet.forTheme(AppStyleSheet.Light))
|
||||
processQtEvents()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user