mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-07-21 21:16:20 +02:00
refactor(ui): refactor SearchPanel classes to use newer MVC pattern
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# SPDX-FileCopyrightText: (c) TagStudio Contributors
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# pyright: reportPrivateUsage = false
|
||||
|
||||
from collections.abc import Callable
|
||||
|
||||
@@ -22,7 +23,7 @@ def test_build_tag_panel_add_sub_tag_callback(
|
||||
panel: BuildTagPanel = BuildTagPanel(library, child)
|
||||
qtbot.addWidget(panel)
|
||||
|
||||
panel._add_parent_tag_callback(parent.id) # pyright: ignore[reportPrivateUsage]
|
||||
panel._add_parent_tag_callback(parent.id)
|
||||
|
||||
assert len(panel.parent_ids) == 1
|
||||
|
||||
@@ -40,7 +41,7 @@ def test_build_tag_panel_remove_subtag_callback(
|
||||
panel: BuildTagPanel = BuildTagPanel(library, child)
|
||||
qtbot.addWidget(panel)
|
||||
|
||||
panel._remove_parent_tag_callback(parent.id) # pyright: ignore[reportPrivateUsage]
|
||||
panel._remove_parent_tag_callback(parent.id)
|
||||
|
||||
assert len(panel.parent_ids) == 0
|
||||
|
||||
@@ -58,7 +59,7 @@ def test_build_tag_panel_add_alias_callback(
|
||||
panel: BuildTagPanel = BuildTagPanel(library, tag)
|
||||
qtbot.addWidget(panel)
|
||||
|
||||
panel._create_alias_callback() # pyright: ignore[reportPrivateUsage]
|
||||
panel._create_alias_callback()
|
||||
|
||||
assert panel.aliases_table.rowCount() == 1
|
||||
|
||||
|
||||
@@ -8,13 +8,12 @@ from pytestqt.qtbot import QtBot
|
||||
from tagstudio.core.library.alchemy.library import Library
|
||||
from tagstudio.qt.controllers.tag_search_panel_controller import TagSearchPanel
|
||||
from tagstudio.qt.mixed.tag_widget import TagWidget
|
||||
from tagstudio.qt.ts_qt import QtDriver
|
||||
from tagstudio.qt.views.tag_search_panel_view import TagSearchPanelView
|
||||
from tagstudio.qt.views.search_panel_view import SearchPanelView
|
||||
|
||||
|
||||
def test_update_tags(qtbot: QtBot, library: Library):
|
||||
# Given
|
||||
panel = TagSearchPanel(library, view=TagSearchPanelView(is_tag_chooser=True))
|
||||
panel = TagSearchPanel(library, view=SearchPanelView("", is_chooser=True))
|
||||
|
||||
qtbot.addWidget(panel)
|
||||
|
||||
@@ -22,10 +21,9 @@ def test_update_tags(qtbot: QtBot, library: Library):
|
||||
panel.update_items()
|
||||
|
||||
|
||||
def test_tag_widget_actions_replaced_correctly(qtbot: QtBot, qt_driver: QtDriver, library: Library):
|
||||
panel = TagSearchPanel(library, view=TagSearchPanelView(is_tag_chooser=True))
|
||||
def test_tag_widget_actions_replaced_correctly(qtbot: QtBot, library: Library):
|
||||
panel = TagSearchPanel(library, view=SearchPanelView(""))
|
||||
qtbot.addWidget(panel)
|
||||
panel.set_driver(qt_driver)
|
||||
|
||||
# Set the widget
|
||||
tags = library.tags
|
||||
|
||||
Reference in New Issue
Block a user