29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
from types import SimpleNamespace
|
|
|
|
from PyQt6.QtWidgets import QApplication
|
|
|
|
from syncvito.main_window import PROGRESS_BAR_WIDTH, PROGRESS_TEXT_WIDTH, MainWindow
|
|
|
|
|
|
def test_progress_widgets_keep_fixed_widths_for_long_paths() -> None:
|
|
application = QApplication.instance() or QApplication([])
|
|
owner = SimpleNamespace()
|
|
dock = MainWindow._build_progress_dock(owner)
|
|
dock.resize(900, 66)
|
|
dock.show()
|
|
application.processEvents()
|
|
bar_x = owner.progress_bar.x()
|
|
long_path = "Kopieren: " + "sehr-langer-ordner\\" * 20 + "wichtige-datei.ini"
|
|
|
|
owner.progress_text.setText(long_path)
|
|
application.processEvents()
|
|
|
|
assert owner.progress_text.width() == PROGRESS_TEXT_WIDTH
|
|
assert owner.progress_bar.width() == PROGRESS_BAR_WIDTH
|
|
assert owner.progress_bar.x() == bar_x
|
|
assert owner.progress_text.text() != long_path
|
|
assert "…" in owner.progress_text.text()
|
|
assert owner.progress_text.toolTip() == long_path
|
|
assert owner.progress_text.accessibleName() == long_path
|
|
dock.close()
|