feat: Add branding import/export functionality and enhance settings dialog with new fields
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
This commit is contained in:
parent
b826bd9b20
commit
55f2ddf4b1
10 changed files with 296 additions and 10 deletions
|
|
@ -1,5 +1,7 @@
|
|||
"""Tests for runtime branding template management."""
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from webdrop_bridge.config import Config, ConfigurationError
|
||||
|
|
@ -114,6 +116,21 @@ def test_delete_custom_branding_removes_it(tmp_path):
|
|||
assert not manager.has_template("customer_b")
|
||||
|
||||
|
||||
def test_build_template_preserves_app_and_window_titles(tmp_path):
|
||||
"""Custom brandings should keep their editable app and window title values."""
|
||||
manager = BrandingManager(base_dir=tmp_path)
|
||||
|
||||
template = manager.build_template(
|
||||
template_id="Customer C",
|
||||
display_name="Customer C",
|
||||
app_name="Customer Bridge",
|
||||
window_title="Customer Bridge Desktop",
|
||||
)
|
||||
|
||||
assert template.app_name == "Customer Bridge"
|
||||
assert template.window_title == "Customer Bridge Desktop"
|
||||
|
||||
|
||||
def test_invalid_logo_file_is_rejected(tmp_path):
|
||||
"""Non-existent logo files should not be accepted for saved brandings."""
|
||||
manager = BrandingManager(base_dir=tmp_path)
|
||||
|
|
@ -124,3 +141,32 @@ def test_invalid_logo_file_is_rejected(tmp_path):
|
|||
display_name="Customer C",
|
||||
logo_path=str(tmp_path / "missing-logo.png"),
|
||||
)
|
||||
|
||||
|
||||
def test_exported_branding_can_be_imported_for_another_user(tmp_path):
|
||||
"""Exported brandings should be shareable and importable by another user."""
|
||||
source_logo = tmp_path / "shared-logo.png"
|
||||
source_logo.write_bytes(b"fake-png-data")
|
||||
|
||||
source_manager = BrandingManager(base_dir=tmp_path / "source")
|
||||
template = source_manager.build_template(
|
||||
template_id="Customer D",
|
||||
display_name="Customer D",
|
||||
app_name="Customer Bridge",
|
||||
window_title="Customer Window",
|
||||
logo_path=str(source_logo),
|
||||
)
|
||||
source_manager.save_template(template)
|
||||
|
||||
export_path = tmp_path / "export" / "customer_d.json"
|
||||
source_manager.export_template("customer_d", export_path)
|
||||
|
||||
target_manager = BrandingManager(base_dir=tmp_path / "target")
|
||||
imported = target_manager.import_template(export_path)
|
||||
|
||||
assert imported.template_id == "customer_d"
|
||||
assert imported.display_name == "Customer D"
|
||||
assert imported.app_name == "Customer Bridge"
|
||||
assert imported.window_title == "Customer Window"
|
||||
assert Path(imported.logo_path).exists()
|
||||
assert target_manager.has_template("customer_d")
|
||||
|
|
|
|||
|
|
@ -120,9 +120,15 @@ class TestSettingsDialogInitialization:
|
|||
qtbot.addWidget(dialog)
|
||||
|
||||
assert dialog.branding_display_name_input.text() == "Default"
|
||||
assert dialog.branding_app_name_input.text() == "WebDrop Bridge"
|
||||
assert "WebDrop Bridge" in dialog.branding_window_title_input.text()
|
||||
assert dialog.branding_logo_path_input is not None
|
||||
assert dialog.browse_branding_logo_btn is not None
|
||||
assert dialog.branding_preview_name_label.text() == "Default"
|
||||
assert dialog.branding_preview_icon_label.pixmap() is not None
|
||||
assert not dialog.branding_preview_icon_label.pixmap().isNull()
|
||||
assert dialog.export_branding_btn is not None
|
||||
assert dialog.import_branding_btn is not None
|
||||
assert dialog.delete_branding_btn is not None
|
||||
|
||||
def test_save_branding_as_creates_custom_template(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue