feat: Enhance branding management with editable fields and save functionality in settings dialog
This commit is contained in:
parent
fe341163e8
commit
e52c09857f
9 changed files with 178 additions and 8 deletions
|
|
@ -1,6 +1,7 @@
|
|||
"""Tests for settings dialog."""
|
||||
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -110,6 +111,34 @@ class TestSettingsDialogInitialization:
|
|||
assert "backup" in dialog.export_btn.toolTip().lower()
|
||||
assert "json" in dialog.import_btn.toolTip().lower()
|
||||
|
||||
def test_branding_editor_fields_are_initialized(
|
||||
self, qtbot, sample_config, monkeypatch, tmp_path
|
||||
):
|
||||
"""Test branding tab exposes editable fields for the selected template."""
|
||||
monkeypatch.setenv("WEBDROP_BRANDING_DIR", str(tmp_path / "branding"))
|
||||
dialog = SettingsDialog(sample_config)
|
||||
qtbot.addWidget(dialog)
|
||||
|
||||
assert dialog.branding_display_name_input.text() == "Default"
|
||||
assert dialog.branding_app_name_input.text() == "WebDrop Bridge"
|
||||
|
||||
def test_save_branding_as_creates_custom_template(
|
||||
self, qtbot, sample_config, monkeypatch, tmp_path
|
||||
):
|
||||
"""Test edited branding can be saved as a new reusable template."""
|
||||
monkeypatch.setenv("WEBDROP_BRANDING_DIR", str(tmp_path / "branding"))
|
||||
dialog = SettingsDialog(sample_config)
|
||||
qtbot.addWidget(dialog)
|
||||
|
||||
dialog.branding_display_name_input.setText("Customer A")
|
||||
dialog.branding_app_name_input.setText("Customer A Bridge")
|
||||
|
||||
with patch("PySide6.QtWidgets.QInputDialog.getText", return_value=("customer_a", True)):
|
||||
dialog._save_branding_as()
|
||||
|
||||
assert dialog.branding_manager.has_template("customer_a")
|
||||
assert dialog.branding_combo.findData("customer_a") >= 0
|
||||
|
||||
|
||||
class TestPathsTab:
|
||||
"""Test Paths configuration tab."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue