Skip to content

Commit 52704ac

Browse files
committed
fix: desktop bugsweep regressions
1 parent 5d1244a commit 52704ac

5 files changed

Lines changed: 52 additions & 3 deletions

File tree

core/editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def lineNumberAreaPaintEvent(self, event):
306306
else:
307307
painter.setPen(QColor(100, 100, 100))
308308
painter.drawText(0, top, self.lineNumberArea.width() - 5,
309-
self.fontMetrics().height(), Qt.AlignRight, str(line_num))
309+
self.fontMetrics().height(), Qt.AlignmentFlag.AlignRight, str(line_num))
310310
block = block.next()
311311
if not block.isValid():
312312
break

core/output.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ def setup_ui(self):
5555

5656
def run_command(self, command: list):
5757
"""Startet einen Prozess mit dem gegebenen Kommando"""
58+
if not command:
59+
self.status_label.setText("Kein Befehl zum Ausführen")
60+
self.stop_btn.setEnabled(False)
61+
return
62+
5863
if self.process:
5964
for sig in (
6065
self.process.readyReadStandardOutput,

tests/test_bug_regressions.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# -*- coding: utf-8 -*-
2+
"""Regressionstests Bugfix-Library-Transfer Batch #24 — DEV_CodeBox.
3+
4+
D2: Veraltete Qt-Enums in PySide6 6.4+ dürfen nicht mehr als bare Werte vorkommen.
5+
"""
6+
7+
import py_compile
8+
import unittest
9+
from pathlib import Path
10+
11+
PROJ = Path(__file__).parent.parent
12+
13+
14+
class TestD2DeprecatedQtEnums(unittest.TestCase):
15+
"""D2 — Kein bare Qt-Enum in den Quelldateien."""
16+
17+
def test_editor_no_bare_align(self):
18+
src = (PROJ / "core" / "editor.py").read_text(encoding="utf-8")
19+
self.assertNotIn("Qt.AlignRight", src,
20+
"Qt.AlignRight (bare) — muss Qt.AlignmentFlag.AlignRight sein")
21+
22+
def test_main_window_no_bare_orientation(self):
23+
src = (PROJ / "ui" / "main_window.py").read_text(encoding="utf-8")
24+
self.assertNotIn("Qt.Horizontal", src,
25+
"Qt.Horizontal (bare) — muss Qt.Orientation.Horizontal sein")
26+
self.assertNotIn("Qt.Vertical", src,
27+
"Qt.Vertical (bare) — muss Qt.Orientation.Vertical sein")
28+
29+
def test_syntax_valid(self):
30+
for rel in ("core/editor.py", "ui/main_window.py"):
31+
py_compile.compile(str(PROJ / rel), doraise=True)
32+
33+
34+
if __name__ == "__main__":
35+
unittest.main()

tests/test_output_panel.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ def test_run_command_no_disconnect_when_no_prior_process(self):
4848
mock_cls.return_value = mock_new
4949
self.panel.run_command(["echo", "test"])
5050

51+
def test_run_command_rejects_empty_command(self):
52+
"""Leere Provider-Kommandos dürfen nicht per IndexError crashen."""
53+
with patch("core.output.QProcess") as mock_cls:
54+
self.panel.run_command([])
55+
56+
mock_cls.assert_not_called()
57+
self.assertFalse(self.panel.stop_btn.isEnabled())
58+
self.assertIn("Kein Befehl", self.panel.status_label.text())
59+
5160
def test_run_command_stop_btn_enabled_after_start(self):
5261
"""stop_btn muss nach run_command() aktiviert sein."""
5362
with patch("core.output.QProcess") as mock_cls:

ui/main_window.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ def setup_ui(self):
103103
layout.setContentsMargins(0, 0, 0, 0)
104104

105105
# Horizontaler Splitter: ProjectView | Editor+Output
106-
self.h_splitter = QSplitter(Qt.Horizontal)
106+
self.h_splitter = QSplitter(Qt.Orientation.Horizontal)
107107

108108
# Linke Seite: Project-View (Dateibaum)
109109
self.project_view = ProjectView()
110110
self.project_view.fileDoubleClicked.connect(self._open_file_from_project)
111111
self.h_splitter.addWidget(self.project_view)
112112

113113
# Rechte Seite: Vertikaler Splitter (Editor oben, Output/Terminal unten)
114-
self.v_splitter = QSplitter(Qt.Vertical)
114+
self.v_splitter = QSplitter(Qt.Orientation.Vertical)
115115

116116
# Tab-Widget (Editor)
117117
self.tab_widget = TabWidget()

0 commit comments

Comments
 (0)