mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-07-21 21:16:20 +02:00
refactor(ui): use Qt's .layout() method instead of _layout references
This commit is contained in:
@@ -74,7 +74,7 @@ def test_file_path_display(
|
||||
entry = qt_driver.lib.get_entry(2)
|
||||
assert isinstance(entry, Entry)
|
||||
filename = entry.path
|
||||
panel._layout.file_attrs.update_stats(filepath=unwrap(qt_driver.lib.library_dir) / filename)
|
||||
panel.layout().file_attrs.update_stats(filepath=unwrap(qt_driver.lib.library_dir) / filename)
|
||||
|
||||
# Generate the expected file string.
|
||||
# This is copied directly from the file_attributes.py file
|
||||
@@ -92,7 +92,7 @@ def test_file_path_display(
|
||||
file_str += f"<b>{'\u200b'.join(part_)}</b>"
|
||||
|
||||
# Assert the file path is displayed correctly
|
||||
assert panel._layout.file_attrs.file_label.text() == file_str
|
||||
assert panel.layout().file_attrs.file_label.text() == file_str
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@@ -17,10 +17,10 @@ def test_update_selection_empty(qt_driver: QtDriver):
|
||||
panel.set_selection(qt_driver.selected)
|
||||
|
||||
# Panel should disable UI that allows for entry modification
|
||||
assert panel._layout.add_tag_button.isEnabled() == panel._layout.add_field_button.isEnabled()
|
||||
assert panel.layout().add_tag_button.isEnabled() == panel.layout().add_field_button.isEnabled()
|
||||
assert (
|
||||
not panel._layout.add_tag_button.isEnabled()
|
||||
and not panel._layout.add_field_button.isEnabled()
|
||||
not panel.layout().add_tag_button.isEnabled()
|
||||
and not panel.layout().add_field_button.isEnabled()
|
||||
)
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ def test_update_selection_single(qt_driver: QtDriver, entry_full: Entry):
|
||||
panel.set_selection(qt_driver.selected)
|
||||
|
||||
# Panel should enable UI that allows for entry modification
|
||||
assert panel._layout.add_tag_button.isEnabled() == panel._layout.add_field_button.isEnabled()
|
||||
assert panel._layout.add_tag_button.isEnabled() and panel._layout.add_field_button.isEnabled()
|
||||
assert panel.layout().add_tag_button.isEnabled() == panel.layout().add_field_button.isEnabled()
|
||||
assert panel.layout().add_tag_button.isEnabled() and panel.layout().add_field_button.isEnabled()
|
||||
|
||||
|
||||
def test_update_selection_multiple(qt_driver: QtDriver):
|
||||
@@ -45,5 +45,5 @@ def test_update_selection_multiple(qt_driver: QtDriver):
|
||||
panel.set_selection(qt_driver.selected)
|
||||
|
||||
# Panel should enable UI that allows for entry modification
|
||||
assert panel._layout.add_tag_button.isEnabled() == panel._layout.add_field_button.isEnabled()
|
||||
assert panel._layout.add_tag_button.isEnabled() and panel._layout.add_field_button.isEnabled()
|
||||
assert panel.layout().add_tag_button.isEnabled() == panel.layout().add_field_button.isEnabled()
|
||||
assert panel.layout().add_tag_button.isEnabled() and panel.layout().add_field_button.isEnabled()
|
||||
|
||||
Reference in New Issue
Block a user